{ } Raw JSON

bundles / scipy latest / scipy / linalg / _decomp_polar / polar

function

scipy.linalg._decomp_polar:polar

source: /scipy/linalg/_decomp_polar.py :9

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_like

The array to be factored.

side : {'left', 'right'}, optional

Determines whether a right or left polar decomposition is computed. If side is "right", then a = up. If side is "left", then a = pu. The default is "right".

Returns

u : (m, n) ndarray

If a is 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 : ndarray

p is Hermitian positive semidefinite. If a is nonsingular, p is positive definite. The shape of p is (n, n) or (m, m), depending on whether side is "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
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.
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.

Aliases

  • scipy.linalg.polar

Referenced by

This package