Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
dedekind::linear_algebra::MatNxNV< S, N > Struct Template Referenceexport

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...

Collaboration diagram for dedekind::linear_algebra::MatNxNV< S, N >:

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)

Detailed Description

template<typename S, std::size_t N>
struct dedekind::linear_algebra::MatNxNV< S, N >

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.

Member Typedef Documentation

◆ Domain

template<typename S, std::size_t N>
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.

Member Function Documentation

◆ operator()()

template<typename S, std::size_t N>
Ket< S, N > dedekind::linear_algebra::MatNxNV< S, N >::operator() ( const Ket< S, N > & v) const
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.

◆ transpose()

template<typename S, std::size_t N>
MatNxNV dedekind::linear_algebra::MatNxNV< S, N >::transpose ( ) const
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):

  • on a relation (over 𝔹) 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;
  • on a real space it is the transpose \(M^{\top}\) (here);
  • on a complex/Hilbert space the adjoint \(M^{*}\) (conjugate-transpose). It reverses every arrow (contravariant: \((AB)^{\top}=B^{\top}A^{\top}\)), exactly as 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.

Member Data Documentation

◆ is_associative_v

template<typename S, std::size_t N>
template<typename Op>
bool dedekind::linear_algebra::MatNxNV< S, N >::is_associative_v
staticconstexpr
Initial value:
=
(std::same_as<Op, MatPlus<S, N>> &&
typename dedekind::algebra::semiring_ops<S>::add{})) ||
(std::same_as<Op, MatTimes<S, N>> &&
S, typename dedekind::algebra::semiring_ops<S>::add,
typename dedekind::algebra::semiring_ops<S>::mult>)
Alias for IsRig: a general multi-operation species.
Definition total.cppm:780
constexpr bool associative(Op)
The laws as functions of the operation: associative<T>(Op{}), commutative<T>(Op{}),...
Definition species.cppm:384

§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)>.

◆ is_commutative_v

template<typename S, std::size_t N>
template<typename Op>
bool dedekind::linear_algebra::MatNxNV< S, N >::is_commutative_v
staticconstexpr
Initial value:
=
std::same_as<Op, MatPlus<S, N>> &&
dedekind::category::commutative<S>(
typename dedekind::algebra::semiring_ops<S>::add{})

Only ⊕ (MatPlus) is commutative (⊗ is not), and only when the base ⊕ is.

◆ is_idempotent_v

template<typename S, std::size_t N>
template<typename Op>
bool dedekind::linear_algebra::MatNxNV< S, N >::is_idempotent_v
staticconstexpr
Initial value:
=
std::same_as<Op, MatPlus<S, N>> &&
dedekind::category::idempotent<S>(
typename dedekind::algebra::semiring_ops<S>::add{})

⊕ is idempotent exactly when the base ⊕ is (dioid lift).


The documentation for this struct was generated from the following file: