L i tddlmZmZmZddlmZmZddlmZ ddlm Z m Z m Z ddl mZmZmZmZGddZy) )arraykrondiag)assert_ assert_equal)_spfuncs) csr_matrix csc_matrix bsr_matrix)csr_scale_rowscsr_scale_columnsbsr_scale_rowsbsr_scale_columnsceZdZdZdZdZy)TestSparseFunctionsc tgdgdgdg}t|}tgd}tdd|j|j|j |t |jt||zt|}tgd}tdd|j|j|j |t |j|t|zt|dd gdd gg}t|d }tgd }tddd d |j|j|j |t |jt||zt|d }tgd}tddd d |j|j|j |t |j|t|zt|gdgdg}t|d }tgd }tddd d|j|j|j |t |jt||zt|d }tgd}tddd d|j|j|j |t |j|t|zy)N)rr)rrr)rrr)rrrrr)rrrrrrrr)rr) blocksize)rrrrrr) rrrrrrr )rrr)rr)rrrrrrrrrr )rr r indptrindicesdatartoarrayrr rr rr)selfDSvEs e/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/scipy/sparse/tests/test_spfuncs.pytest_scale_rows_and_colsz,TestSparseFunctions.test_scale_rows_and_cols s ?""$ % qM 'Nq188AIIaffQ7QYY[$q'!), qM + !Aahhqyy:QYY[!DG), QqE1Q%= ! q5 ) - q1Qqxx !&&;QYY[$q'!), q5 ) ( )!Aa!((199QVVA>QYY[!DG), GG$ % q5 ) - q1Qqxx !&&;QYY[$q'!), q5 ) 7 8!Aa!((199QVVA>QYY[!DG),cg}|jddgddgg|jgdgdgdg|jdgdgdgg|Dcgc] }t|}}g}|jdgg|jddgddgg|jddgddgg|jgdgdgdg|Dcgc] }t|}}|D]c}|D]\}t||}tj|\}}t ||j dk\t ||j dk\^eycc}wcc}w)Nrrrrrrrrrrr)rrr)appendrrspfuncsestimate_blocksizershape) r'matsxblksABXrcs r,test_estimate_blocksizez+TestSparseFunctions.test_estimate_blocksize2s? aUAa5M" WWW-. aS!aSM""&'Qa'' aSE aUAa5M" aUAa5M" WWW-."&'Qa'' )A )1I003!QWWQZ(QWWQZ(  ) )((s EEc d}g}|jdgg|jdgg|jddgg|jddgg|jddgddgg|jgdgdgdg|jdgdgdgg|D]m}|D]f}t||}t|}tddD]>}tddD]-}t t j |||f||||f/@hotgdgdgdgddgg}t|}t t j |d||dt t j |d||dy) Nc z|\}}|j\}}ttt||z||zS)N)nonzerolensetzip)r:bsRCIJs r,goldz3TestSparseFunctions.test_count_blocks..goldHs8CAa))+CAas3q!tAqD>*+ +r.rrr0r1r2r)rr)r3rr rangerr4 count_blocksr ) r'rKr7r:r;r<YrGrHs r,test_count_blocksz%TestSparseFunctions.test_count_blocksGs} ,  aSE aSE aUG aUG aUAa5M" WWW-. aS!aSM" WA W1IqMqWA"1QZW$W%9%9!aV%Dd1qRSfoVWW W W '''*QqE7 3 qMW))!V4d1foFW))!V4d1foFr.N)__name__ __module__ __qualname__r-r?rOr.r,rr s%-N)*Gr.rN)numpyrrr numpy.testingrr scipy.sparserr4r r r scipy.sparse._sparsetoolsr r rrrrSr.r,rXs1##/,;;JJWGWGr.