Learn R Programming

mogsa (version 1.6.4)

matpower: compute the power of a matrix

Description

the power of a matrix

Usage

matpower(x, n, nf = min(dim(x)), tol = 1e-07)

Arguments

x
a numerical matrix object that the power of which should be calculated
n
The matrix to the power of
nf
The number of axes kept in the calculation of SVD and reconstruction
tol
The tolerance of the axis, singular vectors with singular value lower than tol will be ignored in the reconstruction.

Value

A matrix x^n

Details

The power of a matrix is calculated in two steps: decompostion step: x=UDV' and the reconstruction step: x^n=U*D^n*V' In the reconstruction, the singular vectors with a singular value more than tol are kept.

See Also

See Also wsvd

Examples

Run this code
  set.seed(56)
  m <- matrix(rnorm(15), 5, 3)
  s <- matpower(m, 2)
  s <- matpower(m, -2)

Run the code above in your browser using DataLab