pub fn polar_decomposition<F>(
a: &ArrayView2<'_, F>,
side: &str,
) -> LinalgResult<(Array2<F>, Array2<F>)>
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 matrixside
- 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();