Learn R Programming

madness (version 0.1.0)

outer: Outer product.

Description

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

Usage

outer(X, Y, FUN = "*", ...)

## S3 method for class 'ANY,ANY': outer(X, Y, FUN = "*", ...)

## S3 method for class 'madness,madness': outer(X, Y, FUN = "*", ...)

## S3 method for class 'madness,array': outer(X, Y, FUN = "*", ...)

## S3 method for class 'array,madness': outer(X, Y, FUN = "*", ...)

## S3 method for class 'madness,madness': kronecker(X, Y)

## S3 method for class 'madness,array': kronecker(X, Y)

## S3 method for class 'array,madness': kronecker(X, Y)

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.

Value

  • a madness object.

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