Skip to contents

Power of a matrix computed by successive matrix multiplication.

Usage

power_function(A, n)

Arguments

A

A matrix

n

Positive integer

Value

This function return the power of a matrix by repeating matrix multiplication.

References

Wasserman, S. and Faust, K. (1994). Social network analysis: Methods and applications. Cambridge University Press.

Author

Alejandro Espinosa-Rada

Examples

A <- matrix(c(
  1, 0, 0, 0,
  1, 1, 0, 0,
  1, 0, 1, 0,
  0, 1, 1, 1
), byrow = TRUE, ncol = 4, nrow = 4)
power_function(A, 1000)
#> Error in powA(n): object 'A' not found