Learn R Programming

HiPLARM (version 0.1)

tcrossprod: tcrossproduct 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 (tcrossprod) or x %*% t(y) (tcrossprod).

Usage

tcrossprod(x, y) "tcrossprod"(x, y) "tcrossprod"(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

tcrossprod
(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.
tcrossprod
(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.
tcrossprod
(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.
tcrossprod
(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.
tcrossprod
(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.
tcrossprod
(signature(x = "dtrMatrix", y = "dtrMatrix"): Calls CUBLAS function cublasDtrmm for GPU enabled systems and PLASMA_dtrmm for multi-core systems. Library settings also affect choice between GPU and CPU.
tcrossprod
(signature(x = "denseMatrix", y = "dtrMatrix"): y inherits from virtual class ddenseMatrix 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.
tcrossprod
(signature(x = "matrix", y = "dtrMatrix"): 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