<s> """<STR_LIT>""" <EOL> import time <EOL> import numpy as np <EOL> def _print_after_skip ( skip , it = None , dist = None , etime = None ) : <EOL> if it is None : <EOL> msg = "<STR_LIT>" . format ( i = "<STR_LIT>" , <EOL> d = "<STR_LIT>" , <EOL> t = "<STR_LIT>" ) <EOL> print ( msg ) <EOL> print ( "<STR_LIT:->" * len ( msg ) ) <EOL> return <EOL> if it % skip == <NUM_LIT:0> : <EOL> if etime is None : <EOL> print ( "<STR_LIT>" . format ( it = it , d = dist ) ) <EOL> else : <EOL> msg = "<STR_LIT>" <EOL> print ( msg . format ( i = it , d = dist , t = etime ) ) <EOL> return <EOL> def compute_fixed_point ( T , v , error_tol = <NUM_LIT> , max_iter = <NUM_LIT:50> , verbose = <NUM_LIT:1> , <EOL> print_skip = <NUM_LIT:5> , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> iterate = <NUM_LIT:0> <EOL> error = error_tol + <NUM_LIT:1> <EOL> if verbose : <EOL> start_time = time . time ( ) <EOL> _print_after_skip ( print_skip , it = None ) <EOL> while iterate < max_iter and error > error_tol : <EOL> new_v = T ( v , * args , ** kwargs ) <EOL> iterate += <NUM_LIT:1> <EOL> error = np . max ( np . abs ( new_v - v ) ) <EOL> if verbose : <EOL> etime = time . time ( ) - start_time <EOL> _print_after_skip ( print_skip , iterate , error , etime ) <EOL> try : <EOL> v [ : ] = new_v <EOL> except TypeError : <EOL> v = new_v <EOL> return v </s>
