#NEWLINE# def test_svd_simple_real( ) : #NEWLINE# #INDENT# x = np . array ( [ [ 1 , 2 , 3 ] , [ 3 , 4 , 3 ] , [ 1 , 0 , 2 ] , [ 0 , 0 , 1 ] ] , float ) #NEWLINE# y = np . array ( [ [ 1 , 2 , 3 , 8 ] , [ 3 , 4 , 3 , 5 ] , [ 1 , 0 , 2 , 3 ] , [ 0 , 0 , 1 , 0 ] ] , float ) #NEWLINE# z = csc_matrix ( x ) #NEWLINE# for m in [ x . T , x , y , z , z . T ] : #NEWLINE# #INDENT# for k in range ( 1 , min ( m . shape ) ) : #NEWLINE# #INDENT# ( u , s , vh ) = sorted_svd ( m , k ) #NEWLINE# ( su , ss , svh ) = svds ( m , k ) #NEWLINE# m_hat = svd_estimate ( u , s , vh ) #NEWLINE# sm_hat = svd_estimate ( su , ss , svh ) #NEWLINE# assert_array_almost_equal_nulp ( m_hat , ss , nulp = 1000 )