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 #
Technical lemma shared with kronecker_mulVec_vec and vec_mul_eq_mulVec.
Technical lemma shared with vec_vecMul_kronecker and vec_mul_eq_vecMul.
The Hadamard bilinear form equals the Kronecker bilinear form on diagonal embeddings.
The starred Hadamard bilinear form equals the starred Kronecker bilinear form on diagonal embeddings.