Vocabulary
math.matrices.extras

Inputs
ma matrix
nan object


Outputs
nan object


Word description
Compute the nth power of the input matrix. If n is -1, the inverse of the matrix is calculated (but see multiplicative-inverse for pitfalls).

Errors
negative-power-matrix if n is a negative number other than -1.

undefined-inverse if n is -1 and the multiplicative-inverse of m is undefined.

Notes
This word is the swapped variant of n^m.
This word is intended for use with "flat" (2-dimensional) matrices.
This word assumes that elements of the input matrix are compatible with the following words:
max ( obj1 obj2 -- obj )

abs ( x -- y )

/ ( x y -- z )


Examples
USING: math.matrices.extras prettyprint ; { { 1 2 } { 3 4 } } 2 m^n .
{ { 7 10 } { 15 22 } }


Definition