-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscaling.py
36 lines (29 loc) · 919 Bytes
/
scaling.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from hubbard_class import hubbard
from hop_mat import hopping_matrix
import time
import matplotlib.pyplot as plt
def find_num_row_col(N):
factors = []
for i in range(1, N + 1):
if N % i == 0:
factors.append(i)
if len(factors) % 2 == 0:
num_columns = factors[int(len(factors)/2 - 1)]
num_rows = factors[int(len(factors)/2)]
else:
num_columns = factors[int((len(factors)-1)/2)]
num_rows = num_columns
return (num_rows,num_columns)
N_values = list(range(1,9))
t_values = []
for N in N_values:
row, col = find_num_row_col(N)
start = time.time()
hub_object = hubbard(N = N, hopping_matrix = hopping_matrix(row,col))
hub_object.calculate_all_blocks()
end = time.time()
exec_time = end - start
t_values.append(exec_time)
print(f"N = {N} is done. Time : {exec_time} seconds.")
plt.plot(N_values,t_values)
plt.show()