Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = [10,20,50,100,250]
- f = ['zero_smart', 'zero_naive', 'zero_main', 'randz_smart'
- , 'randz_naive', 'randz_main']
- endtable = []
- for _n in n:
- for _f in f:
- for i in range(1,5):
- data = 0
- ln = 0
- filestr = 'result_' + _f + \
- '_Thread-' + str(i) + '_n_' + str(_n) + '_numit_25'
- try:
- with open(filestr, 'r') as myfile:
- lines = myfile.readlines()
- except:
- print('error: ' + filestr)
- lines = ['0']
- lines = lines[0]
- lines = lines.split(', ')
- lines = [int(q) for q in lines]
- data += sum(lines)
- ln += len(lines)
- res = data/ln
- norm = res/(int(_n))
- header = (_f, str(_n), str(res), str(norm))
- endtable.append(header)
- for name, n, res, norm in sorted(endtable, key=lambda x:x[0]):
- h = name+', n='+n+', res='+res+', norm='+norm+'\n'
- with open('final_rep', 'a+') as finalrep:
- finalrep.write(h)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement