Registered Member
|
I'm new to Eigen and trying to port some existing python code to C++.
I have a matrix and want to keep only those row/columns where the diagonal term is larger than 0. I managed to get an array of bool with the positive diagonal positions, VectorXd Diag = M.diagonal(); Array<bool, Dynamic, 1> iPos = Array<bool, Dynamic, 1>(n); iPos = (Diag.array() > 0); However slicing seems not to be possible with an array of booleans, so I either need to convert to an array of int (but how?) or I need to do this differently alltogether. Any advice? |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell