Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions quandary.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,12 +871,11 @@ def estimate_timesteps(*, T=1.0, Hsys=[], Hc_re=[], Hc_im=[], maxctrl_MHz=[], Pm


def eigen_and_reorder(H0, verbose=False):
""" Internal function that computes eigen decomposition and re-orders it to make the eigenvector matrix as close to the identity as posiible """
""" Internal function that computes eigen decomposition and re-orders it to make the eigenvector matrix as close to the identity as possible """

# Get eigenvalues and vectors and sort them in ascending order
Ntot = H0.shape[0]
evals, evects = np.linalg.eig(H0)
evects = np.asmatrix(evects) # convert ndarray to matrix ?
reord = np.argsort(evals)
evals = evals[reord]
evects = evects[:,reord]
Expand Down Expand Up @@ -936,8 +935,8 @@ def get_resonances(*, Ne, Ng, Hsys, Hc_re=[], Hc_im=[], rotfreq=[], cw_amp_thres
for q in range(nqubits):

# Transform symmetric and anti-symmetric control Hamiltonians using eigenvectors (reordered)
Hsym_trans = Utrans.H @ Hc_re[q] @ Utrans
Hanti_trans = Utrans.H @ Hc_im[q] @ Utrans
Hsym_trans = Utrans.conj().T @ Hc_re[q] @ Utrans
Hanti_trans = Utrans.conj().T @ Hc_im[q] @ Utrans

resonances_a = []
speed_a = []
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/regression_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def run_test(simulation_dir, number_of_processes, config_file, files_to_compare,

def compare_files(file_name, output, expected, exact):
df_output = pd.read_csv(output, sep="\\s+", header=get_header(output))
df_expected = pd.read_csv(expected, sep="\\s+", header=get_header(output))
df_expected = pd.read_csv(expected, sep="\\s+", header=get_header(expected))
pd.testing.assert_frame_equal(df_output, df_expected, rtol=REL_TOL, atol=ABS_TOL, obj=file_name, check_exact=exact)


Expand Down