
    Ng O                     P   d dl Z d dlZd dlmZmZmZmZmZm	Z	m
Z
 d dlmZmZmZmZmZmZmZmZmZmZmZ  G d d          Z G d d          Z G d d	          Z G d
 d          Z G d d          Z G d d          Zd Z G d d          Zd Z G d d          Z d Z!dS )    N)assert_assert_equalassert_array_equalassert_almost_equalassert_array_almost_equalassert_raisesassert_raises_regex)mgridogridndenumeratefill_diagonaldiag_indicesdiag_indices_from	index_expndindexr_s_ix_c                       e Zd Zd Zd Zd Zd Zd Zd Zd Z	e
j                            dg d	          d
             Zd ZdS )TestRavelUnravelIndexc                 
	   t          t          j        dd          d           t          t          j        dd          d           t          t                    5  t          j        dd           d d d            n# 1 swxY w Y   t          t                    5  t          j        dd           d d d            n# 1 swxY w Y   t          t                    5  t          j        dd	           d d d            n# 1 swxY w Y   t          t                    5  t          j        dd
           d d d            n# 1 swxY w Y   t          t          j        dd          d           t          t          j        dd          d           t          t          j        dd          d           t          t          t          j        dd           t          t          t          j        dd           t          t          t          j        dd           t          t          t          j        dd           t          t          t          j        dd           t          t          t          j        dd           t          t          t          j        dd           t          t          t          j        dd           t          t          j        dd          g d           t          t          j        g dd          d           t          j        g dg dg          }t          t          j        |d          g d           t          t          j        |dd          g d           t          t          j        |dd           g d!           t          t          j        |d"d#           g d$           t          t          j        d%d&          d'           t          t          j        t          j        g d          d          g dg dg           t          t          j        t          j        g d          dd          g dg dg           t          t          j        d'd&          g d%           d S )(N   )r   r      r   )indicesshape)r   hape)r      )   ^   )ims)dims)r   B   g      ?   )r   )r   r   )r   r&   )r   r   )皙?g        .   )r%         )r   r   r%   )r)   r*   r*   )r%      r   )   r*   )   )   %   Forder)   r.      )r%   r*   clipmode)r-         r%   r%   )r5   wrap)   r4   r4   )r)   r   r%   r   )r*   r,      	   iU  )r   npunravel_indexr   	TypeErrorravel_multi_index
ValueErrorarray)selfarrs     ]/var/www/html/ai-engine/env/lib/python3.11/site-packages/numpy/lib/tests/test_index_tricks.py
test_basicz TestRavelUnravelIndex.test_basic   s/   R%a00&999 	R%a,24 4 4&,	. 	. 	. 9%% 	5 	5QV4444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 9%% 	- 	-QV,,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 9%% 	0 	0Sh////	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 9%% 	1 	1Sx0000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	R)&&991===R%c844g>>>R)'8<<cBBBj""2B???i!13???j""2Av>>>j""6HHHj""6GGGj""6HHHj""6GGGi!5y&IIIR%oyAA999MMM I66	I 	I 	I h			999-..R)#v66EEE fC888,,,	H 	H 	H f6:::LLL	J 	J 	JR)#v<LMMM!\\	# 	# 	#R),EEtLLLR%bh|||&<&<fEEii+	- 	- 	-RXlll33V3GGGYY			"	$ 	$ 	$ 	R%dL99<<<HHHHHsH   A??BBCCC DD
D"EE	E	c           	         d}d}t          t          |t          j        g d           t          t          |t          j        dd           t          t          |t          j        t          j        g           d           t          t          j        t          j        g t                    d          g g g g           t          t          |t          j        g g fd           t          t          |t          j        g dgfd           t          t          |t          j        t          j        g           t          j        g           fd           t          t          j        t          j        g t                    t          j        g t                    fd          g            t          t          j        t          j        g g gt                    d          g            d S )	Nz9indices must be integral: the provided empty sequence waszonly int indices permitted)
   r)   r+    dtyperJ   r)   abc)r+   r)   )r	   rA   r?   r@   rD   r   intrB   )rE   msg1msg2s      rG   test_empty_indicesz(TestRavelUnravelIndex.test_empty_indicesF   s   J+ItR-=r:NNNItR-=r:NNNItR-=rx||&	( 	( 	(R%bhr&<&<&<jII"b\	# 	# 	#ItR-AB8#	% 	% 	%ItR-AB=#	% 	% 	%ItR-AXb\\28B<<0&	: 	: 	:R)"C((("(2S*A*A*ABFL LMO	Q 	Q 	QR)"(B83*G*G*G  	" 	" 	" 	" 	"    c                    t           j        t           j        k    r<ddgddgddgddgdd	gddgd
dgf}t          t          j        |d          ddg           t          t          t           j        dd           d
gd
gf}t          j        t           j                  j	        dz  }t          t          j        ||df          d
g           t          t          t           j        ||dz   df           t          t          j        ||dfd          d
g           t          t          t           j        ||dz   dfd           d S )Nr      r)   r+   u   r9   r   iK	  i  r   )r.   r,   x   $   i
  r=   r*   l   z l   nm )l    l       r0   r1   )
r?   intpint64r   rB   r   rC   r@   iinfomax)rE   rF   	dummy_arrhalf_maxs       rG   test_big_indicesz&TestRavelUnravelIndex.test_big_indicesZ   ss   7bhr7QFQHr1g$<!Q!Q1C$S*FGG\*, , ,
 	j""2A7IJJJ S!I	8BG$$(A- XqM::QC	A 	A 	Aj )hqj!_	> 	> 	> XqMEEEs	L 	L 	Lj )hqj!_C	I 	I 	I 	I 	I 	IrT   c           	      &   t           j        t           j        t           j        t           j        t           j        t           j        fD ]}t          j        g dg dg|          }d}d|d         z  |d         z   }t          t          j	        ||          |           t          |t          j
        ||                     |d         d|d         z  z   }t          t          j	        ||d	
          |           t          |t          j
        ||d	
                     t          j        g dg dg dg|          }d}dd|d         z  |d         z   z  |d         z   }t          t          j	        ||          |           t          |t          j
        ||                     |d         d|d         d|d         z  z   z  z   }t          t          j	        ||d	
          |           t          |t          j
        ||d	
                     d S )N)r   r   r   r   r)   r%   )r   r*   r   r)   r   r   rL   )r+   r=   r=   r   r   r+   r0   r1   )r   r)   r   r   r>   r+   )r+   r=   rJ   rJ   r   )r?   int16uint16int32uint32r[   uint64rD   r   rB   r@   )rE   rM   coordsr   uncoordss        rG   test_dtypesz!TestRavelUnravelIndex.test_dtypesr   s5   h	28i296 	O 	OEX###%7%7%78G G GFE{6!9,H-fe<<hGGG!1(E!B!BCCCay6!9,H$VU#>>>J J J!1(E!M!M!MNNNX###%7%7%79K9K9KL  F E1VAY;vay01&);H-fe<<hGGG!1(E!B!BCCCayF1Iaq	k$9!::H$VU#>>>J J J!1(E!M!M!MNNNN/	O 	OrT   c                 <   t          t          j        g ddd          t          j        g dd                     t          t          j        g ddd          t          j        g dd                     t          t          t          j        g dd           d S )N)r+   r   r$   r   )r%   r)   r,   r<   r;   r6   )r   r   r*   r   )r;   raiser5   rk   )r   r   r   r   )r   r?   rB   r   rC   rE   s    rG   test_clipmodesz$TestRavelUnravelIndex.test_clipmodes   s     FKKK }==	? 	? 	? 	R)---0PQ Q Q ),,,FF	H 	H 	H 	,mmm]	L 	L 	L 	L 	LrT   c                     t          j        g dd          \  }}t          |j        j                   t          |j        j                   d S )Nr   r   r)   )r%   r+   )r?   r@   r   flags	writeable)rE   xys      rG   test_writeabilityz'TestRavelUnravelIndex.test_writeability   sH    			6221!"""!"""""rT   c                     t          j        dd          }t          |d           t          t          dt           j        dgd           t          t          dt           j        dgd           d S )Nr   rK   z0d arrayzout of boundsr   )r?   r@   r   r	   rC   rE   rr   s     rG   test_0dzTestRavelUnravelIndex.test_0d   sp    Q##QJ
B4Dqc2NNN)9A3	D 	D 	D 	D 	DrT   r7   )r5   r;   rk   c                 N   t          j        t          j        dt           j                  d|          }|j        dk    sJ t          t                    5  t          j        t          j        dt           j                  d|           d d d            d S # 1 swxY w Y   d S )N)r)   r   rL   r   r   r   r6   r   )r)   r   )r?   rB   zerosrZ   r   r   rC   )rE   r7   ress      rG   test_empty_array_ravelz,TestRavelUnravelIndex.test_empty_array_ravel   s   "HV27333YTK K KyD    :&& 	K 	K HV27333YTK K K K	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	Ks   6BB!Bc                 R   t          j        t          j        dt           j                  d          }t	          |          dk    sJ t          d |D                       sJ t          t                    5  t          j        dgd           d d d            d S # 1 swxY w Y   d S )Nr   rL   ry   r)   c              3   ,   K   | ]}|j         d k    V  dS )rz   N)r   ).0as     rG   	<genexpr>zATestRavelUnravelIndex.test_empty_array_unravel.<locals>.<genexpr>   s(      00q17d?000000rT   r   )r?   r@   r{   rZ   lenallr   rC   )rE   r|   s     rG   test_empty_array_unravelz.TestRavelUnravelIndex.test_empty_array_unravel   s    rx9999EE3xx1}}}}00C00000111:&& 	- 	-aS),,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-s   8BB #B N)__name__
__module____qualname__rH   rS   r`   ri   rm   rt   rw   pytestmarkparametrizer}   r   rK   rT   rG   r   r      s        5I 5I 5In" " "(I I I0O O O6
L 
L 
L# # #D D D [V%>%>%>??K K @?K- - - - -rT   r   c                       e Zd Zd Zd Zd Zd Zej        	                    dddg          d             Z
d	 Zd
 Zd ZdS )TestGridc                    t           ddd         }t           ddd         }t          |j        dk               t          |j        dk               t          |d         dk               t          |d         d           t          |d         dk               t          |d         |d         z
  dd           t          |d         |d         d	z   d           t          |d         |d         z
  d
d           d S )Nr$   r                 $@r'   )rJ   )   r      ggfffff?gqq?)r
   r   r   r   )rE   r   bs      rG   rH   zTestGrid.test_basic   s    "Qs(O"Qs(O5 !!!5 !!!!
AbE1%%%!
AaD1IsB///AbE1Q4;333AaD1Iw33333rT   c                     t          j        ddd          \  }}t          |d           t          |t          ddd         d           d S )Nr   rJ   T)retstepg9/?y              I@r4   )r?   linspacer   r   r
   )rE   rs   sts      rG   test_linspace_equivalencez"TestGrid.test_linspace_equivalence   sN    Ar40002B'''!!U1R8_b99999rT   c                 d   t           ddddddf         }t           ddddddf         }t          |j        dk               t          |j        d	k               t          |d
         d
d d f         t	          j        dd                      t          |d         d d d
f         dt	          j        dd          z             t          |d
         dd d f         t	          j        dd          d           t          |d         d d df         dt	          j        dd          z  d           t          |d
dd d f         |d
d
d d f         z
  dt	          j        dd          z  d           t          |dd d df         |dd d d
f         z
  dt	          j        dd          z  d           d S )Nr$   r   r   r   r'   g?)r   rJ   rJ   )r   r   r   r   rJ   dr   r   )r
   r   r   r   r?   onesr   )rE   cr   s      rG   test_ndzTestGrid.test_nd   s   "Qs(BqH$%"Qs(BqH$%;&''';&'''1Q4111:C(8(8'89991Q41:r"'"c*:*:':;;;!!A$r111u+rwr3/?/?DDD!!A$qqq"u+qS1A1A/A2FFF!!Aq!!!G*qAqqqz"9"%bgb#&6&6"6	< 	< 	<!!Aqqq!G*qAAAqz"9"%bgb#&6&6"6	< 	< 	< 	< 	<rT   c                     t           ddddddf         }t          ddddddf         }t          j        | }t	          ||          D ]\  }}t          ||           d S )Nr$   r   r   r   r   )r
   r   r?   broadcast_arrayszipr   )rE   	grid_fullgrid_sparsegrid_broadcastfr   s         rG   test_sparsezTestGrid.test_sparse   s    BqHb3h./	BqHb3h./ ,k:	>22 	 	DAqA	 	rT   zstart, stop, step, expected)NrJ   r   )   rJ   )ir   N)i     c                     t           ||||||f         }t           |||         }t          |j        |d                    t          |j        |d                    d S )Nr   r   )r
   r   size)rE   startstopstepexpectedgrid
grid_smalls          rG   test_mgrid_size_none_handlingz&TestGrid.test_mgrid_size_none_handling   sc     U4_eDo56 5d?+
TY,,,Z_hqk22222rT   c                 *   t           dddf         }t           t          j        d          t          j        d          t          j        d          f         }t          |j        t          j        k               t          ||           t           ddd         }t           t          j        d          t          j        d          t          j        d                   }t          |j        t          j        k               t          ||           d S )Nr'   Q?)r
   r?   float32r   rM   float64r   )rE   grid64grid32s      rG   test_accepts_npfloatingz TestGrid.test_accepts_npfloating   s    s4|}&rz#rz$'7'7
3GHJ
*+++!&&111 s4|$rz#rz$'7'7
3GH
*+++!&&11111rT   c                 B   t           dddf         }t           t          j        d          t          j        d          t          j        d          f         }t          |j        t          j        k               t          ||           t           dt          j        d          d         }t           dt          j        d          df         }t          |j        |j        cxk    ot          j        k    nc            t          ||d                    t           ddd         }t           t          j        d          t          j        d          t          j        d                   }t          |j        t          j        k               t          ||           d S )Nr'   r   r   r   y        333333@)r
   r?   
longdoubler   rM   r   r   )rE   r   grid128
grid128c_a
grid128c_bs        rG   test_accepts_longdoublez TestGrid.test_accepts_longdouble  sd   s4|}&M#r}T222=3E3EEF
 	.///!&'2221R]1--d23
1R]1--d235

 J$4EEEEEEEEFFF:z!}555 s4|$M#r}T222=3E3EE
 	.///!&'22222rT   c           	         t          t          dddf         t          ddt          j        d          f                    t          t          ddd         t          ddt          j        d                              t          ddd         }t          dddf         d         }t	          |j        |j        cxk    ot          j        k    nc            t          ||           t          ddt          j        d                   }t          ddt          j        d          f         d         }t	          |j        |j        cxk    ot          j	        k    nc            t          ||           d S )Nr'   g333333?y              @y        ffffff
@r   )
r   r
   r?   	complex64r   rM   r   r   clongdoubler   )rE   grid64_agrid64_b	grid128_a	grid128_bs        rG   test_accepts_npcomplexfloatingz'TestGrid.test_accepts_npcomplexfloating  sf   !#c"*+s3r|B/?/?'?'@!B	
 	
 	

 	"#c"*uSR\"-=-=%=>	
 	
 	

 S&S(+(.>>>>BJ>>>>???8X...#c"."6"667	#c"."6"6679!<		9?CCCCbmCCCCDDD8X.....rT   N)r   r   r   rH   r   r   r   r   r   r   r   r   r   r   rK   rT   rG   r   r      s        
4 
4 
4: : :
< < <   [:"#=
  
3 
3	 
32 2 23 3 3,/ / / / /rT   r   c                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )TestConcatenatorc                     t          t          d         t          j        g d                     t          j        d          }t          |dd|f         }t          |g d           d S )N)r   r   r)   r%   r+   r*   r+   r   )r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r?   rD   r   )rE   r   r   s      rG   test_1dzTestConcatenator.test_1d/  sd    2./:L:L:L1M1MNNNGAJJq!QzN1BBBCCCCCrT   c                 X    t           dddf         }t          |j        dk               d S )Ng333333$@r   rJ   f8)r   r   rM   rE   gs     rG   test_mixed_typez TestConcatenator.test_mixed_type5  s-    tQrTzN4     rT   c                     t           dt          j        dg          t          j        g d          df         }t          |j        dk               d S )Ng333333$r   )r   r)   r%   g      $@r   )r   r?   rD   r   rM   r   s     rG   test_more_mixed_typez%TestConcatenator.test_more_mixed_type9  sG    ubhsmmRXiii%8%8$>?4     rT   c                     t           ddd         }t          |j        dk               t           ddt          j        d                   }t          |j        dk               d S )Nr   rY   y              Y@)d   )r   r   r   r?   r   r   s     rG   test_complex_stepz"TestConcatenator.test_complex_step=  s^    qDyM6!""" qBL&&&'6!"""""rT   c                    t           j                            dd          }t           j                            dd          }t          d||f         }t	          |j        dk               t          |d d d df         |           t          |d d dd f         |           t          ||f         }t	          |j        dk               t          |d dd d f         |           t          |dd d d f         |           d S )Nr+   1)r+   rJ   )rJ   r+   )r?   randomrandr   r   r   r   )rE   r   r   r   s       rG   test_2dzTestConcatenator.test_2dF  s    INN1a  INN1a  sAqyM7"###1QQQU8Q'''1QQQU8Q'''q!tH7"###1RaRU8Q'''1QRRU8Q'''''rT   c                 6   t          t          dt          j        d          df         g d           t          t          g dt          j        d          f         g d           t          t          t          j        d          g df         g d           d S )Nr   r   r   r   r   r   r)   )r   r   r   r)   ro   )r   r   r?   rD   rl   s    rG   rw   zTestConcatenator.test_0dR  s    R28A;;)*III666R			28A;;./>>>RYYY./>>>>>rT   N)	r   r   r   r   r   r   r   r   rw   rK   rT   rG   r   r   .  sq        D D D! ! !! ! !# # #
( 
( 
(? ? ? ? ?rT   r   c                       e Zd Zd ZdS )TestNdenumeratec                     t          j        ddgddgg          }t          t          t	          |                    g d           d S )Nr   r   r)   r%   )))r   r   r   ))r   r   r   )r   r)   ))r   r   r%   )r?   rD   r   listr   rE   r   s     rG   rH   zTestNdenumerate.test_basicY  sX    Hq!fq!f%&&T+a..))III	K 	K 	K 	K 	KrT   N)r   r   r   rH   rK   rT   rG   r   r   X  s(        K K K K KrT   r   c                       e Zd Zd Zd ZdS )TestIndexExpressionc                     t          j        d          }t          |d d         |t          d d                             t          |d d         |t          d d                             d S )Nr   r$   )r?   aranger   r   r   r   s     rG   test_regression_1z%TestIndexExpression.test_regression_1`  s^    IaLLQssVQr#2#wZ(((QssVQy"~./////rT   c           	      ,   t           j                            ddd          }t          |d d d dddgf         |t          d d d dddgf                             t          |d d d dddgf         |t
          d d d dddgf                             d S )Nr%   r+   r*   r)   r   r   )r?   r   r   r   r   r   r   s     rG   test_simple_1z!TestIndexExpression.test_simple_1f  s    INN1a##Qqqq"1"q!f}%q111bqb1a&=)A'BCCCQqqq"1"q!f}%qAAArrAq6M):';<<<<<rT   N)r   r   r   r   r   rK   rT   rG   r   r   _  s2        0 0 0= = = = =rT   r   c                   ,    e Zd Zd Zd Zd Zd Zd ZdS )TestIx_c                    t          j        t          d                    \  }t          |j        t           j                   t          j        g           \  }t          |j        t           j                   t          j        t          j        g t           j                            \  }t          |j        t           j                   d S )Nr   rL   )r?   r   ranger   rM   rZ   rD   r   r   s     rG   r   zTestIx_.test_regression_1n  s    VE!HHQWbg&&&VBZZQWbg&&& VBHRrz22233QWbj)))))rT   c           
         d}t           t          j        fD ]Ȋt          j        fd|D              }t	          t          ||                    D ]\  \  }}t          |j                 |           t          t          fdt	          |j                  D                                  t          t          j
        |j        t          j                             d S )N)r%   r+   r)   r   c                 &    g | ]} |          S rK   rK   )r   szfuncs     rG   
<listcomp>z0TestIx_.test_shape_and_dtype.<locals>.<listcomp>~  s!    7772dd2hh777rT   c              3   6   K   | ]\  }}|k    |d k    V  dS )r   NrK   )r   jshks      rG   r   z/TestIx_.test_shape_and_dtype.<locals>.<genexpr>  s/      NN2qAvvB!GvvvvNNrT   )r   r?   r   r   	enumerater   r   r   r   r   
issubdtyperM   integer)rE   sizesarraysr   r   r   r   s        @@rG   test_shape_and_dtypezTestIx_.test_shape_and_dtypez  s    BI& 	< 	<DV77777778F'FE(:(:;; < <
7ArQWQZ,,,NNNN171C1CNNNNNOOOagrz::;;;;<	< 	<rT   c                     g d}t          j        |          \  }t          t          j        |          d         |           d S )N)TFTTr   )r?   nonzeror   r   )rE   bool_aint_as      rG   	test_boolzTestIx_.test_bool  sA    ***F##RVF^^A&.....rT   c                 V    g dg dg}t          t          t          j        |           d S )Nro   r%   r+   r*   )r   rC   r?   r   )rE   idx2ds     rG   test_1d_onlyzTestIx_.test_1d_only  s.    III&j"&%00000rT   c                     d}t          j        |          }t          ||          }t          |d         j        |df           t          |d         j        d|f           t          |j        |f           d S )Nr+   r   r   )r?   r   r   r   r   )rE   length_of_vectorrr   outs       rG   test_repeated_inputzTestIx_.test_repeated_input  sy    I&''!QiiSV\$4a#8999SV\A'7#8999QW/122222rT   N)r   r   r   r   r   r   r  r  rK   rT   rG   r   r   m  s_        
* 
* 
*< < </ / /
1 1 13 3 3 3 3rT   r   c                      t           j        t          j        g dg          ddt          j        g dg          f         } t          | g dg           d S )Nro   r   r   )r   r   r)   r   r   r%   r+   r*   )r?   c_rD   r   )r   s    rG   test_c_r	    sW    
bh			{##Q28YYYK+@+@@AA---./////rT   c                   8    e Zd Zd Zd Zd Zd Zd Zd Zd Z	dS )	TestFillDiagonalc           	          t          j        dt                    }t          |d           t	          |t          j        g dg dg dg                     d S )N)r)   r)   r+   r+   r   r   r   r+   r   r   r   r+   r?   r{   rP   r   r   rD   r   s     rG   rH   zTestFillDiagonal.test_basic  si    HVS!!arx""$ % %	 	 	 	 	rT   c                     t          j        dt                    }t          |d           t	          |t          j        g dg dg dg dg dg dg dg dg dg dg
                     d S )NrN   r+   r  r  r  r   r   r   r  r   s     rG   test_tall_matrixz!TestFillDiagonal.test_tall_matrix  s    HWc""arx"""""""""	$ 	% 	%	 	 	 	 	rT   c                     t          j        dt                    }t          |dd           t	          |t          j        g dg dg dg dg dg dg dg dg dg dg
                     d S )NrN   r+   Tr  r  r  r  r  r   s     rG   test_tall_matrix_wrapz&TestFillDiagonal.test_tall_matrix_wrap  s    HWc""aD!!!rx"""""""""	$ 	% 	%	 	 	 	 	rT   c           	          t          j        dt                    }t          |d           t	          |t          j        g dg dg dg                     d S )N)r)   rJ   r+   )
r+   r   r   r   r   r   r   r   r   r   )
r   r+   r   r   r   r   r   r   r   r   )
r   r   r+   r   r   r   r   r   r   r   r  r   s     rG   test_wide_matrixz!TestFillDiagonal.test_wide_matrix  sp    HWc""arx7777777779 : :	 	 	 	 	rT   c                     t          j        dt                    }t          |d           t          j        g d          }t          t          j        |dk              ||||f           d S )N)r)   r)   r)   r)   r%   r   r   )r?   r{   rP   r   rD   r   where)rE   r   is      rG   test_operate_4d_arrayz&TestFillDiagonal.test_operate_4d_array  sb    H\3''aHYYYRXa1f%%1a|44444rT   c                     t          j        dt                    }t          t          d          5  t          |d           d d d            d S # 1 swxY w Y   d S )Nr)   at least 2-dr+   r?   r{   rP   r	   rC   r   r   s     rG   test_low_dim_handlingz&TestFillDiagonal.test_low_dim_handling  s    HQ ^<< 	  	 !Q	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	    AAAc                     t          j        dt                    }t          t          d          5  t          |d           d d d            d S # 1 swxY w Y   d S )N)r)   r)   r,   r)   equal lengthr   r  r   s     rG   test_hetero_shape_handlingz+TestFillDiagonal.test_hetero_shape_handling  s     HY$$ ^<< 	  	 !Q	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 r   N)
r   r   r   rH   r  r  r  r  r  r#  rK   rT   rG   r  r    s}                  5 5 5              rT   r  c            
         t          d          } t          j        g dg dg dg dg          }d|| <   t          |t          j        g dg dg d	g d
g                     t          dd          }t          j        dt
                    }d||<   t          |t          j        ddgddggddgddggg                     d S )Nr%   )r   r   r)   r%   )r+   r*   r,   r=   )r>   rJ   r   r<   )r4            r   )r   r   r)   r%   )r+   r   r,   r=   )r>   rJ   r   r<   )r4   r%  r&  r   r   r)   )r   r   r   r   r   )r   r?   rD   r   r{   rP   )dir   d3s      rG   test_diag_indicesr*    s   	aB
,,,,,!//"""$ 	% 	%A AbE	28^^^#^^%%%&&&( ) )
 
 
 
a		B 	C  AAbE	28q!f!f!f!f    
 
 
 
 
rT   c                        e Zd Zd Zd Zd ZdS )TestDiagIndicesFromc                     t           j                            d          }t          |          \  }}t          |t          j        d                     t          |t          j        d                     d S )Nr:   r%   )r?   r   r   r   r   )rE   rr   rr   s       rG   test_diag_indices_fromz*TestDiagIndicesFrom.test_diag_indices_from  s^    IV$$ ##11bill+++1bill+++++rT   c                     t          j        d          }t          t          d          5  t	          |           d d d            d S # 1 swxY w Y   d S )Nr,   r  )r?   r   r	   rC   r   rv   s     rG   test_error_small_inputz*TestDiagIndicesFrom.test_error_small_input  s    GAJJ ^<< 	! 	!a   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!s   AAAc                     t          j        dt                    }t          t          d          5  t          |           d d d            d S # 1 swxY w Y   d S )N)r)   r)   r   r)   r"  )r?   r{   rP   r	   rC   r   rv   s     rG   test_error_shape_mismatchz-TestDiagIndicesFrom.test_error_shape_mismatch  s    H\3'' ^<< 	! 	!a   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!s   AAAN)r   r   r   r/  r1  r3  rK   rT   rG   r,  r,    sA        , , ,! ! !
! ! ! ! !rT   r,  c                     t          t          ddd                    } d t          t          j        d                    D             }t          | |           t          t          d                    } t          | |           t          t          d                    } t          | t          t          d                               t          t                                } t          | dg           t          t          d                    } t          | dg           t          t          dg           } t          | g            d S )	Nr   r   r)   c                     g | ]\  }}|S rK   rK   )r   ixes      rG   r   z test_ndindex.<locals>.<listcomp>  s    AAAur1AAArT   ro   )r)   rK   r   )r   r   r   r?   r{   r   r   )rr   r   s     rG   test_ndindexr8    s   WQ1AAABHY,?,? @ @AAAHq(###WY  Aq(### 	WT]]Aq$wqzz**+++ 	WYYARDWR[[ARD 	Wqc]ABrT   )"r   numpyr?   numpy.testingr   r   r   r   r   r   r	   numpy.lib.index_tricksr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r	  r  r*  r,  r8  rK   rT   rG   <module>r<     s                                                 k- k- k- k- k- k- k- k-Zp/ p/ p/ p/ p/ p/ p/ p/f'? '? '? '? '? '? '? '?TK K K K K K K K= = = = = = = ='3 '3 '3 '3 '3 '3 '3 '3T0 0 0
D  D  D  D  D  D  D  D N
 
 
8! ! ! ! ! ! ! !&    rT   