Skip to content

Commit 048eece

Browse files
committed
Add tqdm and change tiny seq branch
1 parent 88c4808 commit 048eece

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

mitsubishi/phase_3/code/euv_spectra.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,12 +1220,18 @@ def final_energy_circuit(gqe_ops):
12201220
return qml.expval(meas_hamiltonian)
12211221

12221222
def get_final_energies(gen_op_seq):
1223-
"""Evaluates final state energy for a batch of operator sequences in a single pass."""
1224-
energies = [float(final_energy_circuit(ops)) for ops in gen_op_seq]
1223+
"""Evaluates final state energy for a batch of operator sequences on GPU."""
1224+
energies = [
1225+
float(final_energy_circuit(ops))
1226+
for ops in tqdm(gen_op_seq, desc="GPU Sequence Evaluation", leave=False, ascii=True)
1227+
]
12251228
return np.array(energies).reshape(-1, 1)
12261229

12271230
# Test the tiny sequence using the fast single-pass function
1228-
print("Testing tiny sequence:", get_final_energies([[op_pool[0], op_pool[1]]]))
1231+
if USE_CUDA:
1232+
print("Testing tiny sequence:", get_final_energies([[op_pool[0], op_pool[1]]]))
1233+
else:
1234+
print("Testing tiny sequence:", get_subsequence_energies([[op_pool[0], op_pool[1]]]))
12291235

12301236

12311237
# %% [markdown]

0 commit comments

Comments
 (0)