matKTimes {lazy.symbolic} | R Documentation |
Symbolic Kronecker Product
matKTimes( ..., add_paren = 0, simplify = 0, ra = 0, remove_attributes = ra, debug = 0 )
... |
Symbolic matrices or vectors to be multiplied. |
add_paren |
= 1 to enclose the left matrix by parens |
simplify |
= 1 to simplify the result |
ra |
= 1 to remove the SMdim attributes |
remove_attributes |
same as the ra parameter above. |
debug |
= 1 to print intermediate result |
If A or B is a vector, it will be converted to a column vector.
With ra=0, the result can be printed with separator by Printb
.
Do NOT use t
function to transpose a Kronecker product.
It may destroy the SMdim attributes and causes error in Printb
.
A nrow(A)*nrow(B) x ncol(A)*ncol(B) matrix
# symbolic example A <- demomat(2,2,root="a"); B <- demomat(3,3,root="b") AkB=matKTimes(A,B) Printb(AkB) Printb(matKTimes(diag(2),A)) Printb(matKTimes(1:2,A)) Printb(matKTimes(matrix(1:2,1),A)) Printb(matKTimes(A,1:2)) Printb(matKTimes(A,matrix(1:2,1))) tAktB=matKTimes(t(A),t(B)) Printb(tAktB) Printb(Minus(transp(AkB),tAktB)) # Printb(t(AktB))