The Matrix::replicate(int) is very useful for writing compact formulas.
I am also using (through the plugin mechanism) a similar expression, called blockDiag(int):
Eigen::Matrix B = A.blockDiag(3);
produces the matrix exrpression:
[ A 0 0 ]
[ 0 A 0 ]
[ 0 0 A ]
The implementation is very similar to the replicate. This can be used eg. in the context of elasticity finite element matrices, if A are derivatives of scalar basis functions and the block diagonal expression provides derivatives of (3D) displacement vector.
Maybe a better name could be Matrix::diagonalReplicate(int). Posting it here just in case that it is of interest for other purposes as well.
This feature would be more powerful with a true concept of block-diagonal for which diagonalReplicate would only be a special case. Otherwise the special structure is lost.
Sure, that would be nice, then something like
std::vector<Eigen::Matrix<double> > mVec(3);
[ A 0 0 ]
[ 0 B 0 ]
[ 0 0 C ]
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1352.