matrix_power

Function matrix_power 

Source
pub fn matrix_power<F>(a: &ArrayView2<'_, F>, p: F) -> LinalgResult<Array2<F>>
where F: Float + NumAssign + Sum + One + 'static + Send + Sync + ScalarOperand,
Expand description

Compute the matrix power A^p for a real number p.

§Arguments

  • a - Input square matrix
  • p - Power (real number)

§Returns

  • Matrix power A^p

§Examples

use scirs2_core::ndarray::array;
use scirs2_linalg::matrix_functions::matrix_power;

let a = array![[4.0_f64, 0.0], [0.0, 9.0]];
let a_half = matrix_power(&a.view(), 0.5).unwrap();
// a_half should be approximately [[2.0, 0.0], [0.0, 3.0]]