Learn R Programming

madness (version 0.2.8)

outer: Outer product.

Description

Computes the outer product (or sum, quotient, etc) of the Cartesian product of two inputs.

Usage

# S4 method for ANY,ANY
outer(X, Y, FUN = "*", ...)

# S4 method for madness,madness outer(X, Y, FUN = "*", ...)

# S4 method for madness,array outer(X, Y, FUN = "*", ...)

# S4 method for array,madness outer(X, Y, FUN = "*", ...)

X %o% Y

# S4 method for madness,madness kronecker(X, Y)

# S4 method for madness,array kronecker(X, Y)

# S4 method for array,madness kronecker(X, Y)

Value

a madness object.

Arguments

X, Y

madness or numeric matrix values.

FUN

a function to use on the outer products, found via match.fun (except for the special case "*").

...

optional arguments to be passed to FUN.

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)

y1 <- array(rnorm(3*3),dim=c(3,3))
dy1 <- matrix(rnorm(length(y1)*2),ncol=2)
dx1 <- crossprod(matrix(rnorm(ncol(dy1)*100),nrow=100))
obj1 <- madness(val=y1,vtag='y1',xtag='x',dvdx=dy1,varx=dx1)

anobj <- outer(obj0,obj0,'*')
anobj <- outer(obj0,obj0,'+')
anobj <- outer(obj0,obj1,'-')
anobj <- outer(obj0,obj1,'/')

Run the code above in your browser using DataLab