| Server IP : 217.160.0.135 / Your IP : 216.73.216.115 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/scipy/sparse/__pycache__/ |
Upload File : |
�
d�cdv � �" � d Z dZg d�ZddlZddlmZ ddlZddlm Z m
Z
ddlmZm
Z
mZ dd lmZ dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ d!d�Zd"d�Zd#d�Zdde dfd�Z!d$d�Z"d$d�Z#d� Z$d� Z%d%d�Z&d%d�Z'd%d�Z(d%d�Z) d&d�Z*d'd �Z+dS )(z'Functions to construct sparse matrices
zrestructuredtext en)�spdiags�eye�identity�kron�kronsum�hstack�vstack�bmat�rand�random�diags�
block_diag� N)�partial)�check_random_state�rng_integers� )�upcast�get_index_dtype�isscalarlike)�
csr_hstack)�
csr_matrix)�
csc_matrix)�
bsr_matrix)�
coo_matrix)�
dia_matrix)�issparsec � � |�|�t | d � � x}}n|�|\ }}t | |f||f�� � � |� � S )a�
Return a sparse matrix from diagonals.
Parameters
----------
data : array_like
Matrix diagonals stored row-wise
diags : sequence of int or an int
Diagonals to set:
* k = 0 the main diagonal
* k > 0 the kth upper diagonal
* k < 0 the kth lower diagonal
m, n : int, tuple, optional
Shape of the result. If `n` is None and `m` is a given tuple,
the shape is this tuple. If omitted, the matrix is square and
its shape is len(data[0]).
format : str, optional
Format of the result. By default (format=None) an appropriate sparse
matrix format is returned. This choice is subject to change.
See Also
--------
diags : more convenient form of this function
dia_matrix : the sparse DIAgonal format.
Examples
--------
>>> import numpy as np
>>> from scipy.sparse import spdiags
>>> data = np.array([[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]])
>>> diags = np.array([0, -1, 2])
>>> spdiags(data, diags, 4, 4).toarray()
array([[1, 0, 3, 0],
[1, 2, 0, 4],
[0, 2, 3, 0],
[0, 0, 3, 4]])
Nr ��shape)�lenr �asformat)�datar �m�n�formats �9/usr/lib/python3/dist-packages/scipy/sparse/_construct.pyr r s[ � �P �y�Q�Y��D��G�����A�A�
�����1��t�U�m�A�q�6�2�2�2�;�;�F�C�C�C� c
�� ��� t |� � rMt | � � dk st | d � � rt j | � � g} n6t d� � �t t
t j | � � � � } t j |� � }t | � � t |� � k rt d� � �|�<t | d � � t t |d � � � � z ���f}|�t j | � }|\ ��t ��fd�|D � � � � }t d|� � }t j t |� � |f|�� � }t ��� � }t | � � D ]�\ }} || }
t d|
� � }t �|
z �|
z
|� � }|dk rt d|
|fz � � � | dd|�f |||||z �f<