mat_pows: Compute Powers of a Matrix

Description Usage Arguments Value Examples

View source: R/mat_pows.R

Description

This function takes a square matrix and exponentiates it.

Usage

1
mat_pows(m, pows)

Arguments

m

An n x n numeric matrix

pows

Numeric vector of distinct powers to raise m to. Must be positive natural numbers.

Value

A list of equal length to pows, each entry of which corresponds to that power of m.

Examples

1
2
3
4
5
m1 <- diag(x=3, nrow =4)
m2 <- matrix(c(1, 5, 5, 25), nrow =2) /26
mat_pows(m1, 1:5)
#Projection matrices are idempotent:
mat_pows(m2, c(1, 5, 1000))

ryan-heslin/matador documentation built on Dec. 22, 2021, 8:17 p.m.