Arithmetic | R Documentation |
Perform unary or binary arithmetic operations on FlashR objects.
## S4 method for signature 'fm,missing' e1 - e2 ## S4 method for signature 'fmV,missing' e1 - e2 ## S4 method for signature 'fm,fm' e1 + e2 ## S4 method for signature 'fmV,fmV' e1 + e2 ## S4 method for signature 'fm,fmV' e1 + e2 ## S4 method for signature 'fmV,fm' e1 + e2 ## S4 method for signature 'fm,matrix' e1 + e2 ## S4 method for signature 'matrix,fm' e1 + e2 ## S4 method for signature 'fm,ANY' e1 + e2 ## S4 method for signature 'ANY,fm' e1 + e2 ## S4 method for signature 'fmV,ANY' e1 + e2 ## S4 method for signature 'ANY,fmV' e1 + e2 ## S4 method for signature 'fm,fm' e1 - e2 ## S4 method for signature 'fmV,fmV' e1 - e2 ## S4 method for signature 'fm,fmV' e1 - e2 ## S4 method for signature 'fmV,fm' e1 - e2 ## S4 method for signature 'fm,matrix' e1 - e2 ## S4 method for signature 'matrix,fm' e1 - e2 ## S4 method for signature 'fm,ANY' e1 - e2 ## S4 method for signature 'ANY,fm' e1 - e2 ## S4 method for signature 'fmV,ANY' e1 - e2 ## S4 method for signature 'ANY,fmV' e1 - e2 ## S4 method for signature 'fm,fm' e1 * e2 ## S4 method for signature 'fmV,fmV' e1 * e2 ## S4 method for signature 'fm,fmV' e1 * e2 ## S4 method for signature 'fmV,fm' e1 * e2 ## S4 method for signature 'fm,matrix' e1 * e2 ## S4 method for signature 'matrix,fm' e1 * e2 ## S4 method for signature 'fm,ANY' e1 * e2 ## S4 method for signature 'ANY,fm' e1 * e2 ## S4 method for signature 'fmV,ANY' e1 * e2 ## S4 method for signature 'ANY,fmV' e1 * e2 ## S4 method for signature 'fm,fm' e1 / e2 ## S4 method for signature 'fmV,fmV' e1 / e2 ## S4 method for signature 'fm,fmV' e1 / e2 ## S4 method for signature 'fmV,fm' e1 / e2 ## S4 method for signature 'fm,matrix' e1 / e2 ## S4 method for signature 'matrix,fm' e1 / e2 ## S4 method for signature 'fm,ANY' e1 / e2 ## S4 method for signature 'ANY,fm' e1 / e2 ## S4 method for signature 'fmV,ANY' e1 / e2 ## S4 method for signature 'ANY,fmV' e1 / e2 ## S4 method for signature 'fm,fm' e1 ^ e2 ## S4 method for signature 'fmV,fmV' e1 ^ e2 ## S4 method for signature 'fm,fmV' e1 ^ e2 ## S4 method for signature 'fm,matrix' e1 ^ e2 ## S4 method for signature 'matrix,fm' e1 ^ e2 ## S4 method for signature 'ANY,fmV' e1 ^ e2 ## S4 method for signature 'fm,ANY' e1 ^ e2 ## S4 method for signature 'fmV,ANY' e1 ^ e2
e1, e2 |
One of the operands need to be a FlashR object. If one operand is a matrix and the other is a vector, we perform the arithmetic operation on the vector and every column of the matrix. If one operand is a scalar, we perform the operation on the scalar with every element in the matrix or the vector. There are a few exceptions. For example, the left operand of "^" has to be a FlashR object and the right operand has to be a scalar. |
mat1 <- fm.runif.matrix(100, 10) mat2 <- fm.runif.matrix(100, 10) mat <- -mat1 mat <- mat1 + mat2 mat <- mat1 - mat2 mat <- mat1 * mat2 mat <- mat1 / mat2 mat <- mat1 ^ 2