简体   繁体   中英

Eigen Reorder Rows without Copy

How can you reorder the rows (or columns) of an Eigen matrix without copying them? You can use Eigen::Map to reshape them without copying the data, so I'm assuming there is some way to change the ordering as well, but there does not seem to be an example in the documentation.

You can multiply your matrix by a PermutationMatrix , or by a Transpositions matrix . If you multiply P * A , then the rows of A are permuted according to the indexes in P . The product itself is lazy, ie, it is only evaluated when needed (however, there are no strong guarantees when temporaries are constructed, when evaluating more complex expressions).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM