Vectorization of matrices #
This file defines Matrix.vec A
, the vectorization of a matrix A
,
formed by stacking the columns of A into a single large column vector.
Since mathlib indices matrices by arbitrary types rather than Fin n
,
the result of Matrix.vec
on A : Matrix m n R
is indexed by n × m
.
The Fin (n * m)
interpretation can be restored by composing with finProdFinEquiv.symm
:
-- ![1, 2, 3, 4]
#eval vec !![1, 3; 2, 4] ∘ finProdFinEquiv.symm
While it may seem more natural to index by m × n
, keeping the indices in the same order,
this would amount to stacking the rows into one long row, and goes against the literature.
If you want this function, you can write Matrix.vec Aᵀ
instead.
References #
@[simp]
theorem
Matrix.kronecker_mulVec_vec_of_commute
{l : Type u_1}
{m : Type u_2}
{n : Type u_4}
{p : Type u_5}
{R : Type u_3}
[NonUnitalSemiring R]
[Fintype m]
[Fintype n]
(A : Matrix l m R)
(X : Matrix m n R)
(B : Matrix p n R)
(hB : ∀ (x : R) (i : p) (j : n), Commute x (B i j))
:
Technical lemma shared with kronecker_mulVec_vec
and vec_mul_eq_mulVec
.
theorem
Matrix.vec_vecMul_kronecker_of_commute
{l : Type u_2}
{m : Type u_1}
{n : Type u_4}
{p : Type u_5}
{R : Type u_3}
[NonUnitalSemiring R]
[Fintype m]
[Fintype n]
(A : Matrix m l R)
(X : Matrix m n R)
(B : Matrix n p R)
(hA : ∀ (x : R) (i : m) (j : l), Commute (A i j) x)
:
Technical lemma shared with vec_vecMul_kronecker
and vec_mul_eq_vecMul
.