Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
dedekind::linear_algebra::MatchesAdditiveShape Concept Referenceexport

Two matrix-like carriers can be added iff they share shape and scalar type. More...

Concept definition

template<typename A, typename B>
typename A::scalar_type;
typename B::scalar_type;
requires std::same_as<typename A::scalar_type, typename B::scalar_type>;
requires A::row_count == B::row_count;
requires A::column_count == B::column_count;
}
A matrix carries two dimensionalities: row count and column count.
Definition contracts.cppm:217
Two matrix-like carriers can be added iff they share shape and scalar type.
Definition contracts.cppm:494

Detailed Description

Two matrix-like carriers can be added iff they share shape and scalar type.

operations.

Matrix addition requires the two operands to share row count, column count, and scalar type. Matrix multiplication requires the inner dimensions to agree: an m × k matrix composed with a k × n matrix produces an m × n result. These predicates express the ideal type- checking rule: you cannot add or multiply two matrices whose shapes are incompatible — the expression should not even compile.

For the current Matrix2x2V<T> the rule is enforced structurally (the operators are signed with a fixed shape), but expressing it as a concept generalises cleanly to future MatrixMxN<T, M, N> carriers and lets the rule be asserted at use sites.