matrix_decomposition {GPUmatrix}R Documentation

Decomposition of a matrix with GPU

Description

These functions mimic the functions eigen ,svd,chol to operate on gpu.matrix-class objects:

'eigen' mimics the base function 'eigen' that "computes the eigenvalues and eigenvectors of a numeric (double, integer, logical) or complex matrix."

'svd' mimics the base function 'svd' that "computes the singular-value decomposition of a rectangular matrix."

'chol' mimics the base function 'chol' that "computes Compute the Cholesky factorization of a real symmetric positive-definite square matrix."

Usage


## S4 method for signature 'gpu.matrix.tensorflow'
eigen(x)
## S4 method for signature 'gpu.matrix.torch'
eigen(x)

## S4 method for signature 'gpu.matrix.tensorflow'
svd(x)
## S4 method for signature 'gpu.matrix.torch'
svd(x)

## S4 method for signature 'gpu.matrix.tensorflow'
chol(x)
## S4 method for signature 'gpu.matrix.torch'
chol(x)

Arguments

x

a gpu.matrix. X must fulfil certain characteristics depending on the function to be called (see details).

Details

These functions mimic the behaviour of their respective 'base' functions.

In the case of the eigen function, the input value can be a numeric or complex gpu.matrix class.

For svd function, the input value could be a numeric or complex gpu.matrix-class object.

For chol function, the input must be a positive-definite squere matrix.

Internally, these functions call its corresponding function of the tensorflow or torch library 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.

Value

The output of these functions correspond to their equivalent base functions:

eigen mimics the base function eigen that computes the eigenvalues and eigenvectors of a numeric (double, integer, logical) or complex matrix. It returns a list with the following items:

values

a vector with the P eigenvalues of x

vectors

the eigenvectors of x

svd mimics the base function svd that computes the singular-value decomposition of a rectangular matrix. It returns a list with the following items:

d

a vector containing the singular values of x

u

a matrix whose columns contain the left singular vectors of x

v

a matrix whose columns contain the right singular vectors of x

chol mimics the base function chol that computes Compute the Cholesky factorization of a real symmetric positive-definite square matrix. It returns a gpu.matrix-class object with The upper triangular factor of the Cholesky decomposition, i.e., the matrix R such that R'R = X.

See Also

For more information see: eigen, svd, chol, linalg_eig, torch_svd, and torch_cholesky.

chol function is called by the function chol_solve.

For the qr decomposition see qr.

Examples


## Not run: 
a <- gpu.matrix(rnorm(9),3,3)
ein <- eigen(a) #eigenvalues and eigenvectors
svd_return <- svd(a) #svd of gpu.matrix a

ata <- tcrossprod(a)
#ata is a real symmetric positive-definite square matrix.
chol(ata) #cholesky decomposition.



## End(Not run)


[Package GPUmatrix version 1.0.2 Index]