powered by
A function that returns a permuted vector according to a matrix and permutation vector.
apply_permutation_to_matrix(M, p)
a length n vector with ith entry corresponding to the i, p_i entry in M
a square matrix of dimension n
a permuted version of the vector from 1:n
mat <- matrix(1:9, nrow = 3, ncol = 3) perm <- c(2, 1, 3) permuted <- apply_permutation_to_matrix(M = mat, p = perm)
Run the code above in your browser using DataLab