Commit e070e5ea by Zoltan Karsa

to file 2

parent 40ef6193
...@@ -2,7 +2,7 @@ import sys, getopt ...@@ -2,7 +2,7 @@ import sys, getopt
from genax import gen_angels_to_pick, angles_alap, angles_ratet from genax import gen_angels_to_pick, angles_alap, angles_ratet
from gpu import start_kernel from gpu import start_kernel
from utils import convert, printresults, search, exact_one, exact_one_gpu, filter_gpu, writetofile from utils import convert, printresults, search, exact_one, exact_one_gpu, filter_gpu, writetofile, writetofile2
def main(argv): def main(argv):
outputfile = None outputfile = None
......
...@@ -71,19 +71,46 @@ def writetofile(filename, Cx, Cy, Dx, Dy, Dz, egyensulyi_mtx): ...@@ -71,19 +71,46 @@ def writetofile(filename, Cx, Cy, Dx, Dy, Dz, egyensulyi_mtx):
size_C = Cx.size size_C = Cx.size
size_D = Dx.size size_D = Dx.size
for i in range(0, pos): for i in range(0, pos):
parok = np.empty([0], dtype=np.int8) #parok = np.empty([0], dtype=np.int8)
for S in range(0, 4): #for S in range(0, 4):
for U in range(0, 4): # for U in range(0, 4):
if mtx_cpu[i][S][U] == 1: # if mtx_cpu[i][S][U] == 1:
parok = np.append(parok, S+1) # parok = np.append(parok, S+1)
parok = np.append(parok, U+1) # parok = np.append(parok, U+1)
N = parok.size #N = parok.size
f.write(f"{Cx_cpu[i % size_C]}, {Cy_cpu[i % size_C]}, {Dx_cpu[(i + int(i / lcm)) % size_D]}, {Dy_cpu[(i + int(i / lcm)) % size_D]}, {Dz_cpu[(i + int(i / lcm)) % size_D]}\n") f.write(f"{Cx_cpu[i % size_C]}, {Cy_cpu[i % size_C]}, {Dx_cpu[(i + int(i / lcm)) % size_D]}, {Dy_cpu[(i + int(i / lcm)) % size_D]}, {Dz_cpu[(i + int(i / lcm)) % size_D]}\n")
f.write(np.array2string(np.resize(parok, (int(N/2), 2)))) #f.write(np.array2string(np.resize(parok, (int(N/2), 2))))
f.write(np.array2string(mtx_cpu[i]))
f.write("\n") f.write("\n")
f.close() f.close()
def writetofile2(filename, Cx, Cy, Dx, Dy, Dz, egyensulyi_mtx):
lcm = compute_lcm(Cx.size, Dx.size)
Cx_cpu = Cx.get()
Cy_cpu = Cy.get()
Dx_cpu = Dx.get()
Dy_cpu = Dy.get()
Dz_cpu = Dz.get()
mtx_cpu = egyensulyi_mtx.get()
pos = Cx.size * Dx.size
f = open(filename, "w")
size_C = Cx.size
size_D = Dx.size
for i in range(0, pos):
s = 0
for S in range(0, 4):
for U in range(0, 4):
s *= 2
s += mtx_cpu[i][S][U]
f.write(f"{i % size_C}, {i % size_C}, {(i + int(i / lcm)) % size_D}, {(i + int(i / lcm)) % size_D}, {(i + int(i / lcm)) % size_D}, {s}\n")
f.close()
def search(egyensulyi_mtx, S, U): def search(egyensulyi_mtx, S, U):
for i in egyensulyi_mtx: for i in egyensulyi_mtx:
if i[S][U] == 1: if i[S][U] == 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment