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 |
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 |
vectors |
the eigenvectors of |
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 |
u |
a matrix whose columns contain the left singular vectors of |
v |
a matrix whose columns contain the right singular vectors of |
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)