
    qKgE                       d Z ddlZddlZddlZddlZddlZddlZ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mZ ddlmZ ddlmZ ddlmZmZmZmZ ddlmZ ddlmZmZmZmZm Z  dd	l!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- 	 ddl.Zd Z0e(Z1ddZ(d Z2d Z3d Z4h dZ5 G d d      Z6d Z7e	jp                  js                  d       g Z:e: e7d e6d e
ddgddgge       e
ddge             e6d e
ddgddgge       e
ddge             e6d e
ddgddgge       e
g dg dge             e6d  e
d!d"gd#d$gge       e
d%d!ge             e6d& e
d!d"gd#d$gge       e
d%d!ge             e6d' e
d!d"gd#d$gge       e
g d(g d)ge             e6d* e	jv                  d+e       e	jv                  d,e      d-h.       e6d/e	jp                  jy                  d0d0      e	jp                  jy                  d0             e6d1e	jp                  jy                  d2d2      e	jp                  jy                  d2             e6d3d2d4gd5d6ggd4d2g      g
      z  Z:e: e7d7 e6d8 e
g d9g dge       e
ddge             e6d: e
ddgddgd;d<gge       e
g d=e             e6d> e
g d9g dge       e
ddge             e6d? e
ddgddgd;d<gge       e
g d=e             e6d@ e
g dAg dBge       e
d%d!ge             e6dC e
dDdEgdFdGgdHdIgge       e
g dJe             e6dK e
g dAg dBge       e
d%d!ge             e6dL e
dDdEgdFdGgdHdIgge       e
g dJe             e6dM e
g dAg dBge       e
d%d!gdNdOgge             e6dP e
dDdEgdFdGgdHdIgge       e
d%d!gdNdOgdNdOgge             e6dQe	jp                  jy                  d0dR      e	jp                  jy                  d0             e6dSe	jp                  jy                  d2dT      e	jp                  jy                  d2             e6dUe	jp                  jy                  dTd2      e	jp                  jy                  dT             e6dVe	jp                  jy                  dd6      e	jp                  jy                  d      d-h.       e6dWe	jp                  jy                  d6d      e	jp                  jy                  d6      d-h.      g      z  Z:e: e7dX e6dY e
ddgddgge      d       e6dZ e
ddgddgge      d       e6d[ e
dd"gd\d2gge      d       e6d] e
dd"gd\d2gge      d       e6d^ e	jv                  d+e      dd-h.       e6d_d2d4gd4d2ggd       e6d` e
ddgddgg      d       e6dae	jp                  jy                  d2d2      d      g      z  Z:db Z=e: e=       z  Z:dc Z>dd Z?e: e?       z  Z: G de df      Z@ G dg dhe@      ZA G di dje@      ZB G dk dle@      ZC G dm dne@      ZD G do dpe@      ZE G dq dre@      ZFds ZG G dt dueAeD      ZH G dv dweH      ZI G dx dyeAeD      ZJ G dz d{eJ      ZK G d| d}eAeD      ZL G d~ deL      ZM G d deAeD      ZN G d deN      ZO G d d      ZP G d deAeD      ZQ G d deQeP      ZR G d deCeF      ZS G d deSeP      ZT G d deAeD      ZU G d deU      ZV G d deAeBeDeE      ZW G d deW      ZX G d deCeF      ZY G d deY      ZZd Z[ G d deAeD      Z\ G d de\      Z] G d deAeB      Z^ G d de^      Z_ej                  j                  ddD  cg c]  } e	j                  |        c}        G d d             Zc G d deCeF      Zd G d d      Ze G d deCeF      Zf G d d      Zg G d d      Zh G d deh      Zi G d deh      Zj G d dejei      Zk G d d      Zl G d deh      Zm G d deh      Zn G d deh      Zo G d dekem      Zp G d deken      Zq G dÄ dekeo      Zr G dń dƫ      ZsdǄ Zt G dȄ dɫ      Zu G dʄ d˫      Zv G d̄ dͫ      Zwd΄ Zxej                  j                  e-dϬЫ      dф        Zzd҄ Z{ej                  j                  e-dӬЫ      ej                  j                  dԄ               Z} G dՄ d֫      Z~ G dׄ dث      Z G dل dګ      Zdۄ Zej                  j                  dܬЫ      d݄        Zej                  j	                  e, dެЫ      d߄        Zd Zd Zd Zd Zd Zd Zd Zd Zy# e/$ r Y w xY wc c} w )z# Test functions for linalg module

    N)arraysingledoublecsinglecdoubledotidentitymatmul)swapaxes)	AxisError)multiply
atleast_2dinfasarray)linalg)matrix_powernormmatrix_rank	multi_dotLinAlgError)_multi_dot_matrix_chain_order)
assert_assert_equalassert_raisesassert_array_equalassert_almost_equalassert_allclosesuppress_warningsassert_raises_regexHAS_LAPACK64IS_WASMc                     t        |       t        |t        j                        rt        |      u S t        j                  u S N)type
isinstancenpndarray)outin_s     b/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numpy/linalg/tests/test_linalg.pyconsistent_subclassr+   "   s9     9jbjj&Ac * * jj* *    c                     t        |       j                  j                  t        t        fv r|}n|}t        | |fd|i| y )Ndecimal)r   dtyper$   r   r   old_assert_almost_equal)absingle_decimaldouble_decimalkwr.   s         r*   r   r   ,   s=    qz 11  Aq8'8R8r,   c                 \    t         t         t        t        t        t         t        t        i|    S r#   )r   r   r   r   r/   s    r*   get_real_dtyper8   4   s&    FFFVWf..35 5r,   c                 \    t         t        t        t        t        t        t        t        i|    S r#   )r   r   r   r   r7   s    r*   get_complex_dtyper:   9   s&    GVWWgw0057 7r,   c                 "    | t         t        fv ryy)Ngh㈵>gdy=)r   r   r7   s    r*   get_rtolr<   >   s    !!r,   >   squarestrided	hermitian	nonsquaregeneralizedsize-0c                   ,    e Zd Z e       fdZd Zd Zy)
LinalgCasec                     t        t        |t                     || _        || _        || _        t        |      | _        y)z
        A bundle of arguments to be passed to a test case, with an identifying
        name, the operands a and b, and a set of tags to filter the tests
        N)r   r%   strnamer1   r2   	frozensettags)selfrG   r1   r2   rI   s        r*   __init__zLinalgCase.__init__N   s3    
 	
4%&	dO	r,   c                 V     || j                   | j                  | j                         y)zN
        Run the function `do` on this test case, expanding arguments
        rI   N)r1   r2   rI   )rJ   dos     r*   checkzLinalgCase.checkY   s     	466466		*r,   c                 "    d| j                    dS )Nz<LinalgCase: >)rG   rJ   s    r*   __repr__zLinalgCase.__repr___   s    tyyk++r,   N)__name__
__module____qualname__setrK   rO   rS    r,   r*   rD   rD   M   s    (+ 	$+,r,   rD   c                 \    | t         v sJ d       |D ]  }|j                  | hz  |_         |S )z^
    Add the given tag (a string) to each of the cases (a list of LinalgCase
    objects)
    zInvalid tag)all_tagsrI   )tagcasescases      r*   	apply_tagr^   c   s6    
 (?)M)?II%	 Lr,     r=   r         ?       @      @      @r7   r   double_2)ra   r`   rc   )rb   rc         @r         ?       @y       @      @y      @      @y      @      @       @      ?r   	cdouble_2)rg   rf   y      ?      @)y      ?       y      ?      y      ?      0x0r   r   r   rB   rM   8x8   1x1   nonarray         r@   single_nsq_1)r`   ra   rb   single_nsq_2g      @re   )ra   r`   rb   double_nsq_1double_nsq_2csingle_nsq_1)      ?      ?       @       @      @      )y      @      y      @      "@y      @       @csingle_nsq_2ry   rz   r{   y      @      "y      @      y      @       @)rg   rf   r{   cdouble_nsq_1cdouble_nsq_2cdouble_nsq_1_2y      ?      y       @       cdouble_nsq_2_28x11   1x5   5x10x44x0r?   hsinglehdoublehcsingley       @      hcdoublehempty	hnonarraymatrix_b_onlyhmatrix_1x1c                     g } t         D ]k  }t        |j                  t        j                        s)t        j
                  |j                  d|j                  z  d|j                  z  g      }|j                  d }nb|j                  j                  dk(  r|j                  }n<t        j
                  |j                  d|j                  z  d|j                  z  g      }t        |j                  dz   |||j                  dhz        }| j                  |       t        j
                  |j                  gdz  dz        j                  d	|j                  j                  z         }|j                  d }n|j                  j                  dk(  r`t        j
                  |j                  gdz  dz  |j                  d
   z        j                  d	|j                  j                  dd  z         }nLt        j
                  |j                  gdz  dz        j                  d	|j                  j                  z         }t        |j                  dz   |||j                  dhz        }| j                  |       n | S )Nrq   rr   ro         _tile3rA   rM   rr   rq   _tile213)CASESr%   r1   r&   r'   r   r2   ndimrD   rG   rI   appendreshapeshape)	new_casesr]   r1   r2   new_cases        r*   _make_generalized_casesr      s   I$&&"**-HHdffa$&&j!dff*5666>AVV[[AA$&&!dff*a$&&j9:Adii(2Aq#'99#>@"HHdffX\A%&..v/DE66>AVV[[A$&&A)AGGBK7876DFFLL$556  $&&A)*226DFFLL3HIAdii*4a#'99#>@"3 6 r,   c              #     K   t        | t        j                        s| df ydg| j                  z  }d|d<   | j                  dkD  rd|d<   | j                  dkD  rd	|d
<   t	        j
                  t        |       D ]f  }t        | j                  |      D cg c]  \  }}t        ||z         }}}t        |D cg c]  }t        dd|       c}      }t        j                  || j                        }|j                  t        j                        j                  d       ||   }| |d<   |j                  | j                         }t#        t        j$                  || k(               |ddj'                  |D 	cg c]  }	d|	z  	 c}	      z   f | j                  dk\  r]| j                  d   dk(  rKt)        | j*                        }
d|
d<   t        j,                  j.                  j1                  | |
      }|df | j                  dk\  r]| j                  d   dk(  rKt)        | j*                        }
d|
d<   t        j,                  j.                  j1                  | |
      }|df | j                  dk\  s| j                  dd dk(  st)        | j*                        }
d|
d<   d|
d<   t        j,                  j.                  j1                  | |
      }|df i yc c}}w c c}w c c}	w w)z<
    Generate cartesian product of strides for all axes
    nopNro   )ro   rr   r   ro   r   rq   )ro   r   r7   l   >[= .stride__z%+dr   )stridesstride_xxx_0stride_xxx_0_xro   ro   stride_xxx_0_0)r%   r&   r'   r   	itertoolsproducttuplezipr   abssliceemptyr/   viewuint32fill	__class__r   alljoinlistr   libstride_tricks
as_strided)x
stride_setrepeatsr1   r2   	new_shaperepeatslicesxijss              r*   _stride_comb_iterr     s    
 a$h!&&JJrNvvz#
2vvz 
2$$eJ&78,/,AB,ADAqSQZ,A	BHfdD&1HI XXiqww/
		
+Z3WWQ[[!rQw )chh7'C7a	7'CDDDD 66Q;1772;!+QYYAAbE%%00A0>Bn$$66Q;1772;!+QYYAAbE%%00A0>B&&&66Q;1773B<61QYYAAbEAbE%%00A0>B&&&; 9BH (Ds9   BK7K'1K7=K-
B-K7>K2
C3K7?K7A$K7c            
         g } t         D ]  }t        |j                        D ]f  \  }}t        |j                        D ]I  \  }}t	        |j
                  dz   |z   dz   |z   |||j                  dhz        }| j                  |       K h  | S )Nr   r>   rM   )r   r   r1   r2   rD   rG   rI   r   )r   r]   r1   a_labelr2   b_labelr   s          r*   _make_strided_casesr   J  s    I+DFF3JAw/7
7%dii#o&?#&E&OQRTU+/99	{+BD  * 8 4  r,   c                   0    e Zd ZeZ e        e       fdZy)LinalgTestCasec                    | j                   D ]A  }|j                  |z  |k7  r|j                  |z  r&	 |j                  | j                         C y# t        $ r.}d|d}|t        j                         z  }t        |      |d}~ww xY w)zx
        Run func on each of the cases with all of the tags in require, and none
        of the tags in exclude
        zIn test case: z

N)
TEST_CASESrI   rO   rN   	Exception	traceback
format_excAssertionError)rJ   requireexcluder]   emsgs         r*   check_caseszLinalgTestCase.check_cases^  s    
 OODyy7"g-yy7"1

477# $  1&thd3y++--$S)q01s   A	B	)BB	N)rT   rU   rV   r   r   rW   r   rX   r,   r*   r   r   [  s    J"%% 1r,   r   c                       e Zd Zd Zd Zy)LinalgSquareTestCasec                 0    | j                  dhddh       y )Nr=   rA   rB   r   r   r   rR   s    r*   test_sq_casesz"LinalgSquareTestCase.test_sq_casest  s!    ("/!: 	 	<r,   c                 0    | j                  ddhdh       y )Nr=   rB   rA   r   r   rR   s    r*   test_empty_sq_casesz(LinalgSquareTestCase.test_empty_sq_casesx  s!    (H!5"/ 	 	2r,   N)rT   rU   rV   r   r   rX   r,   r*   r   r   r      <2r,   r   c                       e Zd Zd Zd Zy)LinalgNonsquareTestCasec                 0    | j                  dhddh       y )Nr@   rA   rB   r   r   rR   s    r*   test_nonsq_casesz(LinalgNonsquareTestCase.test_nonsq_cases  !    +"/!: 	 	<r,   c                 0    | j                  ddhdh       y )Nr@   rB   rA   r   r   rR   s    r*   test_empty_nonsq_casesz.LinalgNonsquareTestCase.test_empty_nonsq_cases  !    +x!8"/ 	 	2r,   N)rT   rU   rV   r   r   rX   r,   r*   r   r   }  r   r,   r   c                       e Zd Zd Zd Zy)HermitianTestCasec                 0    | j                  dhddh       y )Nr?   rA   rB   r   r   rR   s    r*   test_herm_casesz!HermitianTestCase.test_herm_cases  r   r,   c                 0    | j                  ddhdh       y )Nr?   rB   rA   r   r   rR   s    r*   test_empty_herm_casesz'HermitianTestCase.test_empty_herm_cases  r   r,   N)rT   rU   rV   r   r   rX   r,   r*   r   r     r   r,   r   c                   |    e Zd Zej                  j
                  d        Zej                  j
                  d        Zy)LinalgGeneralizedSquareTestCasec                 0    | j                  ddhdh       y )NrA   r=   rB   r   r   rR   s    r*   test_generalized_sq_casesz9LinalgGeneralizedSquareTestCase.test_generalized_sq_cases  s!    -!:"* 	 	-r,   c                 ,    | j                  h d       y )N>   r=   rA   rB   r   r   rR   s    r*   test_generalized_empty_sq_casesz?LinalgGeneralizedSquareTestCase.test_generalized_empty_sq_cases  s    !DEr,   N)rT   rU   rV   pytestmarkslowr   r   rX   r,   r*   r   r     s>    [[- - [[F Fr,   r   c                   |    e Zd Zej                  j
                  d        Zej                  j
                  d        Zy)"LinalgGeneralizedNonsquareTestCasec                 0    | j                  ddhdh       y )NrA   r@   rB   r   r   rR   s    r*   test_generalized_nonsq_casesz?LinalgGeneralizedNonsquareTestCase.test_generalized_nonsq_cases  !    -!="* 	 	-r,   c                 ,    | j                  h d       y )N>   r@   rA   rB   r   r   rR   s    r*   "test_generalized_empty_nonsq_caseszELinalgGeneralizedNonsquareTestCase.test_generalized_empty_nonsq_cases  s    !GHr,   N)rT   rU   rV   r   r   r   r   r   rX   r,   r*   r   r     s>    [[- - [[I Ir,   r   c                   |    e Zd Zej                  j
                  d        Zej                  j
                  d        Zy)HermitianGeneralizedTestCasec                 0    | j                  ddhdh       y )NrA   r?   rB   r   r   rR   s    r*   test_generalized_herm_casesz8HermitianGeneralizedTestCase.test_generalized_herm_cases  r   r,   c                 0    | j                  h ddh       y )N>   r?   rA   rB   noner   r   rR   s    r*   !test_generalized_empty_herm_casesz>HermitianGeneralizedTestCase.test_generalized_empty_herm_cases  s    !G"( 	 	+r,   N)rT   rU   rV   r   r   r   r  r  rX   r,   r*   r  r    s<    [[- - [[+ +r,   r  c                     t        |       } | j                  dk\  rHt        j                  | j                  | j
                        }t        | j                  d         |d<   |S t        | j                  d         S )Nrr   r7   r   .r   )r   r   r&   r   r   r/   r	   )r1   rs     r*   identity_like_generalizedr	    s\    
Avv{HHQWWAGG,!''"+&#
##r,   c                       e Zd Zd Zy)
SolveCasesc                 H   t        j                  ||      }t        j                  |      j                  dk(  r=t        ||d         d   }t        t        j                  ||j                        |       nt        ||      }t        ||       t        t        ||             y )Nro   ).N.r   )r   solver&   r   r   r
   r   broadcast_tor   r   r+   )rJ   r1   r2   rI   r   adotxs         r*   rN   zSolveCases.do  s}    LLA88A;q  1a	l+F3E5;; ?G1aLE5)#Aq)*r,   NrT   rU   rV   rN   rX   r,   r*   r  r    s    
+r,   r  c                   j    e Zd Zej                  j                  deeee	g      d        Z
d Zd Zd Zy)	TestSolver/   c                     t        j                  ddgddgg|      }t        t        j                  ||      j
                  |       y Nro         ?r7   )r&   r   r   r   r  r/   rJ   r/   r   s      r*   
test_typeszTestSolve.test_types  s:    HHq#ha)7V\\!Q'--u5r,   c                 v    G d dt         j                        }t        j                  d      j                  ddd      }t        j                  d      j	                  |      }t        j                  ||      }|j                  dk(  sJ t        j                  d      j                  dd      j	                  |      }t        j                  ||      }|j                  dk(  sJ t        j                  d      j                  dd      j	                  |      }t        t        t
        j                  ||       y )	Nc                       e Zd Zy))TestSolve.test_1_d.<locals>.ArraySubclassNrT   rU   rV   rX   r,   r*   ArraySubclassr        r,   r  rm   rq   rq   rq   rs   )rq   rq   rq   ro   )
r&   r'   aranger   r   r   r  r   r   
ValueError)rJ   r  r1   r2   results        r*   test_1_dzTestSolve.test_1_d  s    	BJJ 	IIaL  Aq)IIaLm,a#||v%%% IIaL  A&++M:a#||y(((IIaL  A&++M:j&,,15r,   c           
          G d dt         j                        }t        j                  d      j                  ddd      }t        j                  d      j                  ddd      j	                  |      }t        j                  ||      d d ddd d f   }t        j                  |d d ddddf   |d d ddd d f         }t        ||       t        t        ||             t        t
        j                  t
        j                  |d d ddddf   |       t        t        t
        j                  ||d d ddd d f          t        j                  d      j                  ddd      }t        t        t
        j                  ||       t        t        t
        j                  |dd |dd        t        j                  d      j	                  |      }t        j                  ||      d d ddf   }t        j                  |d d ddddf   |dd       }t        ||       t        t        ||             t        j                  d      j                  dd      }t        t        t
        j                  ||       t        t        t
        j                  |dd |dd        t        t        t
        j                  |d d ddddf   |       y )	Nc                       e Zd Zy),TestSolve.test_0_size.<locals>.ArraySubclassNr  rX   r,   r*   r  r&    r  r,   r  rm   rq   r   ro   rr   r   )r&   r'   r   r   r   r   r  r   r   r%   r   r   r!  rJ   r  r1   r2   expectedr"  s         r*   test_0_sizezTestSolve.test_0_size  s?   	BJJ 	 IIaL  Aq)IIaL  Aq)..}=<<1%a1ai0a1Q3!na1Q3	l;68,
6=12 	f((&,,!QqS!A#+Jj&,,1Q!QY<@ IIaL  Aq)j&,,15j&,,!A!A? IIaLm,<<1%a1f-a1Q3!na!f568,
6=12IIaL  A&j&,,15j&,,!A!A?j&,,!QqS!A#+Br,   c                     G d dt         j                        }t        j                  d      j                  ddd      }t        j                  d      j                  ddd      j	                  |      }t        j                  ||      d d d d ddf   }t        j                  ||d d d d ddf         }t        ||       t        t        ||             t        j                  ||      d d ddddf   }t        j                  |d d ddddf   |d d ddddf         }t        ||       t        t        ||             y )	Nc                       e Zd Zy).TestSolve.test_0_size_k.<locals>.ArraySubclassNr  rX   r,   r*   r  r,    r  r,   r  rs   ro   rq   r   rr   r   )
r&   r'   r   r   r   r   r  r   r   r%   r'  s         r*   test_0_size_kzTestSolve.test_0_size_k	  s   	BJJ 	IIaL  Aq)IIaL  Aq)..}=<<1%aAaCi0a1a19.68,
6=12 <<1%a1ack2a1Q3!na1Q3!n=68,
6=12r,   N)rT   rU   rV   r   r   parametrizer   r   r   r   r  r#  r)  r-  rX   r,   r*   r  r    s@    [[Wvvw&HI6 J66"CB3r,   r  c                       e Zd Zd Zy)InvCasesc                     t        j                  |      }t        t        ||      t	        |             t        t        ||             y r#   )r   invr   r
   r	  r   r+   )rJ   r1   r2   rI   a_invs        r*   rN   zInvCases.do  s8    

1F1e,5a8	:#E1-.r,   Nr  rX   r,   r*   r0  r0    s    /r,   r0  c                   ^    e Zd Zej                  j                  deeee	g      d        Z
d Zy)TestInvr/   c                     t        j                  ddgddgg|      }t        t        j                  |      j
                  |       y r  )r&   r   r   r   r2  r/   r  s      r*   r  zTestInv.test_types&  s7    HHq#ha)7VZZ]((%0r,   c                     G d dt         j                        }t        j                  dt         j                        j	                  |      }t        j                  |      }t        |j                  j                  t         j                  u        t        |j                  |j                         t        t        ||             t        j                  dt         j                        j	                  |      }t        j                  |      }t        |j                  j                  t         j                  u        t        |j                  |j                         t        t        ||             y )Nc                       e Zd Zy)*TestInv.test_0_size.<locals>.ArraySubclassNr  rX   r,   r*   r  r9  -  r  r,   r  r   ro   ro   r7   rj   )r&   r'   zerosint_r   r   r2  r   r/   r$   float64r   r   r%   	complex64rJ   r  r1   ress       r*   r)  zTestInv.test_0_size+  s    	BJJ 	HHYbgg.33MBjjm		"**,-QWWcii(
3./HHV2<<055mDjjm		",,./QWWcii(
3./r,   NrT   rU   rV   r   r   r.  r   r   r   r   r  r)  rX   r,   r*   r5  r5  %  s4    [[Wvvw&HI1 J10r,   r5  c                       e Zd Zd Zy)EigvalsCasesc                 v    t        j                  |      }t        j                  |      \  }}t        ||       y r#   )r   eigvalseigr   )rJ   r1   r2   rI   evevaluesevectorss          r*   rN   zEigvalsCases.do>  s,    ^^A"JJqMB(r,   Nr  rX   r,   r*   rC  rC  <  s    )r,   rC  c                   ^    e Zd Zej                  j                  deeee	g      d        Z
d Zy)TestEigvalsr/   c                 .   t        j                  ddgddgg|      }t        t        j                  |      j
                  |       t        j                  ddgddgg|      }t        t        j                  |      j
                  t        |             y Nro   r  r7   r   )r&   r   r   r   rE  r/   r:   r  s      r*   r  zTestEigvals.test_typesE  st    HHq#ha)7V^^A&,,e4HHq#hQ(6V^^A&,,.?.FGr,   c                     G d dt         j                        }t        j                  dt         j                        j	                  |      }t        j                  |      }t        |j                  j                  t         j                  u        t        d|j                         t        t        |t         j                               t        j                  dt         j                        j	                  |      }t        j                  |      }t        |j                  j                  t         j                  u        t        d|j                         t        t        |t         j                               y )Nc                       e Zd Zy).TestEigvals.test_0_size.<locals>.ArraySubclassNr  rX   r,   r*   r  rP  N  r  r,   r  r:  r7   r   ro   rj   rk   )r&   r'   r;  r<  r   r   rE  r   r/   r$   r=  r   r   r%   r>  r?  s       r*   r)  zTestEigvals.test_0_sizeL  s    	BJJ 	HHYbgg.33MBnnQ		"**,-VSYY'
3

+,HHV2<<055mDnnQ		",,./T399%
3

+,r,   NrA  rX   r,   r*   rK  rK  D  s6    [[Wvvw&HIH JH-r,   rK  c                       e Zd Zd Zy)EigCasesc           	      @   t        j                  |      }|j                  |j                  }}t	        t        ||      t        j                  |      t        j                  |      dd d d f   z  t        |j                               t        t        ||             y )N.rtol)r   rF  eigenvalueseigenvectorsr   r
   r&   r   r<   r/   r   r+   )rJ   r1   r2   rI   r@  rW  rX  s          r*   rN   zEigCases.doa  sz    jjm$'OOS5E5E\q,/

<02::k3J3PTVW<3XX%k&7&78	: 	#L!45r,   Nr  rX   r,   r*   rS  rS  _  s    6r,   rS  c                   ^    e Zd Zej                  j                  deeee	g      d        Z
d Zy)TestEigr/   c                    t        j                  ddgddgg|      }t         j                  j                  |      \  }}t	        |j
                  |       t	        |j
                  |       t        j                  ddgddgg|      }t         j                  j                  |      \  }}t	        |j
                  t        |             t	        |j
                  t        |             y rM  )r&   r   r   rF  r   r/   r:   rJ   r/   r   wvs        r*   r  zTestEig.test_typesk  s    HHq#ha)7yy}}Q1QWWe$QWWe$HHq#hQ(6yy}}Q1QWW/67QWW/67r,   c                 B    G d dt         j                        }t        j                  dt         j                        j	                  |      }t        j                  |      \  }}t        |j                  j                  t         j                  u        t        |j                  j                  t         j                  u        t        |j                  |j                         t        d|j                         t        t        |t         j                               t        j                  dt         j                        j	                  |      }t        j                  |      \  }}t        |j                  j                  t         j                  u        t        |j                  j                  t         j                  u        t        |j                  |j                         t        d|j                         t        t        |t         j                               y )Nc                       e Zd Zy)*TestEig.test_0_size.<locals>.ArraySubclassNr  rX   r,   r*   r  ra  y  r  r,   r  r:  r7   rQ  rj   rk   )r&   r'   r;  r<  r   r   rF  r   r/   r$   r=  r   r   r%   r>  rJ   r  r1   r@  res_vs        r*   r)  zTestEig.test_0_sizew  s@   	BJJ 	HHYbgg.33MBZZ]
U  BJJ./		"**,-QWWekk*VSYY'
1bjj)*HHV2<<055mDZZ]
U  BLL01		",,./QWWekk*T399%
1bjj)*r,   NrA  rX   r,   r*   rZ  rZ  j  s4    [[Wvvw&HI	8 J	8+r,   rZ  c                   \    e Zd ZdZej
                  j                  deee	e
g      d        Zy)SVDBaseTestsFr/   c                    t        j                  ddgddgg|      }t        j                  |      }|j                  |j
                  |j                  }}}t        |j                  |       t        |j                  t        |             t        |j                  |       t        j                  |d| j                        }t        |j                  t        |             y )Nro   r  r7   F
compute_uvr?   )r&   r   r   svdUSVhr   r/   r8   r?   )rJ   r/   r   r@  rj  rk  rl  r   s           r*   r  zSVDBaseTests.test_types  s    HHq#ha)7jjm55#%%b1QWWe$QWWnU34RXXu%JJqUdnnEQWWnU34r,   N)rT   rU   rV   r?   r   r   r.  r   r   r   r   r  rX   r,   r*   re  re    s4    I[[Wvvw&HI5 J5r,   re  c                       e Zd Zd Zy)SVDCasesc                 j   t        j                  |d      \  }}}t        |t        t	        j
                  |      t	        j
                  |      dd d d f   z  t	        j
                  |            t        |j                               t        t        ||             t        t        ||             y )NF.rU  )
r   ri  r   r
   r&   r   r<   r/   r   r+   )rJ   r1   r2   rI   ur   vts          r*   rN   zSVDCases.do  s    ::a'1b6"**Q-"**Q-T12M"M+-::b>;%agg.	0 	#Aq)*#B*+r,   Nr  rX   r,   r*   rn  rn    s    ,r,   rn  c                       e Zd Zd Zd Zy)TestSVDc                    t        j                  d      }t        j                  |d| j                        \  }}}t        |j                  d       t        |j                  d       t        |t        j                  d             t        j                  d      }t        j                  |d| j                        \  }}}t        |j                  d       t        |j                  d       t        |t        j                  d             y)	z6 Empty input should put an identity matrix in u or vh )rs   r   Trg  rs   rs   rj   rs   )r   rs   N)r&   r   r   ri  r?   r   r   eye)rJ   r   rp  r   vhs        r*   test_empty_identityzTestSVD.test_empty_identity  s    HHV::aDDNNK1bQWWf%RXXv&Qq	"HHV::aDDNNK1bQWWf%RXXv&R#r,   c                     t        j                  ddgddgg      }t        j                  |d| j                        }t        j
                  |      }t        ||       y )Nro   r  Frg  )r&   r   r   ri  r?   svdvalsr   )rJ   r   
s_from_svds_from_svdvalss       r*   test_svdvalszTestSVD.test_svdvals  sK    HHq#ha)*ZZet~~N
*J7r,   N)rT   rU   rV   rx  r}  rX   r,   r*   rs  rs    s    $8r,   rs  c                       e Zd Zd Zy)SVDHermitianCasesc                 R   t        j                  |dd      \  }}}t        |t        t	        j
                  |      t	        j
                  |      dd d d f   z  t	        j
                  |            t        |j                               d }t        t	        j                  | ||            t	        j                  t	        j                  |j                  d         |j                               t        t	        j                  | ||            t	        j                  t	        j                  |j                  d         |j                               t        t	        j                  |      dd d df   |       t        t        ||             t        t        ||             y )NFTr?   .rU  c                     t        t        | j                              }|d   |d   c|d<   |d<   t        j                  t        j
                  | |            S )Nr   r   axes)r   ranger   r&   conj	transpose)matr  s     r*   r?   z'SVDHermitianCases.do.<locals>.hermitian  sJ    chh(D!%b48DHd2h772<<$788r,   r   )r   ri  r   r
   r&   r   r<   r/   r   r  rv  r   r   sortr   r+   )rJ   r1   r2   rI   rp  r   rq  r?   s           r*   rN   zSVDHermitianCases.do  s(   ::a$71b6"**Q-"**Q-T12M"M+-::b>;%agg.	0	9
 	BIIa16qwwWY{H[]^]d]d8efBIIb)B-8"//"&&QSQYQYZ\Q]J^`b`h`h:ijRWWQZTrT	*A.#Aq)*#B*+r,   Nr  rX   r,   r*   r  r    s    ,r,   r  c                       e Zd ZdZy)TestSVDHermitianTN)rT   rU   rV   r?   rX   r,   r*   r  r    s    Ir,   r  c                       e Zd Zd Zy)	CondCasesc           	         t        |      }d|v r t        t        t        j                  |       y t        j
                  |d      }t        t        j                  |      |d   |d   z  dd       t        t        j                  |d	      |d   |d   z  dd       t        t        j                  |d
      |d   |d   z  dd       t        j                  j                  |      }t        t        j                  |d      t        |      j                  d
      j                  d      t        |      j                  d
      j                  d      z  dd       t        t        j                  |d      t        |      j                  d
      j                  d      t        |      j                  d
      j                  d      z  dd       t        t        j                  |t        j                        t        |      j                  d      j                  d      t        |      j                  d      j                  d      z  dd       t        t        j                  |t        j                         t        |      j                  d      j                  d      t        |      j                  d      j                  d      z  dd       t        t        j                  |d      t        j                  t        |      d	z  j                  d      j                  d      t        |      d	z  j                  d      j                  d      z        dd       y )NrB   F)rh  r  ).r   r   r   r3   r4   rq   r   ro   r   fro)r   r   r   r   condri  r   r&   r2  r   summaxminr   sqrt)rJ   r1   r2   rI   cr   cinvs          r*   rN   zCondCases.do  s   AJt+v{{A6 JJqU+KKNAfI'
2R	1 	KK1qy1W:5R	1 	KK2'
QvY 6R	1
 yy}}QKK1FJJrNr"SY]]2%6%:%:2%>>R	1 	KK2FJJrNr"SY]]2%6%:%:2%>>R	1 	KK266"FJJrNr"SY]]2%6%:%:2%>>R	1 	KKBFF7#FJJrNr"SY]]2%6%:%:2%>>R	1 	KK5!GGSVQYOOB'++B/4y!|((,0045 6R		1r,   Nr  rX   r,   r*   r  r    s    (1r,   r  c                   f    e Zd Zd Zd Zej                  j                  ddd      d        Zd Z	y	)
TestCondc                    t        g dg dg dg      }t        t        j                  |t              d       t        t        j                  |t               d       t        t        j                  |d      d       t        t        j                  |d      d       t        t        j                  |d	      t        j                  d
             y )N)r`   r   ro   )r   g       r   )r   r   rb   rs   gUUUUUU?ro   r   r  r  gUUUUU6@)r   r   r   r  r   r&   r  rJ   As     r*   test_basic_nonsvdzTestCond.test_basic_nonsvd  s    :{J78FKK3/3FKKC40#6FKK1-q1FKK2.4FKK5127783DEr,   c                 P   t        j                  d      t        j                  d      g}g d}ddg}t        j                  ||      D ]'  \  }}t        t        j                  ||      dkD         ) t        j                  ||      D ]  \  }}t        j                  ||        y )Nr  Nro   rq   r  r   r     4&kC)r&   r;  onesr   r   r   r   r  )rJ   Asp_posp_negr  ps         r*   test_singularzTestCond.test_singular  s     hhv0#R%%b%0DAq FKK1%,- 1 %%b%0DAqKK1 1r,   TFz/Platform/LAPACK-dependent failure, see gh-18914)runreasonc                    g d}g d}t        j                  d      }t         j                  |d<   |D ]Y  }t        j                  ||      }t        t        |t         j                               t        t        j                  |             [ t        j                  d      }t         j                  |d<   |D ]  }t        j                  ||      }t        t        j                  |d                ||v r#t        |d   d	kD         t        |d
   d	kD         at        t        j                  |d                 t        t        j                  |d
                  y )N)Nro   r   rq   r   r  r  r  rQ  )rr   rq   rq   ro   r   ro   ro   r   r  rq   )	r&   r  nanr   r  r   r%   r=  isnan)rJ   psr  r  r  r  s         r*   test_nanzTestCond.test_nan  s   
 )#GGFO#AAq!AJq"**-.BHHQK  
 GGI66%AAq!ABHHQqTN#Ez!t$!t$BHHQqTN*+BHHQqTN*+ r,   c                    t         j                  j                  d       t         j                  j                  dddd      }d|d<   d|d<   dD ]  }t	        j
                  ||      }t        |d   t         j                         t        |d   t         j                         t        t        j                  |d                t        t        j                  |d                 y )	Nr_   rq   r   rj   r   )Nro   rq   r  r   r   rQ  ro   r   )
r&   randomseedrandr   r  r   r   r   isfinite)rJ   r  r  r  s       r*   test_stacked_singularzTestCond.test_stacked_singular6  s     			tIINN1aA&##,AAq!A3(3(BKK#'(BKK#'( -r,   N)
rT   rU   rV   r  r  r   r   xfailr  r  rX   r,   r*   r  r    sC    F [[t-  .,.,0)r,   r  c                       e Zd Zd Zy)	PinvCasesc                     t        j                  |      }t        }t         | |||      |      |dd       t	        t        ||             y )Nr   r   r  r   pinvr
   r   r   r+   rJ   r1   r2   rI   a_ginvr   s         r*   rN   zPinvCases.doK  s@    QCAv2AaXZ[#FA./r,   Nr  rX   r,   r*   r  r  F  s    
0r,   r  c                       e Zd Zy)TestPinvNr  rX   r,   r*   r  r  S      r,   r  c                       e Zd Zd Zy)PinvHermitianCasesc                     t        j                  |d      }t        }t         | |||      |      |dd       t	        t        ||             y )NTr  r   r   r  r  r  s         r*   rN   zPinvHermitianCases.doY  sC    Q$/CAv2AaXZ[#FA./r,   Nr  rX   r,   r*   r  r  W  s    0r,   r  c                       e Zd Zy)TestPinvHermitianNr  rX   r,   r*   r  r  a  r  r,   r  c                  x   t        j                  g dg dg dg      } t        t         j                  j	                  | d      t         j                  j	                  | d             t        j                  t        d      5  t         j                  j	                  | dd	       d d d        y # 1 sw Y   y xY w)
Nro   rq   rr   )rs   ro   ro   )rq   rr   ro   r  rcondrU  z%`rtol` and `rcond` can't be both set.)match)r  rV  )r&   r   r   r   r  r   raisesr!  )r1   s    r*   test_pinv_rtol_argr  e  s    
)Y	23A
		q$
		qs#
 
B
 			q#.
 
 
s   #B00B9c                       e Zd Zd Zy)DetCasesc                    t        j                  |      }t        j                  |      }|j                  |j                  }}t        |      j                  j                  t        t        fv rt        |      j                  t              }nt        |      j                  t              }t        j                  |      }	t        |t        j                  |	d             t        |t!        j"                  |      z  t        j                  |	d             t!        j$                  |      }t!        j$                  |      }|dk7  }
t        t!        j&                  ||
         d       t)        ||
    t*                y )Nr   axisr   ro   )r   detslogdetsign	logabsdetr   r/   r$   r   r   astyper   rE  r   r   reducer&   exp
atleast_1dr   r   r   )rJ   r1   r2   rI   dr@  r   ldadrG  ms              r*   rN   zDetCases.dou  s   JJqMnnQ#--21:  VV$44""6*B""7+B^^BAxr;<Ar
NHOOBR,HIMM!]]2!VBFF1Q4L!,RVcT"r,   Nr  rX   r,   r*   r  r  s  s    #r,   r  c                   d    e Zd Zd Zej
                  j                  deee	e
g      d        Zd Zy)TestDetc                 h   t        t        j                  dgg      d       t        t        t        j                  dgg            t               t        t        j                  dgg      d       t        t        t        j                  dgg            t
               t        t        j                  dgg      dt         f       t        t        t        j                  dgg      d         t               t        t        t        j                  dgg      d         t               t        t        j                  dgg      dt         f       t        t        t        j                  dgg      d         t
               t        t        t        j                  dgg      d         t               y )N        y                r   ro   )r   r   r  r$   r   r   r  r   rR   s    r*   	test_zerozTestDet.test_zero  s&   VZZ#(#.T&**seW-.7VZZ$)3/T&**tfX./9V^^cUG,sSDk:T&..3%1!45v>T&..3%1!45v>V^^dVH-sd|<T&..4&2156@T&..4&2156?r,   r/   c                 R   t        j                  ddgddgg|      }t        t         j                  j	                  |      j
                  |       t         j                  j                  |      \  }}t        |j
                  t        |             t        |j
                  |       y r  )r&   r   r   r   r  r/   r  r8   )rJ   r/   r   phr   s        r*   r  zTestDet.test_types  su    HHq#ha)7RYY]]1%++U3		!!!$AQWWnU34RXXu%r,   c                    t        j                  dt         j                        }t        j                  |      }t        |d       t        |j                  j                  t         j                  u        t        j                  |      }t        |d       t        |d   j                  j                  t         j                  u        t        |d   j                  j                  t         j                  u        t        j                  dt         j                        }t        j                  |      }t        |d       t        |j                  j                  t         j                  u        t        j                  |      }t        |d       t        |d   j                  j                  t         j                  u        t        |d   j                  j                  t         j                  u        y )Nrj   r7   r`   r  r   ro   )r&   r;  r>  r   r  r   r   r/   r$   r  float32r=  )rJ   r1   r@  s      r*   r)  zTestDet.test_0_size  s6   HHV2<<0jjmS"		",,./nnQS&!A!!R\\12A!!RZZ/0HHV2::.jjmS"		"**,-nnQS&!A!!RZZ/0A!!RZZ/0r,   N)rT   rU   rV   r  r   r   r.  r   r   r   r   r  r)  rX   r,   r*   r  r    s<    @ [[Wvvw&HI& J&1r,   r  c                       e Zd Zd Zy)
LstsqCasesc                 0   t        j                  |      }|j                  \  }}t        j                  |d      \  }}}	t        j
                  ||d      \  }
}}}|dk(  rt        |
dk(  j                                ||k  r#t        |t        ||
             t        ||       nt        ||       t        ||j                  |             ||k(  r||kD  rt        j                  t        t        j                  ||
      |z
              dz  j                  d      }t        j                  |      }t        j                  |      j                  dk(  rUd|_        t        |j                  |j                         n-t        j                  g       j!                  t#        |
            }t        ||       t        t        j$                  |j&                  t         j(                               t        t+        |
|             t        t+        ||             y )	NFr   r  r   rq   r  ro   r   )r&   r   r   r   ri  lstsqr   r   r   r   r   __array_wrap__r   r  r   r   r   r$   
issubdtyper/   floatingr+   )rJ   r1   r2   rI   arrr  nrp  r   rq  r   	residualsranksvexpect_residss                  r*   rN   zLstsqCases.do  s   jjmyy1::a'1b!'a"!=9dB6Q!VLLN#63q!9-q!q!B 1 1! 4519Q

3rvva|a/01Q6 JJ}5Mzz!}!!Q&&*#Y__m.A.ABHHRL--d1g6MI}5ioor{{;<#Aq)*#Iq12r,   Nr  rX   r,   r*   r  r    s    3r,   r  c                   d    e Zd Zd Zej
                  j                  g dg d      d        Zd Zy)	TestLstsqc                    t        j                  g dg dg dg dg      j                  }t        j                  g d      }t        j                  ||d      \  }}}}t        |dk(         t        j                  ||      \  }}}}t        |d	k(         t        j                  ||d       \  }}}}t        |d	k(         y )
N)r  r`   r  r`   ra   r  )r  ra   r  r  r`   r  )r`   r  r`   r  r  rc   )r  r  r  ra   rb   r  )ro   r   r   r   r   r   r   r  rs   rr   )r&   r   Tr   r  r   )rJ   r1   r2   r   r  r  r   s          r*   
test_rcondzTestLstsq.test_rcond  s    HH22224 5 67Q 	

 HH'( &Q <9dA	 &Q 29dA	 &Q >9dA	r,   )r  r  n_rhs))rs   rq   rq   )r   rs   ro   )r   rs   rq   )rs   r   ro   )rs   r   rq   )rs   rq   r   r   r   r   c                 \   t        j                  ||z        j                  ||      }t        j                  ||f      }t	        j
                  ||d       \  }}}}	|dk(  rt        |dk(  j                                t        |j                  ||f       t        |j                  ||kD  r|fnd       ||kD  r=|dkD  r8|t        j                  ||      z
  }
t        ||
|
z  j                  d             t        |t        ||             t        |	j                  t        ||      f       y )Nr  r   rk   r   r  )r&   r   r   r  r   r  r   r   r   r   r   r   r  r  )rJ   r  r  r  r1   r2   r   r  r  r   r  s              r*   test_empty_a_bzTestLstsq.test_empty_a_b  s     IIa!e$$Q*GGQJ &Q >9dA6Q!VLLN#QWWq%j)Y__1q5xdDq5UQYBFF1aL A	AE;;B;+?@T3q!9%QWWs1ayl+r,   c                 T   t        j                  g d      }t        j                  g d      }t        j                  |t        j                  t	        |            g      j
                  }t        t        d      5  t        j                  ||d        d d d        y # 1 sw Y   y xY w)N)r   ro   rq   rr   )r   g?g?g @gffffff
@zIncompatible dimensionsr  )
r&   r   vstackr  lenr  r   r   r   r  )rJ   r   yr  s       r*   test_incompatible_dimsz TestLstsq.test_incompatible_dims  sl    HH\"HH-.IIq"''#a&/*+-- .GHLLAT* IHHs   <BB'N)	rT   rU   rV   r  r   r   r.  r  r  rX   r,   r*   r  r    s7     [[0 3 ,,+r,   r  dtz?bBhHiIqQefdgFDGOc                      e Zd Z ej                  d      Zeg d   Zeg d   Zeg d   ZeeeegZ	 e
ddgddgg      Z ej                  egggdz        Ze ej                  d       ej                  d	       ej                  d
      gZd Zd Zd Zd Zd Zd Zd Zej2                  j5                  ed      d        Zy)TestMatrixPowerrs   )rr   r   ro   rq   )rq   rr   r   ro   )ro   rq   rr   r   ro   r   rq   r   gGc                    | j                   j                  |      }t        t        |ddz  dz   dz   dz         | j                         t        t        |ddz  dz   dz   dz         | j                          t        t        |ddz  dz   dz   dz         | j
                         t        t        |ddz  dz   dz   dz         | j                         y )Nrq   d   i       r   ro   rr   )rshft_1r  r   r   rshft_0rshft_2rshft_3)rJ   r  rshfts      r*   test_large_powerz TestMatrixPower.test_large_power  s    ##B'3 5 9:DLL	J3 5 9:DLL	J3 5 9:DLL	J3 5 9:DLL	Jr,   c                     d }| j                   D ]D  } ||j                  |             |t        k7  s$ || j                  j                  |             F y )Nc                     t        | d      }t        |t        |              t        |j                  | j                         y )Nr   )r   r   r	  r/   )Mmzs     r*   tzz.TestMatrixPower.test_power_is_zero.<locals>.tz  s0    a#B6q9:177+r,   	rshft_allr  objectstackedrJ   r  r  r  s       r*   test_power_is_zeroz"TestMatrixPower.test_power_is_zero  sE    	,
 >>Cszz"~V|4<<&&r*+ "r,   c                     d }| j                   D ]D  } ||j                  |             |t        k7  s$ || j                  j                  |             F y )Nc                 t    t        | d      }t        ||        t        |j                  | j                         y )Nro   )r   r   r/   )r  r  s     r*   r  z-TestMatrixPower.test_power_is_one.<locals>.tz%  s*    c1%BS!399-r,   r  r  s       r*   test_power_is_onez!TestMatrixPower.test_power_is_one$  sE    	.
 >>Cszz"~V|4<<&&r*+ "r,   c                     d }| j                   D ]D  } ||j                  |             |t        k7  s$ || j                  j                  |             F y )Nc                     t        | d      }| j                  t        k7  rt        nt        }t        | || |              t        |j                  | j                         y )Nrq   )r   r/   r  r
   r   r   )r  r  mmuls      r*   r  z-TestMatrixPower.test_power_is_two.<locals>.tz0  sB    c1%B YY&06cDT#s^,399-r,   r  r  s       r*   test_power_is_twoz!TestMatrixPower.test_power_is_two/  sE    	. >>Cszz"~V|4<<&&r*+ "r,   c                 x    d }| j                   D ](  }|| j                  vs ||j                  |             * y )Nc                     t        | d      }| j                  t        k7  rt        nt        }t         |||       t        |              y Nr   )r   r/   r  r
   r   r   r	  )r  invmatr   s      r*   r  z3TestMatrixPower.test_power_is_minus_one.<locals>.tz<  s;    !#r*F YY&06cDVS!#<S#ACr,   )r  dtnoinvr  r  s       r*   test_power_is_minus_onez'TestMatrixPower.test_power_is_minus_one;  s4    	C >>C%3::b>" "r,   c                     | j                   j                  |      }t        t        t        |d       t        t        t        |dg       y )Ng      ?ro   )r  r  r   	TypeErrorr   rJ   r  r  s      r*   test_exceptions_bad_powerz)TestMatrixPower.test_exceptions_bad_powerF  s4    ll!!"%isC8isQC8r,   c                 
   t        t        t        t        j                  dg|      d       t        t        t        t        j                  dgdgg|      d       t        t        t        t        j
                  d|      d       y )Nro   rq   )rs   rr   rq   )r   r   r   r&   r   r  )rJ   r  s     r*   test_exceptions_non_squarez*TestMatrixPower.test_exceptions_non_squareK  sW    k<1#r1BAFk<A3*b1I1Mk<B1GKr,   fp errors don't work in wasmr  c                     || j                   v ry | j                  j                  |      }t        t        t
        |d       y r$  )r&  noninvr  r   r   r   r*  s      r*   test_exceptions_not_invertiblez.TestMatrixPower.test_exceptions_not_invertibleP  s3    kk  $k<b9r,   N)rT   rU   rV   r&   rv  r  r
  r  r  r  r   r1  blockr  r  r/   r&  r  r  r  r!  r'  r+  r-  r   r   skipifr!   r2  rX   r,   r*   r  r    s     bffQiGl#Gl#Gl#G'7G4IQFQF#$Fbhh'}Q'Gxrxx}hbhhsmXRXXc]CG	J	,	,
,	#9
L
 [[(FG: H:r,   r  c                       e Zd Zd Zy)TestEigvalshCasesc                 4   t        j                  |d      }t        j                  |      \  }}|j                  d       t	        ||t        |j                               t        j                  |d      }t	        ||t        |j                               y )NLr   r  rU  rj  )r   eigvalshrF  r  r   r<   r/   )rJ   r1   r2   rI   rG  rH  rI  ev2s           r*   rN   zTestEigvalshCases.doZ  sn     __Q$"JJqM"G(288*<=ooa%W8BHH+=>r,   Nr  rX   r,   r*   r6  r6  X  s    	?r,   r6  c                   j    e Zd Zej                  j                  deeee	g      d        Z
d Zd Zd Zy)TestEigvalshr/   c                     t        j                  ddgddgg|      }t         j                  j                  |      }t	        |j
                  t        |             y r  )r&   r   r   r9  r   r/   r8   )rJ   r/   r   r]  s       r*   r  zTestEigvalsh.test_typesg  sF    HHq#ha)7IIq!QWWnU34r,   c                 X   t        j                  ddgddggt         j                        }t        t        t         j
                  j                  |d       t        t        t         j
                  j                  |d       t        t        t         j
                  j                  |d       y Nro   r  r7   lrongUPLOlowerupper)r&   r   r  r   r!  r   r9  rJ   r   s     r*   test_invalidzTestEigvalsh.test_invalidm  sk    HHq#ha)<j"))"4"4agFj"))"4"4aAj"))"4"4aAr,   c                    t        j                  ddgddggt         j                        }t        j                  ddgddggt         j                        }t        j                  ddgt         j                        }t        t         j                        }t         j                  j                  |      }t        |||       t         j                  j                  |d      }t        |||       t         j                  j                  |d      }t        |||       t         j                  j                  |d	      }t        |||       t         j                  j                  |d
      }t        |||       y Nr   ro   r7   r   rU  r8  rA  lrj  rp  )r&   r   r   r<   r   r9  r   )rJ   KloKuptgtrV  r]  s         r*   	test_UPLOzTestEigvalsh.test_UPLOs  s    hhAA'ryy9hhAA'ryy9hhAwbii0		" IIs#3T*IIs-3T*IIs-3T*IIs-3T*IIs-3T*r,   c                     G d dt         j                        }t        j                  dt         j                        j	                  |      }t        j                  |      }t        |j                  j                  t         j                  u        t        d|j                         t        t        |t         j                               t        j                  dt         j                        j	                  |      }t        j                  |      }t        |j                  j                  t         j                  u        t        d|j                         t        t        |t         j                               y )Nc                       e Zd Zy)/TestEigvalsh.test_0_size.<locals>.ArraySubclassNr  rX   r,   r*   r  rP    r  r,   r  r:  r7   rQ  rj   rk   )r&   r'   r;  r<  r   r   r9  r   r/   r$   r=  r   r   r%   r>  r  r?  s       r*   r)  zTestEigvalsh.test_0_size  s    	BJJ 	HHYbgg.33MBooa 		"**,-VSYY'
3

+,HHV2<<055mDooa 		"**,-T399%
3

+,r,   NrT   rU   rV   r   r   r.  r   r   r   r   r  rF  rM  r)  rX   r,   r*   r<  r<  f  s?    [[Wvvw&HI5 J5
B+,-r,   r<  c                       e Zd Zd Zy)TestEighCasesc                    t        j                  |      }|j                  |j                  }}t        j                  |      \  }}|j                  d       t        ||       t        t        ||      t        j                  |      dd d d f   t        j                  |      z  t        |j                               t        j                  |d      \  }	}
t        |	|       t        t        ||
      t        j                  |	      dd d d f   t        j                  |
      z  t        |j                        t        |             y )Nr   r  .rU  rj  )rV  err_msg)r   eighrW  rX  rF  r  r   r   r
   r&   r   r<   r/   repr)rJ   r1   r2   rI   r@  rG  evcrH  rI  r:  evc2s              r*   rN   zTestEighCases.do  s     kk!n//3#3#3C"JJqM"B(q#

2sD!|4rzz#F%bhh/	1 KK3'	TC)q$

3T15

48HH%bhh/a	Br,   Nr  rX   r,   r*   rS  rS    s    Br,   rS  c                   j    e Zd Zej                  j                  deeee	g      d        Z
d Zd Zd Zy)TestEighr/   c                     t        j                  ddgddgg|      }t         j                  j                  |      \  }}t	        |j
                  t        |             t	        |j
                  |       y r  )r&   r   r   rV  r   r/   r8   r\  s        r*   r  zTestEigh.test_types  sV    HHq#ha)7yy~~a 1QWWnU34QWWe$r,   c                 X   t        j                  ddgddggt         j                        }t        t        t         j
                  j                  |d       t        t        t         j
                  j                  |d       t        t        t         j
                  j                  |d       y r?  )r&   r   r  r   r!  r   rV  rE  s     r*   rF  zTestEigh.test_invalid  se    HHq#ha)<j"))..!'Bj"))..!W=j"))..!W=r,   c                     t        j                  ddgddggt         j                        }t        j                  ddgddggt         j                        }t        j                  ddgt         j                        }t        t         j                        }t         j                  j                  |      \  }}t        |||       t         j                  j                  |d      \  }}t        |||       t         j                  j                  |d      \  }}t        |||       t         j                  j                  |d	      \  }}t        |||       t         j                  j                  |d
      \  }}t        |||       y rH  )r&   r   r   r<   r   rV  r   )rJ   rJ  rK  rL  rV  r]  r^  s          r*   rM  zTestEigh.test_UPLO  s&   hhAA'ryy9hhAA'ryy9hhAwbii0		" yy~~c"13T*yy~~c~,13T*yy~~c~,13T*yy~~c~,13T*yy~~c~,13T*r,   c                 B    G d dt         j                        }t        j                  dt         j                        j	                  |      }t        j                  |      \  }}t        |j                  j                  t         j                  u        t        |j                  j                  t         j                  u        t        |j                  |j                         t        d|j                         t        t        |t         j                               t        j                  dt         j                        j	                  |      }t        j                  |      \  }}t        |j                  j                  t         j                  u        t        |j                  j                  t         j                  u        t        |j                  |j                         t        d|j                         t        t        |t         j                               y )Nc                       e Zd Zy)+TestEigh.test_0_size.<locals>.ArraySubclassNr  rX   r,   r*   r  ra    r  r,   r  r:  r7   rQ  rj   rk   )r&   r'   r;  r<  r   r   rV  r   r/   r$   r=  r   r   r%   r>  r  rb  s        r*   r)  zTestEigh.test_0_size  s@   	BJJ 	HHYbgg.33MB[[^
U  BJJ./		"**,-QWWekk*VSYY'
1bjj)*HHV2<<055mD[[^
U  BLL01		"**,-QWWekk*T399%
1bjj)*r,   NrQ  rX   r,   r*   r[  r[    s>    [[Wvvw&HI% J%>+,+r,   r[  c                   $    e Zd ZdZdZed        Zy)_TestNormBaseNc                 $   t        | j                  j                  t        j                        r+t        |j                  | j                  j                         y t        t        |j                  j                  t        j                               y r#   )	
issubclassr/   r$   r&   inexactr   realr   r  )r   r@  s     r*   check_dtypez_TestNormBase.check_dtype  sK    aggllBJJ/AFFLL1 Jsyy~~r{{;<r,   )rT   rU   rV   r  decstaticmethodrh  rX   r,   r*   rc  rc    s    	B
C= =r,   rc  c                   *    e Zd Zd Zd Zd Zd Zd Zy)_TestNormGeneralc           
          t        t        g       d       t        t        t        g | j                              d       t        t        t	        t        g | j                                    d       y )Nr  r7   )r   r   r   r  r   rR   s    r*   
test_emptyz_TestNormGeneral.test_empty  sI    T"Xs#T%$''23S9T*U2TWW%=>?Er,   c                    t        j                  g d      }t         j                  d   }t         j                  d   }||z   }|D ]  }|j                  |      }t	        |t         j
                         }| j                  ||       t        |d       t               5 }|j                  t        d       t	        |d      }| j                  ||       t        |d       d d d        t	        |d      }| j                  ||       t        |d       t	        |d	      }| j                  ||       t        |d
       t	        |d      }| j                  ||       t        ||j                  j                  d
      |j                  j                  d      z         t	        |d      }| j                  ||       t        ||j                  j                  d
      |j                  j                  d      z         t	        |t         j
                        }| j                  ||       t        |d        y # 1 sw Y   XxY w)Nr  
AllIntegerAllFloatr  divide by zero encounteredr   r   rq   ro   ra   r  rs   g      ?r`   )r&   r   	typecodesr  r   r   rh  r   r   filterRuntimeWarningr/   r$   	rJ   r1   exact_typesinexact_types	all_types	each_typeatansups	            r*   test_vector_return_typez(_TestNormGeneral.test_vector_return_type  s   HHYll<0Z0-/	"I)$Bb266'"BR$C("$

>+GH"b\  R(#B,	 % b!BR$A&b!BR$C(b!BR$BHHMM#$6g8N$NOb!BR$BHHMM#$6g8N$NOb"&&!BR$C(? # %$s   AH44H>	c                      g d}g d}g d} fd}|||fD ]
  } ||        t        | j                        t        | j                        t        | j                        fD ]
  } ||        y )N)ro   rq   rr   rs   )r   r   r   r   )r   rq   r   rs   c                 v   t         j                  j                  t        |       dj                         t         j                  j                  t        | t
              dj                         t         j                  j                  t        | t
               dj                         t         j                  j                  t        | d      dj                         t         j                  j                  t        | d      dj                         t         j                  j                  t        | d	      dj                         t         j                  j                  t        | d
      dj                         t         j                  j                  t        | d      dj                         y )Ng6ҭ@r.   rc   r`   ro         $@r   gQ?rq   r   gsc?r   rs   )r&   testingr   r   ri  r   )r^  rJ   s    r*   _testz+_TestNormGeneral.test_vector.<locals>._test0  sD   JJ**47I3788 + =JJ**43<3788 + =JJ**4C4=#3788 + =JJ**41:t3788 + =JJ**42;	3788 + =JJ**41:y3788 + =JJ**42;9M3788 + =JJ**41:q3788 + =r,   r7   )r   r  )rJ   r1   r2   r  r  r^  s   `     r*   test_vectorz_TestNormGeneral.test_vector+  sn    	=$ QA!H  )5$''+B)+A!H+r,   c                    t        g dg dg| j                        }d dddddt        j                  t        j                   fD ]  }t	        |j
                  d         D cg c]  }t        |d d |f   |	       }}t        t        ||d
      |       t	        |j
                  d         D cg c]  }t        ||d d f   |	       }}t        t        ||d
      |        t        j                  dd| j                        j                  ddd      }|j                  }d ddddt        j                  t        j                   dfD ]  }t        j                  t	        | |      d      D ]  }|\  }	}
|	dk  r|	|z  }	|
dk  r|
|z  }
|	|
k(  rt        t        t        |||
       :t        |||
      }||	|
z   z
  }|	|
k  rEt	        |j
                  |         D cg c]#  }t        |d d  j                  ||      |	      % }}nNt	        |j
                  |         D cg c]-  }t        |d d  j                  ||      j                   |	      / }}t        ||         y c c}w c c}w c c}w c c}w )Nr  rs   r   r   r7   r   r   ro   rq   rr   ordr  r     rs   r   r  r  )r   r  r&   r   r  r   r   r   r   r   r   r   combinationsr   r!  taker  )rJ   r  orderk	expected0	expected1Bndr  row_axiscol_axisr  k_indexr(  s                 r*   	test_axisz_TestNormGeneral.test_axisI  s^    9i(8B1aBFFRVVG<E;@;LM;Laa1g51;LIMQE :IF;@;LM;Laa1g51;LIMQE :IF	 = IIa477+33Aq!<VVB2q"&&266'5AE!..ubS"~qA%)"(a<NHa<NHx'!*dA5tLQE5A !Hx$78G(*-217773C-D$F-D %)117)C$O-D ! $F .317773C-D$F-D %)117)C)E)E5$Q-D ! $F'84) B B NM,$F$Fs   "I-1I2"(I7'2I<c                 t   t        j                  dd| j                        j                  ddd      }d}d}t	        |d d 	      }t	        |d d d
      }t        t        j                  |      ||j                  d d              d}t        |j                  |k(  |j                  |j                  |d d              d dddddt         j                  t         j                   fD ]  }t        |j                        D ]  }t	        |||	      }t	        |||d
      }t        t        j                  |      ||j                  ||             t        |j                        }d||<   t        |      }t        |j                  |k(  |j                  |j                  |||               d ddddt         j                  t         j                   ddf	D ]  }t        j                   t        |j                        d      D ]  }t	        |||	      }t	        |||d
      }t        t        j                  |      ||j                  ||             t        |j                        }d||d   <   d||d   <   t        |      }t        |j                  |k(  |j                  |j                  |||               y )Nro   r  r7   rq   rr   rs   zorder {0}, axis = {1}z;Shape mismatch found {0}, expected {1}, order={2}, axis={3}r  T)r  r  keepdims)rU  )ro   ro   ro   r   r   r   r  nuc)r&   r   r  r   r   r   squeezeformatr   r   r   r  r   r   r   r   permutations)	rJ   r  allclose_err	shape_errr(  foundexpected_shaper  r  s	            r*   test_keepdimsz_TestNormGeneral.test_keepdimsn  s^   IIa477+33Aq!<.Q	 t$/QDtd;

5)8 , 3 3D$ ?	A"~-  ndDI	K B1aBFFRVVG<E166]u15QEDA

5 18(4(;(;E1(EG!%agg$%q!!&~!6~5!((neQOQ # = B2q"&&266'5%HE++E!&&M1=u15QEDA

5 18(4(;(;E1(EG!%agg'(qt$'(qt$!&~!6~5!((neQOQ > Ir,   N)rT   rU   rV   rn  r~  r  r  r  rX   r,   r*   rl  rl    s    F
')R<#5J(Qr,   rl  c                   B    e Zd Zej                  Zd Zd Zd Zd Zd Z	y)_TestNorm2Dc                 f    t        t        | j                  g g| j                              d       y )Nr7   r  )r   r   r   r  rR   s    r*   test_matrix_emptyz_TestNorm2D.test_matrix_empty  s$    T$**bT*9:C@r,   c                    | j                  g dg dg      }t        j                  d   }d}||z   }|D ]  }|j                  |      }t	        |t        j
                         }| j                  ||       t        |d       t               5 }|j                  t        d       t	        |d      }| j                  ||       t        |d       d d d        t	        |d	      }| j                  ||       t        |d       t	        |d
      }| j                  ||       t        |d       t	        |d      }| j                  ||       t        |d       t	        |t        j
                        }| j                  ||       t        |d       t	        |d      }| j                  ||       t        |d       t	        |d      }| j                  ||       t        j                  j                  |dd        y # 1 sw Y   .xY w)Nr  r:  rp  fdFDra   rr  r   r`   ro   rq   gLXz?r   r  r  gU&,t=@r   r  )r   r&   rs  r  r   r   rh  r   r   rt  ru  r  rv  s	            r*   test_matrix_return_typez#_TestNorm2D.test_matrix_return_type  s   JJ	9-.ll<0
 -/	"I)$Bb266'"BR$C("$

>+GH"b\  R(#B,	 % b!BR$C(b!BR$N3b"BR$C(b"&&!BR$C(b%BR$C(b%BR$ JJ**2/A1*MK # %$s   AG99H	c                 j   | j                  ddgddgg| j                        }t        t        |      d       t        t        |d      d       t        t        |d      d	       t        t        |t              d
       t        t        |t               d       t        t        |d      d	       t        t        |d      d       t        t        |d      d       t        t        |d      d       t        t        t        |d       t        t        t        |d       t        t        t        |d       y )Nro   rr   r   r   r7   gT"@r  r  r  g      (@rc   r   re   rq   gW?"@r   gїʄ?nofror   r   )r   r  r   r   r   r   r!  r  s     r*   test_matrix_2x2z_TestNorm2D.test_matrix_2x2  s    JJAA'twwJ7DGY/DENI6DEND1DCL$/DSDM3/DAJ-DBK-DAJ(:;DBK)<=j$73j$2.j$1-r,   c                    d| j                  g dg dg dg| j                        z  }t        t        |      d       t        t        |d      d       t        t        |d      d	       t        t        |t              d
       t        t        |t               d       t        t        |d      d       t        t        |d      d       t        t        |d      d       t        t        |d      d       y )Ng?r  )r   r   r   )rr   rq   ro   r7   grj=Q0?r  r  gB+pc?g?g333333?ro   r`   r   g?rq   g&.d?r   gܸՠ?)r   r  r   r   r   r  s     r*   test_matrix_3x3z_TestNorm2D.test_matrix_3x3  s    
 JJ	9i8JHIDG%9:DEN,@ADEN,>?DCL#.DSDM3/DAJ,DBK-DAJ(;<DBK)<=r,   c                    | j                  g dg dg| j                        }t        j                  dd| j                        j	                  ddd      }t        t        t        |d	d
       t        t        t        |dd
       t        t        t        ddgd	d        t        t        t        ddgdd        t        t        t        ddgdd        dD ]G  }t        t        t        ||d        t        t        t        ||d       t        t        t        ||d       I t        t        t        |d d       t        t        t        |d d       t        t        t        |d d       y )Nr  r  r7   ro   r  rq   rr   rs   r  r   r  testr   rr   rQ  )ro   rq   rq   rr   r   ro   rq   )	r   r  r&   r   r   r   r!  r   r   )rJ   r  r  r  s       r*   test_bad_argsz_TestNorm2D.test_bad_args  s    JJ	9-TWWJ=IIa477+33Aq!<
 	j$5!4j$5!4j$At<j$At<j$A= E*dAud;*dAuf=*dAuf=  	iq$2iq$7j$4;r,   N)
rT   rU   rV   r&   r   r  r  r  r  r  rX   r,   r*   r  r    s)     HHEA1Nf. >"<r,   r  c                       e Zd Zy)	_TestNormNr  rX   r,   r*   r  r    r  r,   r  c                       e Zd Zd Zd Zd Zy)TestNorm_NonSystematicc                     t        j                  dt         j                        }t        t	        |d      dd       y )N
   r7   rr   r  gL)@rq   r  )r&   r   
longdoubler0   r   rE  s     r*   test_longdouble_normz+TestNorm_NonSystematic.test_longdouble_norm  s*     IIb.QAqAr,   c                     t        j                  dgt         j                        }t        t	        |d      dd       y )Ni   r7   rr   r  l        r   r  )r&   r   int32r0   r   rE  s     r*   test_intminz"TestNorm_NonSystematic.test_intmin  s,     HHhZrxx0QACr,   c                    t        j                  dt         j                        }d|d<   d|d<   d}t        t         j                  j                  |d	      |d
       |j                  t         j                        }t        t         j                  j                  |d	      |d       |j                  t         j                        }t        t         j                  j                  |d	      |d       y )Nrq   r7   y      @      @r   y            @ro   gV;'@rr   r  r  r  	   r   )	r&   r   clongdoubler0   r   r   r  
complex128r>  )rJ   r  r@  s      r*   test_complex_high_ordz,TestNorm_NonSystematic.test_complex_high_ord#  s    HHT0!!		qa 8#rJHHR]]#		qa 8#qIHHR\\"		qa 8#qIr,   N)rT   rU   rV   r  r  r  rX   r,   r*   r  r    s    BD
Jr,   r  c                   (    e Zd Zej                  ZdZy)_TestNormDoubleBase   N)rT   rU   rV   r&   r   r  ri  rX   r,   r*   r  r  1  s    	B
Cr,   r  c                   (    e Zd Zej                  ZdZy)_TestNormSingleBaser   N)rT   rU   rV   r&   r  r  ri  rX   r,   r*   r  r  6  s    	B
Cr,   r  c                   (    e Zd Zej                  ZdZy)_TestNormInt64Baser  N)rT   rU   rV   r&   int64r  ri  rX   r,   r*   r  r  ;  s    	B
Cr,   r  c                       e Zd Zy)TestNormDoubleNr  rX   r,   r*   r  r  @  r  r,   r  c                       e Zd Zy)TestNormSingleNr  rX   r,   r*   r  r  D  r  r,   r  c                       e Zd Zy)TestNormInt64Nr  rX   r,   r*   r  r  H  r  r,   r  c                       e Zd Zd Zd Zy)TestMatrixRankc                    t        dt        t        j                  d                   t        j                  d      }d|d<   t        t        |      d       t        t        t        j                  d            d       t        t        g d      d       t        t        t        j                  d	            d       t        t        dg      d       t        j
                  |t        j                  d      t        j                  d      g      }t        t        |      t        j
                  g d
             t        t        d      d       t        t        d      5  t        |dd       d d d        y # 1 sw Y   y xY w)Nrs   r  r   r   rr   ru  r   )ro   r   r   r   ro   )rs   )rr   rs   r   z#`tol` and `rtol` can't be both set.g{Gz?)tolrV  )r   r   r&   rv  r;  r   r   r!  )rJ   Imss      r*   test_matrix_rankzTestMatrixRank.test_matrix_rankN  s   QBFF1I./FF1I&	[^Q'[&!12A6[.2[$0!4[!%q)XXq"&&)RXXe_56[_bhhy&9:[^Q' >
 t$/
 
 
s   "E::Fc                    t        dt        t        j                  d      d             t        dt        t        j                  d      d             t        dt        t        j
                  d      d             t        j                  d      }d|d<   t        d	t        |d             d
|d<   t        dt        |dd             t        d	t        |dd             y )Nrs   Tr  ro   ru  r   r  r  rr   g:0yE>g|"BE>)r?   r  g;䡈E>)r   r   r&   rv  r  r;  )rJ   r  s     r*   test_symmetric_rankz"TestMatrixRank.test_symmetric_rankg  s    QBFF1I>?QBGGFOtDEQBHHV$4EFFF1I&	QA67&	QA7CDQA7CDr,   N)rT   rU   rV   r  r  rX   r,   r*   r  r  L  s    02Er,   r  c                  B   t         j                  j                  d      } t        d      D ]r  }| j	                  d      }|d d df   |d d df   z   |d d df<   t        t        |      d       |d d d	f   |d d d
f   z   |d d df<   t        t        |      d       t y )Ni3r  )(   r  sizero   rq   r   r  rs   r   rr   rm   )r&   r  RandomStater  normalr   r   )rngiXs      r*   test_reduced_rankr  u  s    
))


)C3ZJJHJ%AqD'AadG#!Q$[^Q'AqD'AadG#!Q$[^Q' r,   c            	          e Zd Zej                  Zd Zej                  j                  ddgg d      d        Z	d Z
d Zd Zej                  j                  d	g d
      ej                  j                  dg d      ej                  j                  dej                  ej                  ej                  ej                   g      d                      Zy)TestQRc                    t        |      }|j                  }|j                  \  }}t        ||      }t	        j
                  |d      }|j                  |j                  }	}t        |j                  |k(         t        |	j                  |k(         t        t        ||             t        t        |	|             t        |j                  ||fk(         t        |	j                  ||fk(         t        t        ||	      |       t        t        |j                  j                         |      t        j                  |             t        t        j                   |	      |	       t	        j
                  |d      \  }
}t        |
j                  |k(         t        |j                  |k(         t        t        |
|             t        t        ||             t        |
j                  ||fk(         t        |j                  ||fk(         t        t        |
|      |       t        t        |
j                  j                         |
      t        j                  |             t        t        j                   |      |       t	        j
                  |d      }t        |j                  |k(         t        t        ||             t        ||       y )Ncompletemodereducedr  )r$   r/   r   r  r   qrQRr   r%   r   r   r  r  r&   rv  triu)rJ   r1   a_typea_dtyper  r  r  r@  r  r  q1r1r2s                r*   check_qrzTestQR.check_qr  s    a''ww11I ii
+uucee17"#7"#
1f%&
1f%&Aq6!"Aq6!"C1Iq)C
A.q	:BGGAJ* 19-BG#$G#$
2v&'
2v&'QF"#QF"#CBK+C		R0"&&)<BGGBK, YYqs#G#$
2v&'B#r,   r  r  )rr   r   r  rj   c                    t        ||      }t        j                  ||f      }| j                  |       t        j                  j                  |d      \  }}t        |j                  t        j                         t        |j                  t        j                         t        |j                  ||f       t        |j                  |f       y )Nrawr  )
r  r&   r   r  r   r  r   r/   r   r   )rJ   r  r  r  r1   htaus          r*   test_qr_emptyzTestQR.test_qr_empty  s     1IHHaVaae,3QWWbii(SYY		*QWWq!f%SYY%r,   c                    | j                  ddgddgddggt        j                        }t        j                  |d	      \  }}t        |j                  t        j                  k(         t        |j                  t        j                  k(         t        |j                  d
k(         t        |j                  dk(         t        j                  |j                  d	      \  }}t        |j                  t        j                  k(         t        |j                  t        j                  k(         t        |j                  dk(         t        |j                  dk(         y )Nro   rq   rr   rs   r   r   r7   r  r  r  r  r   )	r   r&   r   r   r  r   r/   r   r  )rJ   r1   r  r  s       r*   test_mode_rawzTestQR.test_mode_raw  s     JJAAA/ryyJA 15)3299$%		RYY&'6!"		T!"133U+3299$%		RYY&'6!"		T!"r,   c                    | j                  ddgddgg      }| j                  ddgddgddgg      }dD ]a  }|j                  |      }|j                  |      }| j                  |       | j                  |       | j                  |j                         c dD ]m  }dd|j                  |      z  z   }dd|j                  |      z  z   }| j                  |       | j                  |       | j                  |j                         o y )	Nro   rq   rr   rs   r   r   fd              ?)r   r  r  r  )rJ   r1   r2   r  m1m2s         r*   test_mode_all_but_economicz!TestQR.test_mode_all_but_economic  s    JJAA'(JJAAA/0B"B"BMM"MM"MM"$$  BR!((2,&&BR!((2,&&BMM"MM"MM"$$ r,   c           	         t        |      }|j                  }|j                  dd  \  }}t        ||      }t	        j
                  |d      \  }}t        |j                  |k(         t        |j                  |k(         t        t        ||             t        t        ||             t        |j                  dd  ||fk(         t        |j                  dd  ||fk(         t        t        ||      |       t        j                  |j                  d         }	t        j                  |	|j                  d d |j                  d   fdz  z         }
t        t        t        |dd      j                         |      |
       t        t        j                  |dd d d d f         |       t	        j
                  |d      \  }}t        |j                  |k(         t        |j                  |k(         t        t        ||             t        t        ||             t        |j                  dd  ||fk(         t        |j                  dd  ||fk(         t        t        ||      |       t        j                  |j                  d         }	t        j                  |	|j                  d d |j                  d   fdz  z         }
t        t        t        |dd      j                         |      |
       t        t        j                  |dd d d d f         |       t	        j
                  |d      }t        |j                  |k(         t        t        ||             t        ||       y )	Nr   r  r  r   rq   .r  r  )r$   r/   r   r  r   r  r   r%   r   r
   r&   r	   r  r   r  r  )rJ   r1   r  r  r  r  r  qr  I_matstack_I_matr  r  r  s                 r*   check_qr_stackedzTestQR.check_qr_stacked  s    a''wwrs|11I yy,17"#7"#
1f%&
1f%&A&'A&'F1aL!,AGGBK(ooe~a'779F8Ar2#6#;#;#=qA;OBGGAc1aiL115 19-BG#$G#$
2v&'
2v&'!Q'(!Q'(F2rNA.BHHRL)ooe""(99;F8BB#7#<#<#>C'	)BGGBsAqyM2B7 YYqs#G#$
2v&'B#r,   r  ))rr   rs   )rs   rr   ru  r  r  
outer_size)r  r  )rq   rr   rs   r  c                 "   t         j                  j                  d      }|j                  ||z         j	                  |      }|j                  ||z         j	                  |      }| j                  |       | j                  |d|z  z          y )N{   r  r  )r&   r  default_rngr  r  r  )rJ   r  r  r  r  r  r  s          r*   test_stacked_inputszTestQR.test_stacked_inputs  s|     ii##C(JJJ-J.55b9JJJ-J.55b9a a#a%i(r,   N)rT   rU   rV   r&   r   r  r   r   r.  r  r   r  r  r   r   r   r   r  rX   r,   r*   r  r    s    HHE%$P [[c3Z * 

&

&#, "+$Z [[V &  [[\ ,! "[[T
		299


BJJ$  !)!")r,   r  c                   8   e Zd Zej                  j                  dg d      ej                  j                  dej                  ej                  ej                  ej                  f      ej                  j                  dddg      d                      Zd Zd	 Zy
)TestCholeskyr   )r   r  rr   rr   )2   r  )rr   r  r  r/   rD  FTc                    t         j                  j                  d       t        j                  j                  | }t        j                  |t         j
                        r"|dt        j                  j                  | z  z   }t        t        t        |                  }d|dd  t        j                  |j                  |      j                         |      }t        j                  ||      }t         j                  j                  ||      }|r4t        j                  |j                  |      j                         |      }n3t        j                  ||j                  |      j                               }t        j                         5  d|j                   d   z  t        j"                  |      j$                  z  }d d d        t'        ||| d	| d
| d
|        t        j(                  |dd      }	t+        t        j,                  t        j.                  |	                   t+        t        j,                  |	dk\               y # 1 sw Y   xY w)Nro   r  )r   r   r   r7   rD  i  r    
)atolrU  r   )axis1axis2)r&   r  r  randnr  complexfloatingr   r  r  r
   r  r  r   r   cholesky_no_nep50_warningr   finfoepsr   diagonalr   r   isreal)
rJ   r   r/   rD  r1   tr  r2   r  r  s
             r*   test_basic_propertyz TestCholesky.test_basic_property&  s    			qIIOOU#== 2 23Bryy...As5z"#"#IIakk!n))+Q/JJq&IIq. 		!++a.--/3A		!Q[[^0023A!!##bhhuo&9&99D $14E7!E7"QCr!1MN KK2.ryy|$%qAv $#s   3IIc                 "    G d dt         j                        }t        j                  dt         j                        j	                  |      }t        j                  |      }t        |j                  |j                         t        |j                  j                  t         j                  u        t        t        |t         j                               t        j                  dt         j                        j	                  |      }t        j                  |      }t        |j                  |j                         t        |j                  j                  t         j                  u        t        t        |t         j                               y )Nc                       e Zd Zy)/TestCholesky.test_0_size.<locals>.ArraySubclassNr  rX   r,   r*   r  r(  K  r  r,   r  r:  r7   )ro   r   r   )r&   r'   r;  r<  r   r   r  r   r   r   r/   r$   r=  r%   r>  r?  s       r*   r)  zTestCholesky.test_0_sizeJ  s    	BJJ 	HHYbgg.33MBooa QWWcii(		"**,-
3

+,HHYbll388Gooa QWWcii(		",,./
3

+,r,   c                 :   t        j                  ddgddgg      }t        t        j                  |      t        j                  |d             t        t        j                  |d      t        j                  |      j
                  j                                y )Ny      ?        y               y               @y      @        Fr  T)r&   r   r   r   r  r  r  )rJ   r1   s     r*   test_upper_lower_argz!TestCholesky.test_upper_lower_argZ  sl    HHtTlT4L12V__Q'%)HIOOAT*OOA  %%'	
r,   N)rT   rU   rV   r   r   r.  r&   r  r=  r>  r  r%  r)  r*  rX   r,   r*   r  r  $  s    [[@ [["**bjj",,F [[%    8- 	
r,   r  c                   f   e Zd Z ej                  d      Z ej                  d      Z ej                  g dg dg dg      Z e	ej                  j                  ee      e        eed      5  ej                  j                  eddej                  f   e       ddd       y# 1 sw Y   yxY w)	TestOuterrr   r  r  )r   rq   rs   z$Input arrays must be one-dimensionalN)rT   rU   rV   r&   r   arr1arr2r   r(  r   r   outerr   r!  newaxisrX   r,   r*   r,  r,  f  s    299Q<D299Q<Drxx				H ryytT2H=	:
 			Q

]+T2
 
 
s   0.B''B0r,  c                  p   t         j                  dk(  rd} nd} t        j                  t        j                  fD ]  }t        j
                  d|      }|j                  |j                  j                  |             }|j                  |j                  j                  d            j                         }t        |j                  j                  d       t        j                  t        j                  t        j                  fD ].  } ||      }t        | ||             t        | ||             0  y )Nlittle<rQ   rs   r7   rk  =)sys	byteorderr&   r  r=  rv  r   r/   newbyteorderbyteswapr   r   r2  r  r  r   )nativedttr  n_arrsw_arrroutiner@  s          r*   test_byteorder_checkr>  w  s    
}} 

BJJ'ffQc"//78#))0056??ASYY((#.

FJJ<G#,CsGEN3sGFO4 = (r,   r.  r/  c                  8   t        j                  ddgddgg      } t        j                  ddgddgg      }t        j                  g d      dd d   }| |d<   ||d<   t        t         j                  j
                  t         j                  j                  |       y )Nro   rq   rr   rs   )rs   rs   rq   rq   .rj   )r&   r   r;  r   r   r   r2  )
invertiblenon_invertibler   s      r*    test_generalized_raise_multilooprB    s    
 Aq6Aq6*+JXX1v1v./N
qt!t$AAcFAdG"))'':r,   c                     d} 	 t        j                         }dk(  rt        j                  d       t        j                  d       dd l}|j                  |j                  d       	 t        j                  j                  j                          	 t        j$                  dgg      }t        j                  j                  j'                  ddd|d||dd	       t        j                   t         j"                         y t        j*                         \  }}t        j,                  |      | k7  rt	        j
                  d       y y # t        t        f$ r t	        j
                  d       Y Rw xY w# t        $ r Y t        $ r' t        j                   t         j"                         Y w xY w# t        $ r-}dt)        |      v rt        j                   |        Y d }~d }~ww xY w)	N   zNot POSIX or fork failed.r   ro   rj   r`   zDORGQR parameter number 5zNumpy xerbla not linked in.)osforkOSErrorAttributeErrorr   skipcloseresource	setrlimitRLIMIT_COREr&   r   lapack_litexerblar!  r   _exit	EX_CONFIGr   dorgqrrF   waitWEXITSTATUS)	XERBLA_OKpidrK  r1   r   statuss         r*   test_xerbla_overriderX    sq   
 I1ggi
 ax

8//8	#II!!((*
	$2$ AII!!((1a1a 	 ggiV>>&!Y.KK56 /I ^$ 1/01  	 	#HHR\\"	#  	$*c!f4 #		$sB   E ((E. AF+ $E+*E+.	F(9+F('F(+	G!4"GG!zCannot start subprocessc                  ,   ddg} t        j                  d      }| D ]v  }|j                  dd|      }t        j                  t
        j                  d|g       |j                  dd|      }t        j                  t
        j                  d|g       x y )	NzPyQt5.QtWidgetsIPythonz
    import sys
    {before}
    try:
        import {bad_lib}
    except ImportError:
        sys.exit(0)
    {after}
    x = np.ones(2, dtype=np.float32)
    sys.exit(0 if np.allclose(x.dot(x), 2.0) else 1)
    zimport numpy as np )beforeafterbad_libz-c)r]  r\  r^  )textwrapdedentr  
subprocess
check_callr5  
executable)bad_libstemplater^  codes       r*   test_sdot_bug_8577rg    s     "9-H 
  
	H &:"'.  0s~~tT:; %9"'.  0s~~tT:; r,   c                   N    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zy)TestMultiDotc           
         t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t        t        |||g      |j	                  |      j	                  |             t        t        |||g      t        j                  |t        j                  ||                   y Nr   rq   rq   r   r&   r  r   r   r   )rJ   r  r  Cs       r*   (test_basic_function_with_three_argumentsz5TestMultiDot.test_basic_function_with_three_arguments  s     IIV$IIV$IIV$Iq!Qi0!%%(,,q/BIq!Qi0"&&BFF1aL2IJr,   c                 "   t         j                  j                  d      }t         j                  j                  d      }t        t        ||g      |j	                  |             t        t        ||g      t        j                  ||             y rk  rn  )rJ   r  r  s      r*   &test_basic_function_with_two_argumentsz3TestMultiDot.test_basic_function_with_two_arguments  sb    IIV$IIV$Iq!f-quuQx8Iq!f-rvva|<r,   c                    t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t        t        ||||g      |j	                  |      j	                  |      j	                  |             y )Nrl  rm  rq   ro   rn  )rJ   r  r  ro  Ds        r*   9test_basic_function_with_dynamic_programming_optimizationzFTestMultiDot.test_basic_function_with_dynamic_programming_optimization  s     IIV$IIV$IIV$IIV$Iq!Ql3QUU1X\\!_5H5H5KLr,   c                 B   t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t        t        ||||g      j                  d       y )Nrq   rm  rl  r  r  r&   r  r   r   r   )rJ   A1dr  ro  ru  s        r*   test_vector_as_first_argumentz*TestMultiDot.test_vector_as_first_argument  sq    iiq!IIV$IIV$IIV$ 	YQ1~.44d;r,   c                 B   t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t        t        ||||g      j                  d       y )Nrl  rm  rq   )r   rx  )rJ   r  r  ro  D1ds        r*   test_vector_as_last_argumentz)TestMultiDot.test_vector_as_last_argument  sq    IIV$IIV$IIV$iiq! 	Y1a~.44d;r,   c                 B   t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t        t        ||||g      j                  d       y )Nrq   rm  rl  rX   rx  )rJ   ry  r  ro  r|  s        r*   &test_vector_as_first_and_last_argumentz3TestMultiDot.test_vector_as_first_and_last_argument!  sr    iiq!IIV$IIV$iiq! 	YQ3/066;r,   c           
         t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t        j                  d      }t        |||g|      }||u sJ t	        ||j                  |      j                  |             t	        |t        j
                  |t        j
                  ||                   y )Nrl  rm  r(   r&   r  r;  r   r   r   )rJ   r  r  ro  r(   rets         r*   test_three_arguments_and_outz)TestMultiDot.test_three_arguments_and_out+  s     IIV$IIV$IIV$hhvAq	s+czzCqa1C266!Q<!89r,   c                 J   t         j                  j                  d      }t         j                  j                  d      }t        j                  d      }t        ||g|      }||u sJ t	        ||j                  |             t	        |t        j
                  ||             y )Nrl  rm  )r   r   r  r  )rJ   r  r  r(   r  s        r*   test_two_arguments_and_outz'TestMultiDot.test_two_arguments_and_out8  sz    IIV$IIV$hhvAC(czzCq*C1.r,   c                    t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t         j                  j                  d      }t        j                  d      }t        ||||g|      }||u sJ t	        ||j                  |      j                  |      j                  |             y )Nrl  rm  rt  )r   ro   r  r  )rJ   r  r  ro  ru  r(   r  s          r*   -test_dynamic_programming_optimization_and_outz:TestMultiDot.test_dynamic_programming_optimization_and_outB  s     IIV$IIV$IIV$IIV$hhvAq!#.czzCqa!4!4Q!78r,   c           	      .   t         j                  j                  d      t         j                  j                  d      t         j                  j                  d      t         j                  j                  d      t         j                  j                  d      t         j                  j                  d      g}t        j                  g dg dg d	g d
g dg dg      }t        j                  g dg dg dg dg dg dgt              }|dz  }t	        |d      \  }}t        t        j                  |d ddd f         t        j                  |d ddd f                t        t        j                  |      t        j                  |             y )N)   #   )r     )r  r   )r   r  )r     )r  r  )r  g     @g     þ@g    O@g    1@g    @)r  r  g     @g     @g     ջ@g     @)r  r  r  g     p@g     @g     @)r  r  r  r  g     @@g     X@)r  r  r  r  r  g     @)r  r  r  r  r  r  )r   ro   ro   rr   rr   rr   )r   r   rq   rr   rr   rr   )r   r   r   rr   rr   rr   )r   r   r   r   rs   r   )r   r   r   r   r   r   )r   r   r   r   r   r   r7   ro   T)return_costsr   )r&   r  r   intr   r   r  )rJ   arrays
m_expected
s_expectedr   r  s         r*   test_dynamic_programming_logicz+TestMultiDot.test_dynamic_programming_logicN  sC    ))""8,))""8,))""7+))""7+))""8,))""8,. XXIIIIIIK L
 XX6666668
 @CD
 	a
,V$G1 	BGGAcrc12gJ/GGJssABw$78	:BGGAJ
(;<r,   c                     t        t        t        g        t        t        t        t        j                  j	                  d      g       y )Nr  )r   r!  r   r&   r  rR   s    r*   test_too_few_input_arraysz&TestMultiDot.test_too_few_input_arraysl  s,    j)R0j)bii.>.>v.F-GHr,   N)rT   rU   rV   rp  rr  rv  rz  r}  r  r  r  r  r  r  rX   r,   r*   ri  ri    s<    K=M<<<:/
9=<Ir,   ri  c                   2   e Zd Zej                  j                  d ej                  d      df ej                  d      dfg      d        Zej                  j                  ddd	g      d
        Z	ej                  j                  dddg      d        Z
d Zy)TestTensorinvzarr, indrs   r   rm   rq   rq   rr   rr   rq   ro   c                 z    t        t              5  t        j                  ||       d d d        y # 1 sw Y   y xY w)Nind)r   r   r   	tensorinv)rJ   r  r  s      r*   test_non_square_handlingz&TestTensorinv.test_non_square_handlings  s(    
 ;'Sc* (''s   1:z
shape, ind)rs   r   rm   rr   rq   )   rm   rr   ro   c                     t        j                  d      }||_        t        j                  ||      }|j                  |d  |j                  d | z   }|j                  }t        ||       y )Nr  r1   r  )r&   rv  r   r   r  r   )rJ   r   r  r1   ainvr(  actuals          r*   test_tensorinv_shapez"TestTensorinv.test_tensorinv_shape{  s[     FF2J!-7734=1774C=0VX&r,   r  r   r   c                     t        j                  d      }d|_        t        t              5  t        j                  ||       d d d        y # 1 sw Y   y xY w)Nr  r  r  )r&   rv  r   r   r!  r   r  )rJ   r  r1   s      r*   test_tensorinv_ind_limitz&TestTensorinv.test_tensorinv_ind_limit  s<     FF2J:&qc* '&&s   AAc                    t        j                  d      }d|_        t        j                  |d      }t        j
                  d      }t        t        j                  ||d      t         j                  j                  ||             y )Nr  r  ro   r  )	r&   rv  r   r   r  r  r   	tensordottensorsolve)rJ   r1   r  r2   s       r*   test_tensorinv_resultz#TestTensorinv.test_tensorinv_result  s]    FF2Jq)GGBKT1a0"))2G2G12MNr,   N)rT   rU   rV   r   r   r.  r&   r  r  r  r  r  rX   r,   r*   r  r  q  s    [[Z		"		Q*
 +	+ [[\,
 
'
' [[U	2%
 ++Or,   r  c                       e Zd Zej                  j                  d ej                  d      df ej                  d      dfg      d        Zej                  j                  dg d      d	        Z	y)
TestTensorsolveza, axesr  Nr  )r   rq   c                     t        t              5  t        j                  |j                  d d       }t        j                  |||       d d d        y # 1 sw Y   y xY wNrq   r  )r   r   r&   r  r   r   r  )rJ   r1   r  r2   s       r*   r  z(TestTensorsolve.test_non_square_handling  sB    
 ;'$Aq!$/ (''s   ;AAr   ))rq   rr   r   )rr   rs   rs   rr   )r   rr   rr   r   c           	      *   t        j                  j                  | }t        j                  |j                  d d       }t         j
                  j                  ||      }t        t        j                  ||t        |j                              |       y r  )
r&   r  r  r  r   r   r  r   r  r  )rJ   r   r1   r2   r   s        r*   test_tensorsolve_resultz'TestTensorsolve.test_tensorsolve_result  sc     IIOOU#GGAGGBQK II!!!Q'QAGG=qAr,   )
rT   rU   rV   r   r   r.  r&   r  r  r  rX   r,   r*   r  r    sz    [[Y		%		V$)
 0	0
 [[W/BBr,   r  c                      t        j                  ddgddggd      } t        t        d      5  t	        j
                  |        d d d        y # 1 sw Y   y xY w)Nro   r   rq   r   float16r7   zunsupported in linalg)r&   r   r   r)  r   r  )r  s    r*   test_unsupported_commontyper    sC    
((QGaV$I
6C	Y(?	@ 
A	@	@s   AAz,Bad memory reports lead to OOM in ci testingc                      d} t        j                  d| gt         j                        }t        j                  ddgt         j                        }d|d<   t        j                  ||      }t        |d   d       y )N        ro   r7   )r   r   )r&   r;  r  r  r   r   )r  r1   r2   r  s       r*   test_blas64_dotr    s]    A
!Qrzz*A
Abjj)AAdG
q!A4!r,   z*Numpy not compiled with 64-bit BLAS/LAPACKc            
         t         j                  } t         j                  j                  j                  }d}d}|}t        j
                  ddg|       }t        j
                  dg|       }t        j
                  dg|       } |||||||dd      }t        |d   d       t        |d   |       t        |d   |       t        |j                               }	t        d	|	cxk  xr
 d
k         y c        y )Nl       ro   r7   r   r   infor  r  r  l        )
r&   r=  r   rN  dgeqrfr;  r   r  itemr   )
r/   lapack_routiner  r  ldar1   workr  resultslworks
             r*   !test_blas64_geqrf_lwork_smoketestr    s     JJEYY**11NAA
C 	!Qu%A88QCu%D
((A3e
$C Q1c3b!<G!$q!q! 		EEE!E!"!"r,   c                      t        j                  d      j                  d      } t         j                  j	                  |       }t        j
                  g dg dg dg      }t        ||       y )N<   rr   rs   r   )r   r   r     )r     r	  &   )r  .   4   :   )r&   r   r   r   r"  r   r   r   r  r(  s      r*   test_diagonalr    sX     			"i(AYY"Fxx	
H "r,   c                      t        j                  d      j                  d      } t         j                  j	                  |       }t        j
                  g d      }t        ||       y )Nr  r  )$   t      )r&   r   r   r   tracer   r   r  s      r*   
test_tracer    sF     			"i(AYY__QFxx'H"r,   c                     t        j                  d      j                  d      } t         j                  j	                  | | dz         }t        j
                  g dg dg dg      }t        ||       g d}g d}t         j                  j	                  ||      }t        g d      }t        ||       t        t        d      5  | d d dd f   }t         j                  j	                  ||       d d d        y # 1 sw Y   y xY w)	Nr  r  ro   )r   rq   r   r  r  )r   r   r   z8input arrays must be \(arrays of\) 3-dimensional vectors)	r&   r   r   r   crossr   r   r   r!  )r   r  r(  rp  r^  x_2dims         r*   
test_crossr    s    
		!V$AYY__QA&Fxx H " 	AAYY__Q"F\"H"	C
 1ab5
		'
 
 
s   ,C88Dc                      t        j                  d      j                  d      } t         j                  j	                  | |       dk(  sJ t         j                  j	                  | | ddg      dk(  sJ y )Nr   r  7   rQ  r  )r&   r   r   r   r  )r   s    r*   test_tensordotr  	  sb    
		!V$A99q!$***99q!66*:;rAAAr,   c                      t        j                  d      j                  d      } t         j                  j	                  | | j
                        }t        j                  ddgddgg      }t        ||       y )Nr   r  r      r  )r&   r   r   r   r
   r  r   r   r  s      r*   test_matmulr  	  s[     			!V$AYYa%Fxx!R2r(+,H"r,   c                  P   t        j                  d      j                  d      } t         j                  j	                  |       }| j
                  }t        ||       t        t        d      5  t         j                  j	                  | d d df          d d d        y # 1 sw Y   y xY w)Nr   r  z$array must be at least 2-dimensionalr   )	r&   r   r   r   matrix_transposer  r   r   r!  r  s      r*   test_matrix_transposer  (	  s{    
		!V$AYY''*FssH"	:
 			""1QT7+
 
 
s   ,'BB%c                  T   t        j                  d      j                  d      } t         j                  j	                  |       }t        |t        j                  d      d       t         j                  j	                  | d      }t        |t        j                  dgg      d       y )Nr  r  ^)ː,@rr   r4   Tr  )r&   r   r   r   matrix_normr   r=  r   )r   r  s     r*   test_matrix_normr  5	  su    
		!V$AYY""1%F

7 3AFYY""1t"4F7) 5aHr,   c                  "   t        j                  d      j                  d      } t         j                  j	                  |       }t        |t        j                  d      d       t         j                  j	                  | d      }t        |t        j                  g d      d       t         j                  j	                  | d	
      }t        j                  ddd      }t        |j                  |j                         t        ||d       y )Nr  r  r  rr   r  r   r  )g|a2@gsh|? @gDioI#@Tr  r   r=  r7   )r&   r   r   r   vector_normr   r=  r   fullr   r   r  s      r*   test_vector_normr  @	  s    
		!V$AYY""1%F

7 3AFYY""11"-F01! YY""1t"4Fwwvwi8Hx~~.;r,   )r   r  )__doc__rE  r5  r   r   r_  ra  r   numpyr&   r   r   r   r   r   r   r	   r
   numpy._corer   numpy.exceptionsr   r   r   r   r   r   numpy.linalgr   r   r   r   r   numpy.linalg._linalgr   numpy.testingr   r   r   r   r   r   r   r   r    r!   numpy.linalg.lapack_liteImportErrorr+   r0   r8   r:   r<   rZ   rD   r^   r  r  r   r   r  r   r   r   r   r   r   r   r   r   r  r	  r  r  r0  r5  rC  rK  rS  rZ  re  rn  rs  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r.  r/   r  r6  r<  rS  r[  rc  rl  r  r  r  r  r  r  r  r  r  r  r  r  r  r,  r>  r4  rB  rX  r   rg  ri  r  r  r  rI  r  r  r  r  r  r  r  r  r  r  r  )r  s   0r*   <module>r     s}   
 
       P P P   & 4 4  P P >  
	#* . 95
7
, ,, 		t 
 8xr2hR)8b"XV,. xr2hR)8b"XV,. zr2hR)8lL1@B yw'&&)9:'Jgw'w79 yw'&&)9:'Jgw'w79 {w'&&)9:'J02JKSZ[] urxxf-rxxF+J  uyy~~a#yy~~a " uyy~~a#yy~~a " zAA1v;   
  F ;~lL1@b"XV,. ~r2hR2r(36B\02 ~lL1@b"XV,. ~r2hR2r(36B\02 /1LMU\^gw'w79 g&'(:Wg<NOW^`0@B /1LMU\^gw'w79 g&'(:Wg<NOW^`0@B  /1LMU\^w(66*:;7KM  g&'(:Wg<NOW^`w(66*:VV<LMU\]_ vyy~~a$yy~~a " uyy~~a#yy~~a " uyy~~a#yy~~a " uyy~~a#yy~~a J  uyy~~a#yy~~a J e6! 6
 6r ;yr2hR)8 yr2hR)8 zr6lVQK0@ zr6lVQK0@ xrxxf-J  {AA r2hR)* }yy~~a#/! 
 @B 	 	" "-'` 		 1 1.2> 22n 22 2	Fn 	F	I 	I
+> 
+$+%'F +H3
 H3V/#%D /0h 0.)')H )-, -66#%D 6!+h !+H5 5,#%D ,8h 8,,)+G ,&(, +1$&E +1\@)y @)F
0$'/2
0	y 	0*,H 0	* 	/##%D #*'1h '1T3%'> 3<.+
 .+b 5HI5H5HIJS: S: KS:l?)+G ?3- 3-lB%'C B.8+ 8+v
= 
=[Q} [Q|u<- u<p	- 	J J8- 
- 
 
	Y 3 		Y 3 		I1 	&E &ER
(_) _)D?
 ?
D3 3"5* G$BC; D;.7b G$=><  ?<D~I ~IB&O &ORB B* GH I |#F  H#H#4# #(6B#
,I<KI  	 			L  Js   e e
e
	e
