[ANN] VectorizationTransformations.jl

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

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.

3 Likes

It seems the linear operators you are implementing in this package have a lot of internal structure that can be exploited. E.g. you are already exploiting sparsity, but probably you can do much better by making new types for each kind of matrix and then implement multiplication methods and other APIs for them.

Something like this maybe:

struct DuplicationMatrix
    dim::Int
end

function Base.:*(matrix::DuplicationMatrix, vec::AbstractVector)
...
end

I suspect that would provide orders of magnitude higher performance.

2 Likes

That is probably true! Although like I said optimized code that involves these operators is probably already not using them explicitly. I’m open to new ideas but not planning to dump a lot of additional time into the package unless there are issues with the current implementations. Also obviously open to PRs.