Web Analytics Made
Easy - StatCounter

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

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,

matrix.block<p,q>(i,j);

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,

matrix.block(i,j,p,q);

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

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