expmGPU {GPUmatrix}R Documentation

'GPUmatrix' Exponential

Description

This function mimics the function expm of the library Matrix to operate on gpu.matrix-class objects: It "computes the exponential of a matrix."

Usage

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

Arguments

x

a gpu.matrix.

Details

The exponential of a matrix is computed as: \sum_{k=0}^\infty 1/k!X^k.

The function expmGPU internally calls the corresponding function of the library torch or tensorflow (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.

Please note that this function works with float numbers (either float32 or float64). If the data type of x is integer, this function will not work. An example is shown below.

Value

The matrix exponential of x as gpu.matrix class.

See Also

For more information see expm, and torch_matrix_exp.

Examples

  
  ## Not run: 
#build with a matrix that contains int number. It will  not work.
x <- gpu.matrix(1:9,nrow=3,ncol = 3,dtype = "int")
x
try(expmGPU(x))

#need to be float and not int
x <- gpu.matrix(1:9,nrow=3,ncol = 3,dtype = "float64")
expmGPU(x)


## End(Not run)



[Package GPUmatrix version 1.0.2 Index]