Registered Member
|
Hi everyone!
A few days ago I met a problem that seemed a bit strange. Pseudo codes: MatrixXd A = MatrixXd::Random(10, 10); // A matrix of size 10 x 10 auto blk = A.leftCols(2); // Now blk 'points' to the submatrix that contains the first two cols of A // here are some other works .... blk = A.leftCols(3); // ERROR! We know this line actually assigns the first three cols to the first two and hence runtime_error occurs. But in some rare cases I actually intend to 'rebind' blk to the first three cols rather than perform the assignments. Is there any method that can make blk 'points' to the first three cols of A and avoids change the the type of blk to MatrixXd? |
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]