Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


HiPLARM (version 0.1)

crossprod: Crossproduct using GPU or multi-core CPU

Description

Given matrices x and y as arguments, return a matrix cross-product. This is formally equivalent to (but usually slightly faster than) the call t(x) %*% y (crossprod) or x %*% t(y) (tcrossprod).

Usage

crossprod(x, y) "crossprod"(x, y) "crossprod"(x, y)

Arguments

x
dense matrix or vector represented as a single row matrix.
y
dense matrix or vector represented as single row matrix.

Methods

crossprod
(signature(x = "dgeMatrix", y = "missing"): Calls CUBLAS function cublasDsyrk for GPU enabled systems and PLASMA_dsyrk for multi-core systems. Library settings also affect choice between GPU and CPU. If y = NULL, then it is taken to be the same matrix as x.
crossprod
(signature(x = "dgeMatrix", y = "dgeMatrix"): Calls MAGMA function magma_dgemm for GPU enabled systems and PLASMA_dgemm for multi-core systems. Library settings also affect choice between GPU and CPU.
crossprod
(signature(x = "dgeMatrix", y = "Matrix"): Calls MAGMA function magma_dgemm for GPU enabled systems and PLASMA_dgemm for multi-core systems. Library settings also affect choice between GPU and CPU.
crossprod
(signature(x = "dgeMatrix", y = "numeric"): Calls MAGMA function magma_dgemm for GPU enabled systems and PLASMA_dgemm for multi-core systems. Library settings also affect choice between GPU and CPU. y is coerced to a base::matrix
crossprod
(signature(x = "dgeMatrix", y = "matrix"): Calls MAGMA function magma_dgemm for GPU enabled systems and PLASMA_dgemm for multi-core systems. Library settings also affect choice between GPU and CPU.
crossprod
(signature(x = "dtrMatrix", y = "dtrMatrix"): Calls the CUBLAS function cublasDtrmm for GPU enabled systems and PLASMA_dtrmm for multi-core systems. Library settings also affect choice between GPU and CPU.
crossprod
(signature(x = "dtrMatrix", y = "ddenseMatrix"): y inherits from virtual class ddenseMatrix Calls CUBLAS function magma_dgemm for GPU enabled systems and PLASMA_dgemm for multi-core systems. Library settings also affect choice between GPU and CPU.
crossprod
(signature(x = "dtrMatrix", y = "matrix"): Calls CUBLAS function cublasDtrmm for GPU enabled systems and PLASMA_dtrmm for multi-core systems. Library settings also affect choice between GPU and CPU.

Details

For further details on classes and methods see the full Matrix package documentation.

References

Martin Maechler, Douglas Bates (Matrix package)

Examples

Run this code
m <- matrix(0, 400, 500)
set.seed(12)
m[runif(314, 0, length(m))] <- 1
mm <- as(m, "dgeMatrix")
object.size(m) / object.size(mm) # smaller by a factor of > 200

## tcrossprod() is very fast:
system.time(tCmm <- tcrossprod(mm))
system.time(cm <- crossprod(t(m)))
system.time(cm. <- tcrossprod(m))

stopifnot(cm == as(tCmm, "matrix"))

Run the code above in your browser using DataLab