#NEWLINE# @ decorators . slow #NEWLINE# @ decorators . skipif ( True , 'this test is annoyingly slow' ) #NEWLINE# def test_onenormest_table_4_t_7( self ) : #NEWLINE# #INDENT# np . random . seed ( 1234 ) #NEWLINE# t = 7 #NEWLINE# n = 100 #NEWLINE# itmax = 5 #NEWLINE# nsamples = 5000 #NEWLINE# observed = [ ] #NEWLINE# expected = [ ] #NEWLINE# nmult_list = [ ] #NEWLINE# nresample_list = [ ] #NEWLINE# for i in range ( nsamples ) : #NEWLINE# #INDENT# A = np . random . randint ( ( - 1 ) , 2 , size = ( n , n ) ) #NEWLINE# ( est , v , w , nmults , nresamples ) = _onenormest_core ( A , A . T , t , itmax ) #NEWLINE# observed . append ( est ) #NEWLINE# expected . append ( scipy . linalg . norm ( A , 1 ) ) #NEWLINE# nmult_list . append ( nmults ) #NEWLINE# nresample_list . append ( nresamples ) #NEWLINE# #UNINDENT# observed = np . array ( observed , dtype = float ) #NEWLINE# expected = np . array ( expected , dtype = float ) #NEWLINE# relative_errors = ( np . abs ( ( observed - expected ) ) / expected ) #NEWLINE# underestimation_ratio = ( observed / expected ) #NEWLINE# assert_ ( ( 0.9 < np . mean ( underestimation_ratio ) < 0.99 ) ) #NEWLINE# assert_equal ( np . max ( nresample_list ) , 0 ) #NEWLINE# nexact = np . count_nonzero ( ( relative_errors < 1e-14 ) ) #NEWLINE# proportion_exact = ( nexact / float ( nsamples ) ) #NEWLINE# assert_ ( ( 0.15 < proportion_exact < 0.25 ) ) #NEWLINE# assert_ ( ( 3.5 < np . mean ( nmult_list ) < 4.5 ) )