#NEWLINE# def _check_reentrancy( solver , is_reentrant ) : #NEWLINE# #INDENT# def matvec( x ) : #NEWLINE# #INDENT# A = np . array ( [ [ 1.0 , 0 , 0 ] , [ 0 , 2.0 , 0 ] , [ 0 , 0 , 3.0 ] ] ) #NEWLINE# ( y , info ) = solver ( A , x ) #NEWLINE# assert_equal ( info , 0 ) #NEWLINE# return y #NEWLINE# #UNINDENT# b = np . array ( [ 1 , ( 1.0 / 2 ) , ( 1.0 / 3 ) ] ) #NEWLINE# op = LinearOperator ( ( 3 , 3 ) , matvec = matvec , rmatvec = matvec , dtype = b . dtype ) #NEWLINE# if ( not is_reentrant ) : #NEWLINE# #INDENT# assert_raises ( RuntimeError , solver , op , b ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( y , info ) = solver ( op , b ) #NEWLINE# assert_equal ( info , 0 ) #NEWLINE# assert_allclose ( y , [ 1 , 1 , 1 ] )