power_of_a_matrix: Compute the kth power of a matrix.

power_of_a_matrixR Documentation

Compute the kth power of a matrix.

Description

Comput the kth power of a squere matrix, i.e., multiply the gpu.matrix-class object by itself as many times as user indicates.

Usage

## S4 method for signature 'gpu.matrix.tensorflow,numeric'
x %^% k
## S4 method for signature 'gpu.matrix.torch,numeric'
x %^% k

Arguments

x

a gpu.matrix.

k

the power of the matrix.

Details

The input x gpu.matrix-class needs to be squere. This function internally call the method %*% as many times as required. If the input gpu.matrix-class object is stored on the GPU, then the operations will be performed on the GPU. See gpu.matrix.

Value

the nth power of the input gpu.matrix-class object. The returned matrix is also a gpu.matrix-class object.

See Also

See also: %*%.

Examples


## Not run: 

a <- gpu.matrix(rnorm(9),nrow=3,ncol=3)
a %^% 5



## End(Not run)


GPUmatrix documentation built on May 29, 2024, 11:02 a.m.