#NEWLINE# def test_simple_complex_pivoting( self ) : #NEWLINE# #INDENT# a = np . asarray ( [ [ 3 , ( 3 + 4j ) , 5 ] , [ 5 , 2 , ( 2 + 7j ) ] , [ 3 , 2 , 7 ] ] ) #NEWLINE# ( q , r , p ) = qr ( a , pivoting = True ) #NEWLINE# d = abs ( diag ( r ) ) #NEWLINE# assert_ ( all ( ( d [ 1 : ] <= d [ : ( - 1 ) ] ) ) ) #NEWLINE# assert_array_almost_equal ( dot ( conj ( transpose ( q ) ) , a ) , identity ( 3 ) ) #NEWLINE# assert_array_almost_equal ( dot ( q , r ) , a [ : , p ] ) #NEWLINE# ( q2 , r2 ) = qr ( a [ : , p ] ) #NEWLINE# assert_array_almost_equal ( q , q2 ) #NEWLINE# assert_array_almost_equal ( r , r2 )