You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing the error below when initializing DoubleFactorized objects with sf_error_threshold set to zero. (Context: I'm setting this to zero to make the truncation consistent with OpenFermion's logic for estimating truncation error.) It looks like the issue is just that num_ops does not get initialized if none of the eigenvalues are thrown out.
I think this is not a big blocker for our work though because it seems like we can work around it by just setting sf_error_threshold to some very small value.
Traceback (most recent call last):
File "/Users/maxradin/Development/qb-gsee-benchmark/examples/get_qre.py", line 14, in <module>
circuit, n_shots, allowable_error = get_df_qpe_circuit(
^^^^^^^^^^^^^^^^^^^
File "/Users/maxradin/Development/qb-gsee-benchmark/src/qb_gsee_benchmark/qre.py", line 250, in get_df_qpe_circuit
encoding = DoubleFactorized(
^^^^^^^^^^^^^^^^^
File "/Users/maxradin/anaconda3/lib/python3.11/site-packages/pyLIQTR/BlockEncodings/DoubleFactorized.py", line 67, in __init__
one_body_array, two_body_array, self.Xi_l_data, self.givens_angle_tensor = self.PI.yield_DF_Info(df_error_threshold=df_error_threshold,sf_error_threshold=sf_error_threshold)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/maxradin/anaconda3/lib/python3.11/site-packages/pyLIQTR/ProblemInstances/ChemicalHamiltonian.py", line 193, in yield_DF_Info
DF_frags = self.DF_fragments(sf_error_threshold)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/maxradin/anaconda3/lib/python3.11/site-packages/pyLIQTR/ProblemInstances/ChemicalHamiltonian.py", line 130, in DF_fragments
return DF_decomposition(h0, one_body_tensor, two_body_tensor,tol=sf_error_threshold)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/maxradin/anaconda3/lib/python3.11/site-packages/pyLIQTR/utils/df_utils.py", line 238, in DF_decomposition
vals = all_vals[:num_ops]
^^^^^^^
UnboundLocalError: cannot access local variable 'num_ops' where it is not associated with a value
The text was updated successfully, but these errors were encountered:
max-radin
changed the title
DoubleFactorized block encoding fails when sf_error_threshold is zero.
DoubleFactorized block encoding fails when sf_error_threshold is zero
Aug 27, 2024
I'm seeing the error below when initializing
DoubleFactorized
objects withsf_error_threshold
set to zero. (Context: I'm setting this to zero to make the truncation consistent with OpenFermion's logic for estimating truncation error.) It looks like the issue is just thatnum_ops
does not get initialized if none of the eigenvalues are thrown out.I think this is not a big blocker for our work though because it seems like we can work around it by just setting
sf_error_threshold
to some very small value.The text was updated successfully, but these errors were encountered: