Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python35
/
lib64
/
python3.5
/
site-packages
/
scipy
/
linalg
/
__pycache__
/
File Content:
_decomp_polar.cpython-35.pyc
=WW' � @ sT d d l m Z m Z m Z d d l Z d d l m Z d g Z d d d � Z d S)� )�division�print_function�absolute_importN)�svd�polar�rightc C s� | d k r t d � � t j | � } | j d k rB t d � � t | d d �\ } } } | j | � } | d k r� | j j � | j | � } n | | j | j j � � } | | f S) a� Compute the polar decomposition. 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. 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. References ---------- .. [1] R. A. Horn and C. R. Johnson, "Matrix Analysis", Cambridge University Press, 1985. .. [2] N. J. Higham, "Functions of Matrices: Theory and Computation", SIAM, 2008. Examples -------- >>> from scipy.linalg import polar >>> a = np.array([[1, -1], [2, 4]]) >>> u, p = polar(a) >>> u array([[ 0.85749293, -0.51449576], [ 0.51449576, 0.85749293]]) >>> p array([[ 1.88648444, 1.2004901 ], [ 1.2004901 , 3.94446746]]) A non-square example, with m < n: >>> b = np.array([[0.5, 1, 2], [1.5, 3, 4]]) >>> u, p = polar(b) >>> u array([[-0.21196618, -0.42393237, 0.88054056], [ 0.39378971, 0.78757942, 0.4739708 ]]) >>> p array([[ 0.48470147, 0.96940295, 1.15122648], [ 0.96940295, 1.9388059 , 2.30245295], [ 1.15122648, 2.30245295, 3.65696431]]) >>> u.dot(p) # Verify the decomposition. array([[ 0.5, 1. , 2. ], [ 1.5, 3. , 4. ]]) >>> u.dot(u.T) # The rows of u are orthonormal. array([[ 1.00000000e+00, -2.07353665e-17], [ -2.07353665e-17, 1.00000000e+00]]) Another non-square example, with m > n: >>> c = b.T >>> u, p = polar(c) >>> u array([[-0.21196618, 0.39378971], [-0.42393237, 0.78757942], [ 0.88054056, 0.4739708 ]]) >>> p array([[ 1.23116567, 1.93241587], [ 1.93241587, 4.84930602]]) >>> u.dot(p) # Verify the decomposition. array([[ 0.5, 1.5], [ 1. , 3. ], [ 2. , 4. ]]) >>> u.T.dot(u) # The columns of u are orthonormal. array([[ 1.00000000e+00, -1.26363763e-16], [ -1.26363763e-16, 1.00000000e+00]]) r �leftz'`side` must be either 'right' or 'left'� z`a` must be a 2-D array.Z full_matricesF)r r )� ValueError�npZasarray�ndimr �dot�TZconj)�aZside�w�sZvh�u�p� r �/_decomp_polar.pyr s X) Z __future__r r r Znumpyr Zscipy.linalgr �__all__r r r r r �<module> s
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
__init__.cpython-35.opt-1.pyc
6592 bytes
0644
__init__.cpython-35.pyc
6592 bytes
0644
_cython_signature_generator.cpython-35.opt-1.pyc
7559 bytes
0644
_cython_signature_generator.cpython-35.pyc
7559 bytes
0644
_cython_wrapper_generators.cpython-35.opt-1.pyc
26136 bytes
0644
_cython_wrapper_generators.cpython-35.pyc
26136 bytes
0644
_decomp_polar.cpython-35.opt-1.pyc
3816 bytes
0644
_decomp_polar.cpython-35.pyc
3816 bytes
0644
_decomp_qz.cpython-35.opt-1.pyc
12030 bytes
0644
_decomp_qz.cpython-35.pyc
12030 bytes
0644
_expm_frechet.cpython-35.opt-1.pyc
12564 bytes
0644
_expm_frechet.cpython-35.pyc
12564 bytes
0644
_interpolative_backend.cpython-35.opt-1.pyc
42994 bytes
0644
_interpolative_backend.cpython-35.pyc
42994 bytes
0644
_matfuncs_inv_ssq.cpython-35.opt-1.pyc
25694 bytes
0644
_matfuncs_inv_ssq.cpython-35.pyc
25694 bytes
0644
_matfuncs_sqrtm.cpython-35.opt-1.pyc
5330 bytes
0644
_matfuncs_sqrtm.cpython-35.pyc
5330 bytes
0644
_procrustes.cpython-35.opt-1.pyc
2485 bytes
0644
_procrustes.cpython-35.pyc
2485 bytes
0644
_solvers.cpython-35.opt-1.pyc
10076 bytes
0644
_solvers.cpython-35.pyc
10076 bytes
0644
_testutils.cpython-35.opt-1.pyc
2706 bytes
0644
_testutils.cpython-35.pyc
2706 bytes
0644
basic.cpython-35.opt-1.pyc
33967 bytes
0644
basic.cpython-35.pyc
33967 bytes
0644
blas.cpython-35.opt-1.pyc
6195 bytes
0644
blas.cpython-35.pyc
6195 bytes
0644
calc_lwork.cpython-35.opt-1.pyc
808 bytes
0644
calc_lwork.cpython-35.pyc
808 bytes
0644
decomp.cpython-35.opt-1.pyc
25191 bytes
0644
decomp.cpython-35.pyc
25191 bytes
0644
decomp_cholesky.cpython-35.opt-1.pyc
9143 bytes
0644
decomp_cholesky.cpython-35.pyc
9143 bytes
0644
decomp_lu.cpython-35.opt-1.pyc
5702 bytes
0644
decomp_lu.cpython-35.pyc
5702 bytes
0644
decomp_qr.cpython-35.opt-1.pyc
11544 bytes
0644
decomp_qr.cpython-35.pyc
11544 bytes
0644
decomp_schur.cpython-35.opt-1.pyc
8618 bytes
0644
decomp_schur.cpython-35.pyc
8618 bytes
0644
decomp_svd.cpython-35.opt-1.pyc
7223 bytes
0644
decomp_svd.cpython-35.pyc
7223 bytes
0644
flinalg.cpython-35.opt-1.pyc
1376 bytes
0644
flinalg.cpython-35.pyc
1376 bytes
0644
interpolative.cpython-35.opt-1.pyc
29115 bytes
0644
interpolative.cpython-35.pyc
29115 bytes
0644
lapack.cpython-35.opt-1.pyc
7771 bytes
0644
lapack.cpython-35.pyc
7771 bytes
0644
linalg_version.cpython-35.opt-1.pyc
328 bytes
0644
linalg_version.cpython-35.pyc
328 bytes
0644
matfuncs.cpython-35.opt-1.pyc
20010 bytes
0644
matfuncs.cpython-35.pyc
20010 bytes
0644
misc.cpython-35.opt-1.pyc
5150 bytes
0644
misc.cpython-35.pyc
5150 bytes
0644
setup.cpython-35.opt-1.pyc
4324 bytes
0644
setup.cpython-35.pyc
4324 bytes
0644
special_matrices.cpython-35.opt-1.pyc
28873 bytes
0644
special_matrices.cpython-35.pyc
28873 bytes
0644
N4ST4R_ID | Naxtarrr