Learn R Programming

GPUmatrix (version 1.0.2)

matrix-product: Matrix Products

Description

Mimic of the 'base' functions %*%, crossprod, tcrossprod to operate on gpu.matrix-class objects.

Usage

# S4 method for gpu.matrix.tensorflow,ANY
%*%(x, y)
# S4 method for gpu.matrix.torch,ANY
%*%(x, y)

# S4 method for gpu.matrix.tensorflow,ANY crossprod(x, y,...) # S4 method for gpu.matrix.tensorflow,missing crossprod(x, y = NULL,...)

# S4 method for gpu.matrix.tensorflow,ANY tcrossprod(x, y,...) # S4 method for gpu.matrix.tensorflow,missing tcrossprod(x, y = NULL,...)

# S4 method for gpu.matrix.torch,ANY crossprod(x, y,...) # S4 method for gpu.matrix.torch,missing crossprod(x, y = NULL,...)

# S4 method for gpu.matrix.torch,ANY tcrossprod(x, y,...) # S4 method for gpu.matrix.torch,missing tcrossprod(x, y = NULL,...)

Value

A gpu.matrix-class object with the result of the matrix product.

Arguments

x

a gpu.matrix.

y

a gpu.matrix, 'matrix' or 'Matrix' object. For the functions tcrossprod and crossprod is NULL (by default), that is equivalent to x=y.

...

potentially more arguments passed to and from methods.

Methods

%*%

signature(x = "gpu.matrix.tensorflow", y = "ANY"): Matrix multiplication

crossprod

signature(x = "gpu.matrix.tensorflow", y = "ANY"): Matrix multiplication

crossprod

signature(x = "gpu.matrix.tensorflow", y = "missing"): Matrix multiplication

tcrossprod

signature(x = "gpu.matrix.tensorflow", y = "ANY"): Matrix multiplication

tcrossprod

signature(x = "gpu.matrix.tensorflow", y = "missing"): Matrix multiplication

%*%

signature(x = "gpu.matrix.torch", y = "ANY"): Matrix multiplication

crossprod

signature(x = "gpu.matrix.torch", y = "ANY"): Matrix multiplication

crossprod

signature(x = "gpu.matrix.torch", y = "missing"): Matrix multiplication

tcrossprod

signature(x = "gpu.matrix.torch", y = "ANY"): Matrix multiplication

tcrossprod

signature(x = "gpu.matrix.torch", y = "missing"): Matrix multiplication

Details

Internally, these functions call the appropriate tensorflow or torch function to perform the matrix product (depending on the type of input gpu.matrix-class).

If the input gpu.matrix-class object(s) are stored on the GPU, then the operations will be performed on the GPU. See gpu.matrix.

See Also

tcrossprod in R's base, and crossprod and %*%. Matrix package %&% for boolean matrix product methods. Also see torch_matmul

Examples

Run this code
# \donttest{
if (FALSE) {
a <- gpu.matrix(rnorm(12),nrow=4,ncol=3)
b <- t(a)
b
crossprod(a,a)

b <- a
b
tcrossprod(a)


}
# }

Run the code above in your browser using DataLab