Learn R Programming

madness (version 0.2.8)

arithops: Basic Arithmetic Operations.

Description

These perform basic arithmetic operations on madness objects: unary plus and minus, addition, subtraction, multiplication, division and power.

Usage

# S4 method for madness,missing
+(e1, e2)

# S4 method for madness,missing -(e1, e2)

# S4 method for madness,madness +(e1, e2)

# S4 method for madness,numeric +(e1, e2)

# S4 method for madness,array +(e1, e2)

# S4 method for numeric,madness +(e1, e2)

# S4 method for array,madness +(e1, e2)

# S4 method for madness,madness -(e1, e2)

# S4 method for madness,numeric -(e1, e2)

# S4 method for madness,array -(e1, e2)

# S4 method for numeric,madness -(e1, e2)

# S4 method for array,madness -(e1, e2)

# S4 method for madness,madness *(e1, e2)

# S4 method for madness,numeric *(e1, e2)

# S4 method for madness,array *(e1, e2)

# S4 method for numeric,madness *(e1, e2)

# S4 method for array,madness *(e1, e2)

# S4 method for madness,madness /(e1, e2)

# S4 method for madness,numeric /(e1, e2)

# S4 method for madness,array /(e1, e2)

# S4 method for numeric,madness /(e1, e2)

# S4 method for array,madness /(e1, e2)

# S4 method for madness,madness ^(e1, e2)

# S4 method for madness,numeric ^(e1, e2)

# S4 method for madness,array ^(e1, e2)

# S4 method for numeric,madness ^(e1, e2)

# S4 method for array,madness ^(e1, e2)

Arguments

e1, e2

madness or numeric values

Author

Steven E. Pav shabbychef@gmail.com

Examples

Run this code
set.seed(123)
y <- array(rnorm(3*3),dim=c(3,3))
dy <- matrix(rnorm(length(y)*2),ncol=2)
dx <- crossprod(matrix(rnorm(ncol(dy)*100),nrow=100))
obj0 <- madness(val=y,vtag='y',xtag='x',dvdx=dy,varx=dx)
z <- array(rnorm(3*3),dim=c(3,3))

anobj <- + obj0
anobj <- - obj0
anobj <- 6 - obj0
anobj <- 1 + obj0
anobj <- obj0 - 3
anobj <- z + obj0 
anobj <- obj0 - z

obj1 <- obj0 ^ 2
anobj <- (0.3 * obj0) + (5.1 * obj1)

anobj <- 2 ^ obj0
anobj <- obj1 ^ obj0
anobj <- obj1 / obj0
anobj <- z / obj0

Run the code above in your browser using DataLab