Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/numpy/matrixlib/__pycache__/ |
Upload File : |
o 6��a�w � @ s� g d �Z ddlZddlZddlZddlm mZ ddlmZm Z ddl mZ ddlm Z dd� Zed�dd d ��Zed�G dd� dej��Zd d� Zed�ddd��ZeZdS ))�matrix�bmat�mat�asmatrix� N)�concatenate�isscalar)� set_module��matrix_powerc C s� dD ]}| � |d�} q| �d�}g }d}|D ]7}|�d�}g }|D ]}|�� } |�ttj| �� q!|dkr:t|�} n t|�| krDtd��|d7 }|�|� q|S )Nz[]� �;r �,zRows not the same size.� ) �replace�split�extend�map�ast�literal_eval�len� ValueError�append)�data�char�rows�newdata�count�row�trow�newrow�col�temp�Ncols� r# �;/usr/lib/python3/dist-packages/numpy/matrixlib/defmatrix.py�_convert_from_string s$ r% �numpyc C s t | |dd�S )a@ Interpret the input as a matrix. Unlike `matrix`, `asmatrix` does not make a copy if the input is already a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. Parameters ---------- data : array_like Input data. dtype : data-type Data-type of the output matrix. Returns ------- mat : matrix `data` interpreted as a matrix. Examples -------- >>> x = np.array([[1, 2], [3, 4]]) >>> m = np.asmatrix(x) >>> x[0,0] = 5 >>> m matrix([[5, 2], [3, 4]]) F��dtype�copy)r )r r( r# r# r$ r $ s !r c @ sf e Zd ZdZdZdGdd�Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� ZdHdd�ZdIdd �ZdJd"d#�ZdHd$d%�ZdKd'd(�ZdKd)d*�ZdHd+d,�ZdLd-d.�ZdLd/d0�ZdLd1d2�ZdLd3d4�ZdLd5d6�ZdLd7d8�ZdLd9d:�Zed;d<� �Z ed=d>� �Z!ed?d@� �Z"dJdAdB�Z#edCdD� �Z$edEdF� �Z%e$j&Z'e!j&Z(e"j&Z)e%j&Z*e j&Z+dS )Mr a� matrix(data, dtype=None, copy=True) .. note:: It is no longer recommended to use this class, even for linear algebra. Instead use regular arrays. The class may be removed in the future. Returns a matrix from an array-like object, or from a string of data. A matrix is a specialized 2-D array that retains its 2-D nature through operations. It has certain special operators, such as ``*`` (matrix multiplication) and ``**`` (matrix power). Parameters ---------- data : array_like or string If `data` is a string, it is interpreted as a matrix with commas or spaces separating columns, and semicolons separating rows. dtype : data-type Data-type of the output matrix. copy : bool If `data` is already an `ndarray`, then this flag determines whether the data is copied (the default), or whether a view is constructed. See Also -------- array Examples -------- >>> a = np.matrix('1 2; 3 4') >>> a matrix([[1, 2], [3, 4]]) >>> np.matrix([[1, 2], [3, 4]]) matrix([[1, 2], [3, 4]]) g $@NTc C sB t jdtdd� t|t�r#|j}|d u r|}||kr|s|S |�|�S t|tj�rM|d u r1|j}nt�|�}|� | �}||jkrE|�|�S |rK|� � S |S t|t�rVt|�}tj |||d�}|j}|j} |dkrltd��|dkrsd} n |dkr}d| d f} d } |dkr�|jjr�d } | s�|jjs�|� � }tjj| | |j|| d�}|S )Nz�the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.� )� stacklevelr'