matrix_power

Contents

matrix_power#

class brainunit.math.matrix_power(a, n, **kwargs)#

Raise a square matrix to the (integer) power n.

The resulting unit is a.unit ** n.

Parameters:
  • a (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Square matrix to be “powered”.

  • n (int) – The exponent can be any integer or zero.

Returns:

out – The result of raising a to the power n. The resulting unit is a.unit ** n.

Return type:

Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity

Examples

>>> import saiunit as u
>>> m = u.math.array([[1.0, 2.0], [3.0, 4.0]]) * u.meter
>>> u.math.matrix_power(m, 2)  # unit is meter ** 2