<s> from sys import argv <EOL> from math import log <EOL> from commands import getoutput <EOL> from string import letters <EOL> from random import choice <EOL> infile = open ( argv [ <NUM_LIT:1> ] , '<STR_LIT:r>' ) <EOL> outfile = open ( argv [ <NUM_LIT:2> ] + '<STR_LIT>' , '<STR_LIT:w>' ) <EOL> if argv [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] == '<STR_LIT:/>' or argv [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> ABS_PATH = True <EOL> else : <EOL> ABS_PATH = False <EOL> header = infile . readline ( ) . rstrip ( '<STR_LIT:\n>' ) . split ( '<STR_LIT:\t>' ) [ <NUM_LIT:2> : : ] <EOL> num_samples = len ( header ) <EOL> outfile . write ( "<STR_LIT>" % num_samples ) <EOL> the_matrix = [ ] <EOL> for i in range ( num_samples ) : <EOL> the_matrix . append ( [ <NUM_LIT:0.0> ] * num_samples ) <EOL> for line in infile : <EOL> la = map ( float , line . rstrip ( '<STR_LIT:\n>' ) . split ( '<STR_LIT:\t>' ) [ <NUM_LIT:2> : : ] ) <EOL> for i in range ( num_samples ) : <EOL> for j in range ( num_samples ) : <EOL> the_matrix [ i ] [ j ] += abs ( la [ i ] - la [ j ] ) <EOL> for i in range ( num_samples ) : <EOL> outfile . write ( "<STR_LIT>" % header [ i ] ) <EOL> for j in range ( num_samples ) : <EOL> outfile . write ( '<STR_LIT:U+0020>' + str ( the_matrix [ i ] [ j ] ) ) <EOL> outfile . write ( '<STR_LIT:\n>' ) <EOL> infile . close ( ) ; outfile . close ( ) <EOL> commands_file = open ( argv [ <NUM_LIT:2> ] + '<STR_LIT>' , '<STR_LIT:w>' ) <EOL> TMP_DIR = "<STR_LIT>" . join ( [ choice ( letters ) for x in xrange ( <NUM_LIT:10> ) ] ) ; getoutput ( '<STR_LIT>' % TMP_DIR ) <EOL> if ABS_PATH : <EOL> commands_file . write ( '<STR_LIT>' % ( argv [ <NUM_LIT:2> ] + '<STR_LIT>' ) ) <EOL> commands_file . close ( ) <EOL> getoutput ( '<STR_LIT>' % ( TMP_DIR , argv [ <NUM_LIT:2> ] + '<STR_LIT>' , argv [ <NUM_LIT:2> ] ) ) <EOL> else : <EOL> commands_file . write ( '<STR_LIT>' % ( argv [ <NUM_LIT:2> ] + '<STR_LIT>' ) ) <EOL> commands_file . close ( ) <EOL> getoutput ( '<STR_LIT>' % ( TMP_DIR , argv [ <NUM_LIT:2> ] + '<STR_LIT>' , argv [ <NUM_LIT:2> ] ) ) <EOL> getoutput ( '<STR_LIT>' % TMP_DIR ) </s>
