|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
Mat(S): the N×N matrix over a semiring S. Entries are stored row-major; ⊕ / ⊗ are S's semiring operations, read off dedekind::algebra::semiring_ops (never native operator+/ which the tropical carriers skew).
More...*,

Public Types | |
| using | scalar_type = S |
| using | dimension_type = dedekind::sets::Finite |
| using | column_type = Ket<S, N> |
A column is a Ket, a row a Bra — the bra·ket are the matrix's column/row vectors, so Mat(S) is an IsMatrix. | |
| using | row_type = Bra<S, N> |
| using | Domain = Ket<S, N> |
Mat(S) is the linear operator \(|v\rangle \mapsto
M|v\rangle\) — a callable IsArrow with Domain = Codomain = Ket<S,N>. | |
| using | Codomain = Ket<S, N> |
Public Member Functions | |
| constexpr S | operator() (std::size_t i, std::size_t j) const |
| constexpr Ket< S, N > | operator() (const Ket< S, N > &v) const |
Matrix-vector application \((M|v\rangle)_i = \bigoplus_j M_{ij}
\otimes v_j\) over S's semiring ops (never native +/ which the tropical carriers skew). The IsArrow call operator: Ket → Ket. | |
| constexpr const std::array< S, N > & | operator[] (std::size_t i) const |
| constexpr std::array< S, N > & | operator[] (std::size_t i) |
| constexpr MatNxNV | transpose () const |
| Transpose \(M^{\top}\) — reflect across the main diagonal. | |
| constexpr column_type | column (std::size_t j) const |
The j-th column as a Ket (the horizontal decomposition). | |
| constexpr row_type | row (std::size_t i) const |
The i-th row as a Bra (the vertical decomposition). | |
Public Attributes | |
| std::array< std::array< S, N >, N > | e {} |
Static Public Attributes | |
| static constexpr std::size_t | row_count = N |
| static constexpr std::size_t | column_count = N |
| template<typename Op> | |
| static constexpr bool | is_associative_v |
§4 property distribution: matrix ⊕ (MatPlus) is associative exactly when the base ⊕ is; matrix ⊗ (MatTimes) is associative exactly when S is a semiring (the ⊕/⊗ contraction's associativity needs S's associativity AND distributivity), so a non-semiring S no longer certifies IsSemiring<Mat(S)>. | |
| template<typename Op> | |
| static constexpr bool | is_commutative_v |
Only ⊕ (MatPlus) is commutative (⊗ is not), and only when the base ⊕ is. | |
| template<typename Op> | |
| static constexpr bool | is_idempotent_v |
⊕ is idempotent exactly when the base ⊕ is (dioid lift). | |
Friends | |
| constexpr bool | operator== (const MatNxNV &, const MatNxNV &)=default |
| constexpr MatNxNV | operator+ (const MatNxNV &a, const MatNxNV &b) |
Terse SYNTAX over the semiring SEMANTICS (#796): A+B is the elementwise ⊕ (MatPlus), A*B the ⊕-⊗ matrix product (MatTimes) — the same ops :transfer reads off semiring_ops<Mat(S)>, never native operators. The glyph derives from the Form, so it cannot skew the way a native + does on the tropical carrier (there + is ⊗); like SemimoduleVec's +/ these are sugar over the one defaulted seam. | |
| constexpr MatNxNV | operator* (const MatNxNV &a, const MatNxNV &b) |
Mat(S): the N×N matrix over a semiring S. Entries are stored row-major; ⊕ / ⊗ are S's semiring operations, read off dedekind::algebra::semiring_ops (never native operator+/ which the tropical carriers skew). *,
The semiring trait opt-ins (is_associative_v, is_commutative_v, is_idempotent_v) certify the two matrix monoids so that IsSemiring<MatNxNV<S,N>, MatPlus, MatTimes> holds. Idempotence of ⊕ is inherited from the base (a dioid S ⟹ a dioid Mat(S)), which is what makes the *-closure terminate.
| using dedekind::linear_algebra::MatNxNV< S, N >::Domain = Ket<S, N> |
Mat(S) is the linear operator \(|v\rangle \mapsto
M|v\rangle\) — a callable IsArrow with Domain = Codomain = Ket<S,N>.
The callable reading of the arrow chain IsLinearOperator ⟹ IsFunction ⟹ IsRelation ⟹ IsArrow (see dedekind::relational::IsRelation for the three-hats note): matrix-vector application is a total, single-valued map, so the matrix is a function is an arrow. The binary operator()(i,j) entry accessor and this unary operator()(Ket) apply differ in arity, so they do not collide.
|
inlineconstexpr |
Matrix-vector application \((M|v\rangle)_i = \bigoplus_j M_{ij}
\otimes v_j\) over S's semiring ops (never native +/ which the tropical carriers skew). The *,IsArrow call operator: Ket → Ket.
Takes the extensional (array-backed) Ket. Accepting an intensional (rule / function-backed) index→scalar vector too is a follow-up: the sound gate is that V is indexable at the finite index (an IsRingIntegral domain), and that concept is not in scope here without an awkward dedekind.order dependency — so it lands with the function-space image work, not on the bare Mat call operator.
|
inlineconstexpr |
Transpose \(M^{\top}\) — reflect across the main diagonal.
The dagger of this arrow, one operation across the three surfaces (see dedekind::category::IsDagger and dedekind::relational::converse):
𝔹) it is the converse \(R^{\circ}\) (relational::converse / SwapPred): \((M^{\top})_{ij}=M_{ji}\) is \(R^{\circ}(j,i)=R(i,j)\) — transpose of the Boolean matrix is the swap of the relation's coordinates; converse does ( \((R;S)^{\circ}=S^{\circ};R^{\circ}\)). Now that Mat(S) is a callable IsArrow, this transpose IS its † — so FIXME(#787): register inverse = transpose for the orthogonal / unitary case ( \(M^{\top}=M^{-1}\)), where "the converse is the
inverse" (bijective relation) and "the transpose is the inverse" (orthogonal matrix) are one theorem. :transfer's converse is this dagger's intensional (rule-level) twin; this transpose is its extensional (materialised) form.
|
staticconstexpr |
§4 property distribution: matrix ⊕ (MatPlus) is associative exactly when the base ⊕ is; matrix ⊗ (MatTimes) is associative exactly when S is a semiring (the ⊕/⊗ contraction's associativity needs S's associativity AND distributivity), so a non-semiring S no longer certifies IsSemiring<Mat(S)>.
|
staticconstexpr |
Only ⊕ (MatPlus) is commutative (⊗ is not), and only when the base ⊕ is.
|
staticconstexpr |
⊕ is idempotent exactly when the base ⊕ is (dioid lift).