<s> import numpy as np <EOL> import parakeet <EOL> from parakeet import jit , testing_helpers <EOL> def init ( W ) : <EOL> C = W . copy ( ) <EOL> for i in xrange ( C . shape [ <NUM_LIT:0> ] ) : <EOL> C [ i , i ] = <NUM_LIT:0> <EOL> return C <EOL> def loop_dists ( W ) : <EOL> C = init ( W ) <EOL> m , n = C . shape <EOL> for k in range ( n ) : <EOL> for i in range ( n ) : <EOL> for j in range ( n ) : <EOL> C [ i , j ] = min ( C [ i , j ] , C [ i , k ] + C [ k , j ] ) <EOL> return C <EOL> """<STR_LIT>""" <EOL> """<STR_LIT>""" <EOL> """<STR_LIT>""" <EOL> def test_dists ( ) : <EOL> n = <NUM_LIT:10> <EOL> W = ( np . random . randn ( n , n ) * <NUM_LIT:2> ) ** <NUM_LIT:2> <EOL> testing_helpers . expect ( loop_dists , [ W ] , loop_dists ( W ) ) <EOL> """<STR_LIT>""" <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> testing_helpers . run_local_tests ( ) </s>
