reMat {exactLTRE} | R Documentation |
Reconstruct a matrix that was collapsed into a row vector
Description
Reconstruct a matrix that was collapsed into a row vector. This function assumes that the matrix is square (as population projection matrices are). This function also assumes that the matrix was originally collapsed column-wise.
Usage
reMat(vecM, j = NULL)
Arguments
vecM |
Either a single row containing a vectorized matrix, or a matrix where each row is a column-wise vectorized matrix. |
j |
Row-index of the target matrix to re-construct, if |
Value
A single square matrix
Examples
A1<- matrix(data=c(0,0.8,0, 0,0,0.7, 5,0,0.2), nrow=3, ncol=3)
A2<- matrix(data=c(0,0.9,0, 0,0,0.5, 4,0,0.3), nrow=3, ncol=3)
A3<- matrix(data=c(0,0.4,0, 0,0,0.6, 6,0,0.25), nrow=3, ncol=3)
A1_remat<- reMat(as.vector(A1))
A_all<- rbind(as.vector(A1), as.vector(A2), as.vector(A3))
A3_remat<- reMat(A_all, j=3)
[Package exactLTRE version 0.1.0 Index]