I was working through a new econometric estimator and found that it made extensive usage of matrix vectorization operators like vech
and moving between vec
and vech
. I could not find implementations of them anywhere so I spent a morning coding them up and have split them off into a package for convenience: VectorizationsTransformations.jl
Specifically it implements
vech
Vectorization (mathematics) - Wikipediaduplication_matrix
andelimination_matrix
Duplication and elimination matrices - Wikipediacommutation_matrix
Commutation matrix - Wikipediasymmetrizer_matrix
The matrices are explicitly constructed and sparse. I think optimized routines probably avoid using these sorts of things altogether, but for the “math as code” strict implementations I found them quite useful.