Extracting submatrices in Eigen (C++), dynamic version.

c-plus-plus eigen matrix-operations

In a previous post, I mentioned Eigen’s block function, which allows you to extract submatrices. But, in that post I was only aware and only wrote about the fixed-size version,


which returns a block of size (p,q), starting at (i,j) Eigen docs, Block operations. Using the fixed-size version, p and q cannot be variables, instead they have to be constants.

There is a dynamic version,


which allows for the case when the size(s) of the block are variables.

© Amy Tabb 2018 - 2023. All rights reserved. The contents of this site reflect my personal perspectives and not those of any other entity.