Loading [MathJax]/jax/input/TeX/config.js
scipy 1.10.1 Pypi GitHub Homepage
Other Docs

ParametersReturns
polar(a, side='right')

Returns the factors of the polar decomposition 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" is computed.

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 a 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.

Compute the polar decomposition.

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.
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/linalg/_decomp_polar.py#8
type: <class 'function'>
Commit: