Arithmetic Ops Group Methods for polyMatrix class objects
Allows arithmetic operations by left hand side polynomial matrices. Contains operators such as addition, multiplication, division, etc.
## S3 method for class 'polyMatrix' Ops(e1,e2)
e1 |
an object of class |
e2 |
an object of class |
A c("polyMdlist","polyMatrix") class polynomial matrix which is the result obtained by performing the operation on the two arguments.
Prohle Tamas
X <- polyMgen.d(2,2, rawData=ch2pn(c("1","1+x^2","x","0")))
Y <- polyMgen.d(2,2, rawData=ch2pn(c("2","2*x+x^2","x","-1")))
X # signing a polyMatrix
-X
+X
X+1 # polyMatrix + numeric
X-1
1+X # numeric + polyMatrix
1-X
(1-X)*2 # polyMatrix * numeric
(-2)*(1-X)
X # polyMatrix + matrix
diag(2)+X+diag(2)
-diag(2)-X-diag(2)
X-M2pM(diag(2)) # polyMatrix - polyMatrix -- OK
X+Y
X-Y
# polyMatrix * polynom -- three solutions:
X*"1+3*x+2*x^2" # as a string
"1+3*x+2*x^2"*X
X*diag(list(ch2pn("1+3*x+2*x^2")),dim(X)[2]) # as a diagonal polyMatrix
diag(list(ch2pn("1+3*x+2*x^2")),dim(X)[2])*X
# X*polynom::polynomial(c(1,3,2)) # as a polynomial
# polynom::polynomial(c(1,3,2))*X # does not works!
# polyMatrix product
Z<-X*Y
Z
const(X)
const(Y)
const(X)%*%const(Y) # conventional multiplication of two matrices
const(Z) # similar: the constant of the product polyMatrix
const(X)*const(Y) # dissimilar: element wise product of two conventional matrices
# polyMatrix power
X
X^0
X^1
X^2
X*X
X^3
# clean up
# rm(X, Y, Z)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.