matTimes {lazy.symbolic} | R Documentation |
Symbolic Multiplication of Two or More Matrices
matTimes(..., method = 1, padd = 0, simplify = 1, debug = 0)
... |
Symbolic matrices or vectors to be multiplied. |
method |
= 2 to use educational method |
padd |
= 0 not to add blank to both sides of + or - |
simplify |
= 0 not to simplify the result |
debug |
= 1 to print intermediate result |
In order to be able to multiply A from the left of B,
ncol(A) == nrow(B).
A matrix and a vector can be multiplied as long as the condition above
holds.
If one argument is a vector, it will be promoted to either a row or column
vector (matrix) to make the two arguments conformable.
If both are vectors of the same length, it will return the inner product.
A scalar can be multiplied to a matrix
Numeric matrices will be treated as character ones.
When you want to chage the sign of all the elements of a matrix, use
A1 <- matMinus( 0, A ) or A1 <- matTimes( -1, A )
If the arguments are super matrices with SMdim attributes, the final result will have an appropriate SMdim attribute.
Can handle fully symbolic partitioned matrices.
A character matrix
A <- demomat(3,2,root="a")
B <- demomat(2,3,root="b")
matTimes( A, B )
C <- demomat(2,3,root="c")
matTimes( A, Plus(B,C) )
A[2,2] <- paste("-",A[2,2],sep="")
B[1,1] <- 0
matTimes( A, B, simplify=0, method=2 )
matTimes( A, B, simplify=0 )
matTimes( A, B )
matTimes( A, B, padd=0 )
matTimes( A, -2 )
matTimes( matTimes(-1,A), B )
matTimes( A, B[,2] )
matTimes( A[1,], B )
matTimes( A, 1:2 )