(Parallel) crossproduct operator

Share:

Description

This operator computes the crossproduct between two matrices. It can be used as a replacement for %*% in most cases. The operator only accepts matrices of types: matrix or dgCMatrix. In the case of two dense matrices the operator will compute the crossproduct in parallel (Eigen + OpenMP)

Usage

1
X%c%Y	

Arguments

X

Matrix or vector (treated as column-vector) of type: matrix or dgCMatrix

Y

as X

Value

Matrix of type: matrix or dgCMatrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Least Squares Solving

# Generate random data 

n = 1000
p = 500

M <- matrix(rnorm(n*p),n,p)
y <- rnorm(n)

# least squares solution:

b <- csolve(t(M) %c% M, t(M) %c% y)