repmat {lazy.mat} | R Documentation |
Stack a matrix n times either horizontally or vertically.
repmat(A, n, method = 2)
A |
Input matrix |
n |
number of times |
method |
= 1 to stack matices horizontally
to create a nr x (nc x n) matrix. |
When n is a scalar, the whole input is replicated n times.
When n is a vector of length nrow(A),
i-th row of A matrix will be replicated
n[i] times and verticall stacked.
When the input is a vector, the resul will also be a vector.
#'
Can be used with character matrix.
a matrix
repmat( demomat(2,2), 2 ) repmat( demomat(2,2), 2, method=1 ) repmat( demomat(2,2), 1:2 ) # Semi Symbolic Partitioned Matrix: Super Matrix with SMdim attributes A=demomat(c(2,3),c(3,4),root="a") Printb(A) repA=repmat(A,2) Printb(repA) # with lazy.symbolic package # trepA=tp(repA) # Printb(trepA) # Fully Symbolic Partitioned Matrix: # No SMdim attribute but fullsymb attribute Ap=demomat(2,3,root="A", fullsymb=1) Printb(Ap) repAp=repmat(Ap,2) Printb(repAp) # with lazy.symbolic package # trepAp=tp(repAp) # Printb(trepAp)