polar_decomposition

Function polar_decomposition 

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

Compute the polar decomposition of a matrix.

The polar decomposition factorizes a matrix A as A = UP where U is unitary and P is positive semidefinite.

§Arguments

  • a - Input matrix
  • side - Which factor to return (“left” for A = UP, “right” for A = PU)

§Returns

  • (U, P) - Unitary and positive semidefinite factors

§Examples

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

let a = array![[2.0_f64, 1.0], [0.0, 1.0]];
let (u, p) = polar_decomposition(&a.view(), "right").unwrap();