#NEWLINE# def test_returns( self ) : #NEWLINE# #INDENT# np . random . seed ( 1234 ) #NEWLINE# A = scipy . sparse . rand ( 50 , 50 , 0.1 ) #NEWLINE# s0 = scipy . linalg . norm ( A . todense ( ) , 1 ) #NEWLINE# ( s1 , v ) = scipy . sparse . linalg . onenormest ( A , compute_v = True ) #NEWLINE# ( s2 , w ) = scipy . sparse . linalg . onenormest ( A , compute_w = True ) #NEWLINE# ( s3 , v2 , w2 ) = scipy . sparse . linalg . onenormest ( A , compute_w = True , compute_v = True ) #NEWLINE# assert_allclose ( s1 , s0 , rtol = 1e-09 ) #NEWLINE# assert_allclose ( np . linalg . norm ( A . dot ( v ) , 1 ) , ( s0 * np . linalg . norm ( v , 1 ) ) , rtol = 1e-09 ) #NEWLINE# assert_allclose ( A . dot ( v ) , w , rtol = 1e-09 )