← Back
Editing: linalg.cpython-311.pyc
� ���c] � � � d Z g d�ZddlZddlZddlZddlmZmZmZm Z m Z mZmZm Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/ ddl0m1Z1 ddl2m3Z3 ddlm4Z4 ddl5m6Z6m7Z7 dd l8m9Z9 ej: e4j; d �� � Z;eZ< e3d � � G d� d e=� � � � Z>d� Z? e?� � Z@[?d� ZAd� ZBd� ZCd� ZDd� ZEd� ZFd� ZGd� ZHd� ZIeee e eeee iZJeee eeeeeiZKe fd�ZLefd�ZMd� ZNd� ZOd� ZPd� ZQd� ZRd� ZSd � ZTd!� ZUdQd"�ZV e;eV� � dQd#�� � ZWd$� ZX e;eX� � d%� � � ZYdQd&�ZZ e;eZ� � dRd(�� � Z[d)� Z\ e;e\� � d*� � � Z]d+� Z^ e;e^� � d,� � � Z_ e;e\� � d-� � � Z`dQd.�Za e;ea� � dSd0�� � Zb e;e\� � d1� � � ZcdQd2�Zd e;ed� � dTd4�� � Zed5� Zf e;e\� � d6� � � Zg e;ed� � dTd7�� � ZhdUd8�Zi e;ei� � dVd;�� � ZjdQd<�Zk e;ek� � dQd=�� � ZldWd>�Zm e;em� � dXd?�� � ZndWd@�Zo e;eo� � dYdB�� � Zp e;e\� � dC� � � Zq e;e\� � dD� � � ZrdQdE�Zs e;es� � dZdG�� � ZtdH� ZudUdI�Zv e;ev� � d[dJ�� � ZwddK�dL�Zx e;ex� � ddK�dM�� � ZydQdN�Zzd\dO�Z{dQdP�Z|dS )]ax Lite version of scipy.linalg. Notes ----- This module is a lite version of the linalg.py module in SciPy which contains high-level Python interface to the LAPACK library. The lite version only accesses the following LAPACK functions: dgesv, zgesv, dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetrf, zgetrf, dpotrf, zpotrf, dgeqrf, zgeqrf, zungqr, dorgqr. )�matrix_power�solve�tensorsolve� tensorinv�inv�cholesky�eigvals�eigvalsh�pinv�slogdet�det�svd�eig�eigh�lstsq�norm�qr�cond�matrix_rank�LinAlgError� multi_dot� N)*�array�asarray�zeros�empty� empty_like�intc�single�double�csingle�cdouble�inexact�complexfloating�newaxis�all�Inf�dot�add�multiply�sqrt�sum�isfinite�finfo�errstate� geterrobj�moveaxis�amin�amax�product�abs� atleast_2d�intp� asanyarray�object_�matmul�swapaxes�divide� count_nonzero�isnan�sign�argsort�sort� reciprocal)�normalize_axis_index)� set_module)� overrides)�triu�eye)� _umath_linalgznumpy.linalg)�modulec � � e Zd ZdZdS )r a Generic Python-exception-derived object raised by linalg functions. General purpose exception class, derived from Python's exception.Exception class, programmatically raised in linalg functions when a Linear Algebra-related condition would prevent further correct execution of the function. Parameters ---------- None Examples -------- >>> from numpy import linalg as LA >>> LA.inv(np.zeros((2,2))) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "...linalg.py", line 350, in inv return wrap(solve(a, identity(a.shape[0], dtype=a.dtype))) File "...linalg.py", line 249, in solve raise LinAlgError('Singular matrix') numpy.linalg.LinAlgError: Singular matrix N)�__name__� __module__�__qualname__�__doc__� � �5/usr/lib/python3/dist-packages/numpy/linalg/linalg.pyr r , s � � � � � �� � � rO r c � � t � � } | d }t dddd�� � 5 t � � d }d d d � � n# 1 swxY w Y ||d gS )Nr �call�ignore)�invalid�overr; �under� )r/ r. )�errobj�bufsize�invalid_call_errmasks rP �_determine_error_statesr[ J s� � � �[�[�F��Q�i�G� �&�x�!�� 3� 3� 3� .� .�(�{�{�1�~��.� .� .� .� .� .� .� .� .� .� .���� .� .� .� .� �)�4�0�0s �A�A�Ac � � t d� � �)NzSingular matrix�r ��err�flags rP �_raise_linalgerror_singularra X s � � �'� (� (�(rO c � � t d� � �)NzMatrix is not positive definiter] r^ s rP �_raise_linalgerror_nonposdefrc [ s � � �7� 8� 8�8rO c � � t d� � �)NzEigenvalues did not converger] r^ s rP �-_raise_linalgerror_eigenvalues_nonconvergencere ^ s � � �4� 5� 5�5rO c � � t d� � �)NzSVD did not converger] r^ s rP �%_raise_linalgerror_svd_nonconvergencerg a s � � �,� -� -�-rO c � � t d� � �)Nz,SVD did not converge in Linear Least Squaresr] r^ s rP �_raise_linalgerror_lstsqri d s � � �D� E� E�ErO c � � t d� � �)Nz:Incorrect argument found while performing QR factorizationr] r^ s rP �_raise_linalgerror_qrrk g s � � � )� *� *� *rO c �8 � t t � � }| |d<