bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / linalg / _decomp_polar / polar
function
scipy.linalg._decomp_polar:polar
source: build-install/usr/lib/python3.14/site-packages/scipy/linalg/_decomp_polar.py:14
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.
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✗
array([[1.89, 1.2 ],
[1.2 , 3.94]])
A non-square example, with m < n:
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.✗
array([[1., 0.],
[0., 1.]])
Another non-square example, with m > n:
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.✗
array([[ 1., -0.],
[-0., 1.]])
Aliases
scipy.linalg.polar