12/27/2023 0 Comments Permute a matrixSome_function to return Matrix ĮDIT: dtell kindly answered my original question below.įor anyone else looking at this - if you want to permute a matrix with a vector of unknown (at compile time) quanties, you can do the following: Eigen::VectorXi indices(A. I'm wondering how I can initialize the matrix to a specific permutation.įor example, if I have a vector of integers where each (index, value) pair means I want to move column "index" to column "value" how can I do this? Eigen::MatrixXi M = Eigen::MatrixXi::Random(3,3) ![]() I read this answer Randomly permute rows/columns of a matrix with eigenīut they initialize the permutation matrix as the identity matrix and do a random shuffle. permute Rearrange the dimensions of a multidimensional array Syntax B permute (A,order) Description B permute (A,order) rearranges the dimensions of A so that they are in the order specified by the vector order.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |