tda_msrow/tda_mscol select (and may reorder or
repeat) rows/columns by index – TDA's msrow/mscol,
matching X[rows, ]/X[, cols]. tda_mprow/
tda_mpcol/tda_mpsym permute rows, columns, or both
by the same permutation – TDA's mprow/mpcol/
mpsym, matching A[p, ]/A[, p]/A[p, p]
(m_mperm's header states the convention,
b(i,j)=a(p(i),j) etc.).
mprow/mpcol require a permutation of
1:nrow(A)/1:ncol(A), so unlike msrow/
mscol they cannot repeat or drop indices; mpsym
additionally requires A to be square.
See also
Other matrix reshaping:
tda_mag(),
tda_mcath(),
tda_mcvec(),
tda_mrsum(),
tda_msort(),
tda_mtrim()
Examples
A <- matrix(1:9, 3, 3)
tda_msrow(A, c(2, 1)) # == A[c(2, 1), ]
#> [,1] [,2] [,3]
#> [1,] 2 5 8
#> [2,] 1 4 7
tda_mprow(A, c(2, 3, 1)) # == A[c(2, 3, 1), ]
#> [,1] [,2] [,3]
#> [1,] 2 5 8
#> [2,] 3 6 9
#> [3,] 1 4 7
tda_mpsym(A, c(2, 3, 1)) # == A[c(2, 3, 1), c(2, 3, 1)]
#> [,1] [,2] [,3]
#> [1,] 5 8 2
#> [2,] 6 9 3
#> [3,] 4 7 1