New code should use the permutation method of a defaultrng () instance instead please see the Quick Start. Some_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. If x is a multi-dimensional array, it is only shuffled along its first index. 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) ![]() Parameters input ( Tensor) the input tensor. ![]() ![]() Next: Write a NumPy program to split an array of 14 elements into 3 arrays, each of which has. This function permutes rows and columns of a matrix using the specified permutation vector. torch.permute(input, dims) Tensor Returns a view of the original tensor input with its dimensions permuted. 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. Previous: Write a NumPy program to convert 1-D arrays as columns into a 2 -D array.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |