Registered Member
|
I am currently porting some matlab code to C++ and trying to use the Eigen library. I have a lot of matrix-vector multiplications that need to work on sub-matrices. For example, in matlab one can have do referencing as an example as follows:
Here, I have a matrix U where I am selecting all the rows and 'n' columns where 'n' is only known during run-time. Is it possible to generate such a view into the data using Eigen efficiently? The line that I need to port is something like this in matlab:
Here U and V are matrices and diagS is a vector which gets turned into a diagonal matrix using the diag() function in matlab. |
Registered Member
|
I realised there was a non-templates version of the block method. I have not tested it yet but I could do something like:
|
Moderator
|
There are also convenient shortcuts, like U.leftCols(n). See them all there: http://eigen.tuxfamily.org/dox-devel/gr ... tions.html
|
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft