bundles / scipy latest / scipy / linalg / _decomp_polar / polar
function
scipy.linalg._decomp_polar:polar
Signature
def polar ( a , side = right ) Summary
Compute the polar decomposition.
Extended Summary
Returns the factors of the polar decomposition [1] u and p such that a = up (if side is "right") or a = pu (if side is "left"), where p is positive semidefinite. Depending on the shape of a, either the rows or columns of u are orthonormal. When a is a square array, u is a square unitary array. When a is not square, the "canonical polar decomposition" [2] is computed.
The documentation is written assuming array arguments are of specified "core" shapes. However, array argument(s) of this function may have additional "batch" dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see linalg_batch for details. Note that calls with zero-size batches are unsupported and will raise a ValueError.
Parameters
a: (m, n) array_likeThe array to be factored.
side: {'left', 'right'}, optionalDetermines whether a right or left polar decomposition is computed. If
sideis "right", thena = up. Ifsideis "left", thena = pu. The default is "right".
Returns
u: (m, n) ndarrayIf
ais square, then u is unitary. If m > n, then the columns of u are orthonormal, and if m < n, then the rows of u are orthonormal.p: ndarrayp is Hermitian positive semidefinite. If
ais nonsingular, p is positive definite. The shape of p is (n, n) or (m, m), depending on whethersideis "right" or "left", respectively.
Examples
import numpy as np from scipy.linalg import polar a = np.array([[1, -1], [2, 4]]) u, p = polar(a)✓
u p✗
b = np.array([[0.5, 1, 2], [1.5, 3, 4]]) u, p = polar(b)✓
u p u.dot(p) # Verify the decomposition. u.dot(u.T) # The rows of u are orthonormal.✗
c = b.T u, p = polar(c)✓
u p u.dot(p) # Verify the decomposition. u.T.dot(u) # The columns of u are orthonormal.✗
Aliases
-
scipy.linalg.polar