This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1352 - Generalize replicate(.) to block diagonal replication
Generalize replicate(.) to block diagonal replication
 Status: NEW None Eigen Unclassified Core - expression templates (show other bugs) 3.3 (current stable) All All Normal Feature Request Nobody

 Reported: 2016-11-30 10:22 UTC by Angelos Mantzaflaris 2019-12-04 16:33 UTC (History) 3 users (show) chtz gael.guennebaud jacob.benoit.1

Attachments

 Angelos Mantzaflaris 2016-11-30 10:22:31 UTC ```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 A; 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.``` Gael Guennebaud 2016-11-30 17:04:00 UTC `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.` Angelos Mantzaflaris 2016-11-30 17:56:18 UTC ```Sure, that would be nice, then something like std::vector > mVec(3); Eigen::BlockDiagonal M(mVec); or Eigen::BlockDiagonal M; M.append(A); M.append(B); M.append(C); to get [ A 0 0 ] [ 0 B 0 ] [ 0 0 C ] so that Eigen::BlockDiagonal M(A,3); yields diagonalReplicate.``` Nobody 2019-12-04 16:33:04 UTC ```-- 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.```

 Note You need to log in before you can comment on or make changes to this bug.