Generalize replicate(.) to block diagonal replication
Submitted by Angelos Mantzaflaris
Assigned to Nobody
Link to original bugzilla bug (#1352)
Version: 3.3 (current stable)
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.