Build a matrix from an entry function, filling the flat backing buffer.
11.2.Β The dense matrix type
This section is the definitions; the next section collects the theorems about them.
Hex.Matrix.ofFn builds a matrix from an entry function
Fin n β Fin m β R. Hex.Matrix.row and Hex.Matrix.col
return its rows and columns, and Hex.Matrix.transpose swaps them.
The i-th row of a matrix.
The j-th column of a matrix.
The transpose of a dense matrix.
The zero and identity matrices:
The all-zero matrix.
The identity matrix.
Matrix-vector and matrix-matrix multiplication are both written *.
Each product entry is a row-by-column dot product.
Dot product of two vectors.
This List.finRange form is the reference definition the entry lemmas reason
about; crucially it kernel-reduces, so #guard/decide checks over
dotProduct (e.g. memLattice membership) stay evaluable β core Fin.foldl
does not yet reduce in the kernel. Compiled code therefore uses the
allocation-free Vector.dotProductImpl, selected by
Vector.dotProduct_eq_impl, while logical evaluation retains the
list-based form.
Hex.Matrix.mulVec.{u} {R : Type u} {n m : β} [Mul R] [Add R] [OfNat R 0] (M : Hex.Matrix R n m) (v : Vector R m) : Vector R nHex.Matrix.mulVec.{u} {R : Type u} {n m : β} [Mul R] [Add R] [OfNat R 0] (M : Hex.Matrix R n m) (v : Vector R m) : Vector R n
Multiply a matrix by a column vector.
Hex.Matrix.mul.{u} {R : Type u} {n m k : β} [Mul R] [Add R] [OfNat R 0] (M : Hex.Matrix R n m) (N : Hex.Matrix R m k) : Hex.Matrix R n kHex.Matrix.mul.{u} {R : Type u} {n m k : β} [Mul R] [Add R] [OfNat R 0] (M : Hex.Matrix R n m) (N : Hex.Matrix R m k) : Hex.Matrix R n k
Multiply two matrices, using the naive algorithm.
This reads each column col N j and is the reference definition the entry
lemmas reason about. Compiled code uses the implementation below, which
transposes N once so each column is materialized a single time instead of
being rebuilt for every row of M; Hex.Matrix.mul_eq_impl selects
Hex.Matrix.mulImpl for compiled code.
Strassen-Winograd multiplication, with a customizable base kernel for small
sizes, is available as Hex.Matrix.mulStrassen, with equality proved by
Hex.Matrix.mulStrassen_eq_mul. It cannot replace this definition
through @[csimp]: the Winograd schedule subtracts blocks and therefore needs
[Sub R], while naive multiplication does not. Callers over a ring opt into
the Strassen-Winograd algorithm explicitly.
The Gram matrix of the rows and the leading principal submatrices used by the Bareiss recurrence:
Hex.Matrix.gramMatrix.{u_1} {R : Type u_1} {n m : β} [Mul R] [Add R] [OfNat R 0] (M : Hex.Matrix R n m) : Hex.Matrix R n nHex.Matrix.gramMatrix.{u_1} {R : Type u_1} {n m : β} [Mul R] [Add R] [OfNat R 0] (M : Hex.Matrix R n m) : Hex.Matrix R n n
Gram matrix of the rows of a dense matrix.
Hex.Matrix.principalSubmatrix.{u_1} {R : Type u_1} {n : β} (M : Hex.Matrix R n n) (k : β) (hk : k β€ n) : Hex.Matrix R k kHex.Matrix.principalSubmatrix.{u_1} {R : Type u_1} {n : β} (M : Hex.Matrix R n n) (k : β) (hk : k β€ n) : Hex.Matrix R k k
Leading principal k Γ k submatrix of a square matrix: the top-left block
indexed by {0, β¦, k-1} along both axes. Includes the empty submatrix
(k = 0) and is convenient for Bareiss pivot/minor statements.