|
C(++)ECCO
C++ Error Control COding: a header-only library for ECC simulations and experiments, modeling complete coding systems across arbitrary finite fields and complex inter-field relationships - Christian Senger <senger@inue.uni-stuttgart.de>
|
Dense m × n matrix over a CECCO::ComponentType. More...
#include <matrices.hpp>

Public Member Functions | |
| template<FiniteFieldType S> | |
| constexpr Matrix< T > & | operator= (const Matrix< S > &other) |
| template<typename U> requires std::convertible_to<std::decay_t<U>, T> | |
| Matrix< T > & | set_component (size_t i, size_t j, U &&c) |
Constructors | |
| constexpr | Matrix () noexcept=default |
| Default constructor: empty matrix. | |
| constexpr | Matrix (size_t m, size_t n) |
| m × n zero matrix (tag details::Zero) | |
| Matrix (size_t m, size_t n, const T &l) | |
| m × n matrix with every component equal to l | |
| constexpr | Matrix (size_t m, size_t n, std::initializer_list< T > l) |
| m × n matrix from a flat initializer list (row-major) | |
| Matrix (std::initializer_list< std::initializer_list< T > > l) | |
| From nested initializer lists, e.g. {{1, 2, 3}, {4, 5, 6}}. | |
| Matrix (const Vector< T > &v) | |
| 1 × n row matrix from a Vector<T> | |
| constexpr | Matrix (const Matrix &other) |
| constexpr | Matrix (Matrix &&other) noexcept |
| template<FiniteFieldType S> requires FiniteFieldType<T> && (T::get_characteristic() == S::get_characteristic()) | |
| constexpr | Matrix (const Matrix< S > &other) |
| Cross-field conversion between two finite fields of the same characteristic. | |
| Matrix (const std::string &filename) | |
| Read from a PPM (P3) image file using the 64-entry colormap of export_as_ppm. | |
Assignment Operators | |
| constexpr Matrix & | operator= (const Matrix &rhs) |
| constexpr Matrix & | operator= (Matrix &&rhs) noexcept |
| template<FiniteFieldType S> | |
| constexpr Matrix & | operator= (const Matrix< S > &other) |
| Cross-field assignment (same semantics as the cross-field constructor). | |
Unary Arithmetic Operations | |
| constexpr Matrix | operator+ () const & |
| Unary + (lvalue): returns a copy. | |
| constexpr Matrix | operator+ () &&noexcept |
| Unary + (rvalue): returns the rvalue itself. | |
| constexpr Matrix | operator- () const & |
| Unary − (lvalue): returns a new matrix with each component negated. | |
| constexpr Matrix | operator- () && |
| Unary − (rvalue): negates components in place. | |
Compound Assignment Operations | |
| Matrix & | operator+= (const Matrix &rhs) |
| Component-wise addition this(i, j) += rhs(i, j). | |
| Matrix & | operator-= (const Matrix &rhs) |
| Component-wise subtraction this(i, j) -= rhs(i, j). | |
| Matrix & | operator*= (const Matrix &rhs) |
| Matrix multiplication *this = *this · rhs. | |
| constexpr Matrix & | operator*= (const T &s) |
| Multiply every component by the scalar s. | |
| Matrix & | operator/= (const T &s) |
| Divide every component by the scalar s. | |
Randomization | |
| Matrix & | randomize () |
| Fill matrix with random values. | |
Information and Properties | |
| constexpr size_t | get_m () const noexcept |
| Get the number of rows. | |
| constexpr size_t | get_n () const noexcept |
| Get the number of columns. | |
| constexpr bool | is_empty () const noexcept |
| Check if matrix is empty. | |
| constexpr bool | is_zero () |
| Check if the matrix is zero, caching the result via the type tag. | |
| constexpr bool | is_zero () const |
| Check if the matrix is zero (no caching). | |
| size_t | wH () const |
| Hamming weight: number of non-zero, non-erased components; cached on first call. | |
| size_t | rank () const |
| Matrix rank, computed once and cached. | |
| bool | is_invertible () const |
| Check if matrix is invertible. | |
| Vector< T > | diagonal () const |
| Main diagonal as a vector. | |
| Polynomial< T > | characteristic_polynomial () const |
| Characteristic polynomial det(λI − A). | |
| Matrix< T > | basis_of_nullspace () const |
| Basis of the nullspace (right kernel). | |
| Matrix< T > | basis_of_kernel () const |
| Alias for basis_of_nullspace. | |
| T | determinant () const |
| Matrix determinant. | |
| std::vector< T > | eigenvalues () const |
| Eigenvalues lying in the underlying finite field. | |
| std::vector< Vector< T > > | rowspace () const |
| Enumerate every vector in the row space. | |
| std::vector< Vector< T > > | span () const |
| Alias for rowspace. | |
Component Access and Manipulation | |
| template<typename U> requires std::convertible_to<std::decay_t<U>, T> | |
| Matrix & | set_component (size_t i, size_t j, U &&c) |
| Set component (i, j) by perfect forwarding. | |
| const T & | operator() (size_t i, size_t j) const |
| Access component (i, j) (read-only). | |
| Vector< T > | get_row (size_t i) const |
| Extract row i as a vector. | |
| Vector< T > | get_col (size_t j) const |
| Extract column j as a (row) vector. | |
| Matrix< T > | get_submatrix (size_t i, size_t j, size_t h, size_t w) const |
| Extract submatrix from region [i, i+h) × [j, j+w). | |
| Matrix< T > & | set_submatrix (size_t i, size_t j, const Matrix &N) |
| Overwrite the region starting at (i, j) with N. | |
| Matrix< T > & | horizontal_join (const Matrix &other) |
| Concatenate other to the right (column-wise). | |
| Matrix< T > & | vertical_join (const Matrix &other) |
| Concatenate other below (row-wise). | |
| Matrix< T > & | diagonal_join (const Matrix &other) |
| Block-diagonal join: this in the upper-left, other in the lower-right. | |
| Matrix< T > & | Kronecker_product (const Matrix &other) |
| Kronecker (tensor) product with other. | |
| Matrix< T > & | swap_rows (size_t i, size_t j) |
| Swap rows i and j. | |
| Matrix< T > & | swap_columns (size_t i, size_t j) |
| Swap columns i and j. | |
| Matrix< T > & | scale_row (const T &s, size_t i) |
| row[i] ← s · row[i] | |
| Matrix< T > & | scale_column (const T &s, size_t i) |
| col[i] ← s · col[i] | |
| Matrix< T > & | add_scaled_row (const T &s, size_t i, size_t j) |
| row[j] ← row[j] + s · row[i] | |
| Matrix< T > & | add_scaled_column (const T &s, size_t i, size_t j) |
| col[j] ← col[j] + s · col[i] | |
| Matrix< T > & | add_row (size_t i, size_t j) |
| row[j] ← row[j] + row[i] | |
| Matrix< T > & | add_column (size_t i, size_t j) |
| col[j] ← col[j] + col[i] | |
| Matrix< T > & | delete_columns (const std::vector< size_t > &v) |
| Delete the columns whose indices appear in v. | |
| Matrix< T > & | delete_column (size_t i) |
| Delete column i (single-index convenience for delete_columns). | |
| Matrix< T > & | delete_rows (const std::vector< size_t > &v) |
| Delete the rows whose indices appear in v. | |
| Matrix< T > & | delete_row (size_t i) |
| Delete row i (single-index convenience for delete_rows). | |
| Matrix< T > & | erase_component (size_t i, size_t j) |
| Flag component (i, j) as erased. | |
| Matrix< T > & | unerase_component (size_t i, size_t j) |
| Clear the erasure flag on component (i, j). | |
| Matrix< T > & | erase_columns (const std::vector< size_t > &v) |
| Flag every component of the specified columns as erased. | |
| Matrix< T > & | erase_column (size_t i) |
| Erase column i (single-index convenience for erase_columns). | |
| Matrix< T > & | unerase_columns (const std::vector< size_t > &v) |
| Clear erasure flags on every component of the specified columns. | |
| Matrix< T > & | unerase_column (size_t i) |
| Un-erase column i (single-index convenience for unerase_columns). | |
| Matrix & | erase_rows (const std::vector< size_t > &v) |
| Flag every component of the specified rows as erased. | |
| Matrix & | erase_row (size_t i) |
| Erase row i (single-index convenience for erase_rows). | |
| Matrix & | unerase_rows (const std::vector< size_t > &v) |
| Clear erasure flags on every component of the specified rows. | |
| Matrix & | unerase_row (size_t i) |
| Un-erase row i (single-index convenience for unerase_rows). | |
Transformations | |
| Matrix< T > & | reverse_rows () |
| Reverse the row order. | |
| Matrix< T > & | reverse_columns () |
| Reverse the column order. | |
| constexpr Matrix< T > & | fill (const T &s) |
| Set every component to s. | |
| constexpr Matrix< T > & | transpose () |
| Transpose in place. | |
| Matrix< T > & | ref (size_t *rank=nullptr) |
| Row echelon form (REF), with a binary-field fast path. | |
| Matrix< T > & | rref (size_t *rank=nullptr) |
| Reduced row echelon form (RREF). | |
| Matrix< T > & | invert () |
| Invert in place. | |
Finite Field Specific Operations | |
| template<FiniteFieldType S> requires FiniteFieldType<T> && ExtensionOf<T, S> && (!std::is_same_v<T, S>) | |
| constexpr Vector< S > | as_vector () const |
| Reinterpret the columns as elements of a superfield. | |
| Vector< T > | to_vector () const |
| Flatten in row-major order. | |
| void | export_as_ppm (const std::string &filename) const |
| Export the matrix as a PPM (P3) image. | |
Friends | |
| template<ComponentType> | |
| class | Matrix |
| constexpr Matrix< T > | IdentityMatrix (size_t m) |
| m × m identity matrix I_m (tag details::Identity) | |
| constexpr Matrix< T > | DiagonalMatrix (const Vector< T > &v) |
| Diagonal matrix with diagonal v (tag details::Diagonal). | |
| constexpr Matrix< T > | ToeplitzMatrix (const Vector< T > &v, size_t m, size_t n) |
| m × n Toeplitz matrix from its diagonal entries (tag details::Toeplitz) | |
| constexpr Matrix< T > | VandermondeMatrix (const Vector< T > &v, size_t m) |
| Vandermonde matrix V_{i, j} = v[j]^i (tag details::Vandermonde). | |
| template<ReliablyComparableType U> | |
| constexpr bool | operator== (const Matrix< U > &lhs, const Matrix< U > &rhs) |
| std::ostream & | operator<< (std::ostream &os, const Matrix &rhs) |
| Pretty-print the matrix with column alignment and bracket borders. | |
Dense m × n matrix over a CECCO::ComponentType.
| T | Component type satisfying CECCO::ComponentType (finite field, double, std::complex<double>, or signed integer including InfInt) |
Components are stored row-major in a contiguous buffer. A structural tag (details::matrix_type_t) tracks Zero / Identity / Diagonal / Vandermonde / Toeplitz structures and dispatches to specialised fast paths; mutating operations that break a tracked structure demote the tag to Generic and structure is not re-detected. Dimension mismatches in arithmetic throw std::invalid_argument.
Methods that need division (REF/RREF, inversion, nullspace, determinant, characteristic polynomial, …) are gated by requires FieldType<T>; eigenvalue computation by requires FiniteFieldType<T>. Methods that compare against zero (Hamming weight, rank, structural tests, …) are gated by requires ReliablyComparableType<T>.
Cross-field constructors and assignment operators between two finite fields of the same characteristic route through CECCO::details::largest_common_subfield_t, so matrices over fields from disjoint construction towers can interoperate.
Definition at line 174 of file matrices.hpp.
|
constexprdefaultnoexcept |
Default constructor: empty matrix.
|
inlineconstexpr |
m × n zero matrix (tag details::Zero)
Definition at line 194 of file matrices.hpp.
| CECCO::Matrix< T >::Matrix | ( | size_t | m, |
| size_t | n, | ||
| const T & | l ) |
m × n matrix with every component equal to l
Tag is details::Zero if l == T(0), otherwise details::Generic.
Definition at line 1227 of file matrices.hpp.


|
constexpr |
m × n matrix from a flat initializer list (row-major)
| std::invalid_argument | if l.size() != m * n |
Definition at line 1237 of file matrices.hpp.


| CECCO::Matrix< T >::Matrix | ( | std::initializer_list< std::initializer_list< T > > | l | ) |
From nested initializer lists, e.g. {{1, 2, 3}, {4, 5, 6}}.
Rows of unequal length are zero-padded to the longest row.
Definition at line 1246 of file matrices.hpp.
| CECCO::Matrix< T >::Matrix | ( | const Vector< T > & | v | ) |
1 × n row matrix from a Vector<T>
Definition at line 1263 of file matrices.hpp.
|
inlineconstexpr |
Definition at line 220 of file matrices.hpp.


|
inlineconstexprnoexcept |
Definition at line 228 of file matrices.hpp.


|
constexpr |
Cross-field conversion between two finite fields of the same characteristic.
| S | Source field type (Matrix<S>); must share characteristic with T |
Converts component by component via T's cross-field constructor, which routes through CECCO::details::largest_common_subfield_t and so handles disjoint construction towers. Propagates std::invalid_argument if any component is not representable in T.
Definition at line 1271 of file matrices.hpp.
| CECCO::Matrix< T >::Matrix | ( | const std::string & | filename | ) |
Read from a PPM (P3) image file using the 64-entry colormap of export_as_ppm.
Pixels whose RGB does not match any colormap entry are erased (under CECCO_ERASURE_SUPPORT) or replaced by a random field element.
Definition at line 1290 of file matrices.hpp.
|
inline |
col[j] ← col[j] + col[i]
| i | Source column index |
| j | Destination column index |
| std::invalid_argument | if either index is out of bounds |
Definition at line 730 of file matrices.hpp.

|
inline |
row[j] ← row[j] + row[i]
| i | Source row index |
| j | Destination row index |
| std::invalid_argument | if either index is out of bounds |
Definition at line 715 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::add_scaled_column | ( | const T & | s, |
| size_t | i, | ||
| size_t | j ) |
col[j] ← col[j] + s · col[i]
| s | Scalar multiplier on the source column |
| i | Source column index |
| j | Destination column index |
| std::invalid_argument | if either index is out of bounds |
Definition at line 2130 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::add_scaled_row | ( | const T & | s, |
| size_t | i, | ||
| size_t | j ) |
row[j] ← row[j] + s · row[i]
| s | Scalar multiplier on the source row |
| i | Source row index |
| j | Destination row index |
| std::invalid_argument | if either index is out of bounds |
Definition at line 2106 of file matrices.hpp.
|
constexpr |
Reinterpret the columns as elements of a superfield.
| S | Superfield of T (same construction tower) |
Each column is read as the coordinate representation of an element of S over T.
Definition at line 2553 of file matrices.hpp.
|
inline |
Alias for basis_of_nullspace.
Definition at line 470 of file matrices.hpp.
| Matrix< T > CECCO::Matrix< T >::basis_of_nullspace | ( | ) | const |
Basis of the nullspace (right kernel).
Computed by row reduction.
Definition at line 1693 of file matrices.hpp.
| Polynomial< T > CECCO::Matrix< T >::characteristic_polynomial | ( | ) | const |
Characteristic polynomial det(λI − A).
Computed via the Samuelson–Berkowitz algorithm in the general case; the details::Diagonal and details::Vandermonde tags trigger closed-form shortcuts.
| std::invalid_argument | if the matrix is not square or is empty |
Definition at line 1618 of file matrices.hpp.
|
inline |
Delete column i (single-index convenience for delete_columns).
| i | Column index |
| std::invalid_argument | if i is out of bounds |
Definition at line 757 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::delete_columns | ( | const std::vector< size_t > & | v | ) |
Delete the columns whose indices appear in v.
| v | Column indices (deduplicated internally) |
| std::invalid_argument | if any index in v is out of bounds |
Definition at line 2138 of file matrices.hpp.
|
inline |
Delete row i (single-index convenience for delete_rows).
| i | Row index |
| std::invalid_argument | if i is out of bounds |
Definition at line 777 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::delete_rows | ( | const std::vector< size_t > & | v | ) |
Delete the rows whose indices appear in v.
| v | Row indices (deduplicated internally) |
| std::invalid_argument | if any index in v is out of bounds |
Definition at line 2160 of file matrices.hpp.
| T CECCO::Matrix< T >::determinant | ( | ) | const |
Matrix determinant.
Algorithm depends on the type tag: closed-form for details::Identity, details::Zero, and details::Diagonal; Samuelson–Berkowitz otherwise.
| std::invalid_argument | if the matrix is not square or is empty |
Definition at line 1746 of file matrices.hpp.
| Vector< T > CECCO::Matrix< T >::diagonal | ( | ) | const |
Main diagonal as a vector.
| std::invalid_argument | if the matrix is not square |
Definition at line 1610 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::diagonal_join | ( | const Matrix< T > & | other | ) |
Block-diagonal join: this in the upper-left, other in the lower-right.
| other | Matrix placed in the lower-right block |
Off-diagonal blocks are filled with zeros.
Definition at line 1994 of file matrices.hpp.
| std::vector< T > CECCO::Matrix< T >::eigenvalues | ( | ) | const |
Eigenvalues lying in the underlying finite field.
Eigenvalues that exist only in an extension of T are omitted.
| std::invalid_argument | if the matrix is not square |
Definition at line 1777 of file matrices.hpp.
|
inline |
Erase column i (single-index convenience for erase_columns).
| i | Column index |
| std::invalid_argument | if i is out of bounds |
Definition at line 832 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::erase_columns | ( | const std::vector< size_t > & | v | ) |
Flag every component of the specified columns as erased.
| v | Column indices (deduplicated internally) |
| std::invalid_argument | if any index in v is out of bounds |
Definition at line 2216 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::erase_component | ( | size_t | i, |
| size_t | j ) |
Flag component (i, j) as erased.
| i | Row index |
| j | Column index |
Marks the component as erased; field arithmetic on erased elements is undefined — see CECCO_ERASURE_SUPPORT and the erase()/unerase() interface in fields.hpp.
| std::invalid_argument | if (i, j) is out of bounds |
Definition at line 2184 of file matrices.hpp.
|
inline |
Erase row i (single-index convenience for erase_rows).
| i | Row index |
| std::invalid_argument | if i is out of bounds |
Definition at line 884 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::erase_rows | ( | const std::vector< size_t > & | v | ) |
Flag every component of the specified rows as erased.
| v | Row indices (deduplicated internally) |
| std::invalid_argument | if any index in v is out of bounds |
Definition at line 2238 of file matrices.hpp.
| void CECCO::Matrix< T >::export_as_ppm | ( | const std::string & | filename | ) | const |
Export the matrix as a PPM (P3) image.
| filename | Output path |
Each component is mapped through a built-in 64-entry colormap (black → blue → green → yellow → white). The image is n wide and m tall.
Definition at line 2588 of file matrices.hpp.
|
constexpr |
Set every component to s.
| s | Value assigned to every component |
Definition at line 2347 of file matrices.hpp.
| Vector< T > CECCO::Matrix< T >::get_col | ( | size_t | j | ) | const |
Extract column j as a (row) vector.
| j | Column index |
| std::invalid_argument | if j is out of bounds |
Definition at line 1890 of file matrices.hpp.
|
inlineconstexprnoexcept |
Get the number of rows.
Definition at line 363 of file matrices.hpp.
|
inlineconstexprnoexcept |
Get the number of columns.
Definition at line 370 of file matrices.hpp.
| Vector< T > CECCO::Matrix< T >::get_row | ( | size_t | i | ) | const |
Extract row i as a vector.
| i | Row index |
| std::invalid_argument | if i is out of bounds |
Definition at line 1878 of file matrices.hpp.
| Matrix< T > CECCO::Matrix< T >::get_submatrix | ( | size_t | i, |
| size_t | j, | ||
| size_t | h, | ||
| size_t | w ) const |
Extract submatrix from region [i, i+h) × [j, j+w).
| i | Starting row index |
| j | Starting column index |
| h | Height (number of rows) |
| w | Width (number of columns) |
| std::invalid_argument | if the region extends beyond the matrix |
Definition at line 1902 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::horizontal_join | ( | const Matrix< T > & | other | ) |
Concatenate other to the right (column-wise).
| other | Matrix to append on the right; must have the same number of rows as this |
| std::invalid_argument | if row counts differ |
Definition at line 1960 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::invert | ( | ) |
Invert in place.
Gaussian elimination with partial pivoting. Requires a square non-singular matrix.
| std::invalid_argument | if the matrix is not square or is singular |
Definition at line 2508 of file matrices.hpp.
|
inlineconstexprnoexcept |
Check if matrix is empty.
Definition at line 377 of file matrices.hpp.
|
inline |
Check if matrix is invertible.
Definition at line 427 of file matrices.hpp.
|
inlineconstexpr |
Check if the matrix is zero, caching the result via the type tag.
On a positive result the tag is updated to details::Zero, so subsequent calls and other tag-aware fast paths short-circuit.
Definition at line 387 of file matrices.hpp.
|
inlineconstexpr |
Check if the matrix is zero (no caching).
Definition at line 399 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::Kronecker_product | ( | const Matrix< T > & | other | ) |
Kronecker (tensor) product with other.
| other | Right operand |
If this is m × n and other is p × q, the result is mp × nq.
Definition at line 2013 of file matrices.hpp.
| const T & CECCO::Matrix< T >::operator() | ( | size_t | i, |
| size_t | j ) const |
Access component (i, j) (read-only).
| i | Row index (0-based) |
| j | Column index (0-based) |
| std::invalid_argument | if either index is out of bounds |
Definition at line 1871 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::operator*= | ( | const Matrix< T > & | rhs | ) |
Matrix multiplication *this = *this · rhs.
| std::invalid_argument | if this->get_n() != rhs.get_m() |
Definition at line 1483 of file matrices.hpp.

|
constexpr |
Multiply every component by the scalar s.
Definition at line 1542 of file matrices.hpp.
|
inlineconstexprnoexcept |
Unary + (rvalue): returns the rvalue itself.
Definition at line 286 of file matrices.hpp.
|
inlineconstexpr |
Unary + (lvalue): returns a copy.
Definition at line 284 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::operator+= | ( | const Matrix< T > & | rhs | ) |
Component-wise addition this(i, j) += rhs(i, j).
| std::invalid_argument | if dimensions differ |
Definition at line 1439 of file matrices.hpp.

|
constexpr |
Unary − (rvalue): negates components in place.
Definition at line 1417 of file matrices.hpp.
|
constexpr |
Unary − (lvalue): returns a new matrix with each component negated.
Definition at line 1395 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::operator-= | ( | const Matrix< T > & | rhs | ) |
Component-wise subtraction this(i, j) -= rhs(i, j).
| std::invalid_argument | if dimensions differ |
Definition at line 1472 of file matrices.hpp.

| Matrix< T > & CECCO::Matrix< T >::operator/= | ( | const T & | s | ) |
Divide every component by the scalar s.
| std::invalid_argument | if s == T(0) |
Definition at line 1558 of file matrices.hpp.

|
constexpr |
Definition at line 1357 of file matrices.hpp.
|
constexpr |
Definition at line 1382 of file matrices.hpp.
|
constexpr |
Cross-field assignment (same semantics as the cross-field constructor).
|
constexprnoexcept |
Definition at line 1369 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::randomize | ( | ) |
Fill matrix with random values.
Distribution depends on the component type: finite-field types draw uniformly from the field; signed integers from [−100, 100]; double and the real/imaginary parts of std::complex<double> from [−1.0, 1.0].
Definition at line 1565 of file matrices.hpp.
| size_t CECCO::Matrix< T >::rank | ( | ) | const |
Matrix rank, computed once and cached.
Uses row reduction to echelon form. Subsequent calls return the cached value until a mutating operation invalidates it.
Definition at line 1603 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::ref | ( | size_t * | rank = nullptr | ) |
Row echelon form (REF), with a binary-field fast path.
| rank | Optional out-parameter; if non-null, receives the rank |
Forward Gaussian elimination only — cheaper than RREF when only the rank or a triangularised form is needed. For Fp<2>, pivot scaling is skipped at compile time. Rank is cached when rank is non-null.
Definition at line 2376 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::reverse_columns | ( | ) |
Reverse the column order.
Definition at line 2324 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::reverse_rows | ( | ) |
Reverse the row order.
Definition at line 2302 of file matrices.hpp.
| std::vector< Vector< T > > CECCO::Matrix< T >::rowspace | ( | ) | const |
Enumerate every vector in the row space.
Definition at line 1790 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::rref | ( | size_t * | rank = nullptr | ) |
Reduced row echelon form (RREF).
| rank | Optional out-parameter; if non-null, receives the rank |
Two phases: forward elimination (REF) followed by backward elimination. Rank is always cached.
Definition at line 2425 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::scale_column | ( | const T & | s, |
| size_t | i ) |
col[i] ← s · col[i]
| s | Scalar multiplier |
| i | Column index |
| std::invalid_argument | if i is out of bounds |
Definition at line 2098 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::scale_row | ( | const T & | s, |
| size_t | i ) |
row[i] ← s · row[i]
| s | Scalar multiplier |
| i | Row index |
| std::invalid_argument | if i is out of bounds |
Definition at line 2075 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::set_component | ( | size_t | i, |
| size_t | j, | ||
| U && | c ) |
Definition at line 1818 of file matrices.hpp.
| Matrix & CECCO::Matrix< T >::set_component | ( | size_t | i, |
| size_t | j, | ||
| U && | c ) |
Set component (i, j) by perfect forwarding.
| i | Row index (0-based) |
| j | Column index (0-based) |
| c | Value to assign; bound by lvalue or rvalue reference |
| std::invalid_argument | if either index is out of bounds |
| Matrix< T > & CECCO::Matrix< T >::set_submatrix | ( | size_t | i, |
| size_t | j, | ||
| const Matrix< T > & | N ) |
Overwrite the region starting at (i, j) with N.
| i | Starting row index |
| j | Starting column index |
| N | Source matrix; its shape must fit within this matrix from (i, j) |
| std::invalid_argument | if the region would extend beyond bounds |
Definition at line 1941 of file matrices.hpp.
|
inline |
Alias for rowspace.
Definition at line 516 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::swap_columns | ( | size_t | i, |
| size_t | j ) |
Swap columns i and j.
| i | First column index |
| j | Second column index |
| std::invalid_argument | if either index is out of bounds |
Definition at line 2067 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::swap_rows | ( | size_t | i, |
| size_t | j ) |
Swap rows i and j.
| i | First row index |
| j | Second row index |
| std::invalid_argument | if either index is out of bounds |
Definition at line 2046 of file matrices.hpp.
| Vector< T > CECCO::Matrix< T >::to_vector | ( | ) | const |
Flatten in row-major order.
Definition at line 2571 of file matrices.hpp.
|
constexpr |
Transpose in place.
For an m × n matrix the result is n × m, with component (i, j) moved to (j, i).
Definition at line 2362 of file matrices.hpp.

|
inline |
Un-erase column i (single-index convenience for unerase_columns).
| i | Column index |
| std::invalid_argument | if i is out of bounds |
Definition at line 857 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::unerase_columns | ( | const std::vector< size_t > & | v | ) |
Clear erasure flags on every component of the specified columns.
| v | Column indices (deduplicated internally) |
| std::invalid_argument | if any index in v is out of bounds |
Definition at line 2260 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::unerase_component | ( | size_t | i, |
| size_t | j ) |
Clear the erasure flag on component (i, j).
| i | Row index |
| j | Column index |
| std::invalid_argument | if (i, j) is out of bounds |
Definition at line 2200 of file matrices.hpp.
|
inline |
Un-erase row i (single-index convenience for unerase_rows).
| i | Row index |
| std::invalid_argument | if i is out of bounds |
Definition at line 909 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::unerase_rows | ( | const std::vector< size_t > & | v | ) |
Clear erasure flags on every component of the specified rows.
| v | Row indices (deduplicated internally) |
| std::invalid_argument | if any index in v is out of bounds |
Definition at line 2280 of file matrices.hpp.
| Matrix< T > & CECCO::Matrix< T >::vertical_join | ( | const Matrix< T > & | other | ) |
Concatenate other below (row-wise).
| other | Matrix to append below; must have the same number of columns as this |
| std::invalid_argument | if column counts differ |
Definition at line 1977 of file matrices.hpp.
|
inline |
Hamming weight: number of non-zero, non-erased components; cached on first call.
Definition at line 405 of file matrices.hpp.
Diagonal matrix with diagonal v (tag details::Diagonal).
| v | Vector of diagonal entries; the result is v.length() × v.length() |
Definition at line 3511 of file matrices.hpp.
|
friend |
m × m identity matrix I_m (tag details::Identity)
| m | Side length |
Definition at line 3455 of file matrices.hpp.
|
friend |
Definition at line 183 of file matrices.hpp.
|
friend |
Pretty-print the matrix with column alignment and bracket borders.
os for chainingAn empty matrix is printed as "(empty matrix)".
Definition at line 3388 of file matrices.hpp.
|
friend |
|
friend |
m × n Toeplitz matrix from its diagonal entries (tag details::Toeplitz)
| v | Diagonal values, ordered so that v[i − j + n − 1] sits on entry (i, j); length m + n − 1 |
| m | Number of rows |
| n | Number of columns |
| std::invalid_argument | if v.length() != m + n - 1 |
Definition at line 3530 of file matrices.hpp.
Vandermonde matrix V_{i, j} = v[j]^i (tag details::Vandermonde).
| v | Evaluation points; must be pairwise distinct |
| m | Number of rows (i.e. the highest power is m − 1) |
| std::invalid_argument | if v is empty, has duplicates, or m is zero |
Definition at line 3577 of file matrices.hpp.