#NEWLINE# def test_gelsy( self ) : #NEWLINE# #INDENT# for dtype in REAL_DTYPES : #NEWLINE# #INDENT# a1 = np . array ( [ [ 1.0 , 2.0 ] , [ 4.0 , 5.0 ] , [ 7.0 , 8.0 ] ] , dtype = dtype ) #NEWLINE# b1 = np . array ( [ 16.0 , 17.0 , 20.0 ] , dtype = dtype ) #NEWLINE# ( gelsy , gelsy_lwork ) = get_lapack_funcs ( ( 'gelsy' , 'gelss_lwork' ) , ( a1 , b1 ) ) #NEWLINE# ( m , n ) = a1 . shape #NEWLINE# if ( len ( b1 . shape ) == 2 ) : #NEWLINE# #INDENT# nrhs = b1 . shape [ 1 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# nrhs = 1 #NEWLINE# #UNINDENT# ( work , info ) = gelsy_lwork ( m , n , nrhs , ( 10 * np . finfo ( dtype ) . eps ) ) #NEWLINE# lwork = int ( np . real ( work ) ) #NEWLINE# jptv = np . zeros ( ( a1 . shape [ 1 ] , 1 ) , dtype = np . int32 ) #NEWLINE# ( v , x , j , rank , info ) = gelsy ( a1 , b1 , jptv , np . finfo ( dtype ) . eps , lwork , False , False ) #NEWLINE# assert_allclose ( x [ : ( - 1 ) ] , np . array ( [ ( - 14.333333333333323 ) , 14.999999999999991 ] , dtype = dtype ) , rtol = ( 25 * np . finfo ( dtype ) . eps ) ) #NEWLINE# #UNINDENT# for dtype in COMPLEX_DTYPES : #NEWLINE# #INDENT# a1 = np . array ( [ [ ( 1.0 + 4j ) , 2.0 ] , [ ( 4.0 + 0.5j ) , ( 5.0 - 3j ) ] , [ ( 7.0 - 2j ) , ( 8.0 + 0.7j ) ] ] , dtype = dtype ) #NEWLINE# b1 = np . array ( [ 16.0 , ( 17.0 + 2j ) , ( 20.0 - 4j ) ] , dtype = dtype ) #NEWLINE# ( gelsy , gelsy_lwork ) = get_lapack_funcs ( ( 'gelsy' , 'gelss_lwork' ) , ( a1 , b1 ) ) #NEWLINE# ( m , n ) = a1 . shape #NEWLINE# if ( len ( b1 . shape ) == 2 ) : #NEWLINE# #INDENT# nrhs = b1 . shape [ 1 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# nrhs = 1 #NEWLINE# #UNINDENT# ( work , info ) = gelsy_lwork ( m , n , nrhs , ( 10 * np . finfo ( dtype ) . eps ) ) #NEWLINE# lwork = int ( np . real ( work ) ) #NEWLINE# jptv = np . zeros ( ( a1 . shape [ 1 ] , 1 ) , dtype = np . int32 ) #NEWLINE# ( v , x , j , rank , info ) = gelsy ( a1 , b1 , jptv , np . finfo ( dtype ) . eps , lwork , False , False ) #NEWLINE# assert_allclose ( x [ : ( - 1 ) ] , np . array ( [ ( 1.161753632288328 - 1.901075709391912j ) , ( 1.735882340522193 + 1.521240901196909j ) ] , dtype = dtype ) , rtol = ( 25 * np . finfo ( dtype ) . eps ) )