Release Notes¶
0.1.0¶
New Features¶
Added a
OperatorBudget
class for specifying how large an operator may grow during back-propagation.
Adds the
max_seconds
keyword-argument to thebackpropagate()
function, allowing the end-user to specify a maximum wall clock time for the algorithm. This can (for example) be useful for exploring different truncation error budget strategies while limiting the CPU time.
Introduced a new
dataclass
,TruncationErrorBudget
, for holding information about the observable truncation strategy.
Introduced a new function,
setup_budget()
, which generates aTruncationErrorBudget
class, given an observable truncation strategy (e.g.max_error_total
,max_error_per_slice
,p_norm
).
Upgrade Notes¶
The
backpropagate()
function no longer acceptsmax_paulis
andmax_qwc_groups
kwargs for constraining the size of the operator during back-propagation. Users should instead use the newoperator_budget
kwarg, which takes anOperatorBudget
instance.To migrate, change this code
from qiskit_addon_obp import backpropagate bp_obs, remaining_slices, metadata = backpropagate( obs, slices, max_paulis=100, max_qwc_groups=10, simplify=True )
to this
from qiskit_addon_obp import backpropagate from qiskit_addon_obp.utils.simplify import OperatorBudget op_budget = OperatorBudget(max_paulis=100, max_qwc_groups=10, simplify=True) bp_obs, remaining_slices, metadata = backpropagate(obs, slices, operator_budget=op_budget)
The
max_slices
kwarg has been removed frombackpropagate()
. Users should now only pass in slices which they intend to back-propagate. If a user wants to attempt to only back-propagate the last20
slices of anN
-slice circuit, they would simply pass in the last20
slices tobackpropagate()
and, recombine any slices remaining after back-propagation with the originalN-20
slices.For example
from qiskit_addon_obp import backpropagate from qiskit_addon_obp.utils.truncating import setup_budget from qiskit_addon_utils.slicing import combine_slices num_slices = 20 truncation_error_budget = setup_budget(max_error_total=0.02, num_slices=num_slices, p_norm=1) bp_obs, remaining_slices, metadata = backpropagate( obs, slices[-num_slices:], truncation_error_budget=truncation_error_budget ) reduced_circuit = combine_slices(slices[:-num_slices] + remaining_slices)
The
max_slices
kwarg insetup_budget()
has been renamed tonum_slices
.
The
max_slices
attribute inOBPMetadata
has been renamed tonum_slices
.
The project’s root Python namespace has been changed from
obp
toqiskit_addon_obp
. All package imports must be updated.For example:
from obp import backpropagate
should be changed to:
from qiskit_addon_obp import backpropagate
Removed the
max_error_total
,max_error_per_slice
, andp_norm
kwargs from thebackpropagate()
signature. Instead, users must specify their observable truncation strategy with the newtruncation_error_budget
kwarg which accepts aTruncationErrorBudget
instance.
Removed the
per_slice_budget
,max_error_total
, andp_norm
fields from theOBPMetadata
class. These fields will now be accessed through the newtruncation_error_budget
field, which holds aTruncationErrorBudget
instance.
Bug Fixes¶
The
setup_budget()
erroneously distributed themax_error_total
whennum_slices
was also set. This has been fixed now, such that the budget always gets distributed evenly, regardless of the value ofp_norm
.
When the
max_seconds
argument to thebackpropagate()
method is used, but the timeout is not reached during the actual OBP execution, the signal will now be reset properly, thereby avoiding cancellations at a (seemingly) random later point in time (of course, it is not random but actually after the specified amount of time has passed, but the rest of the code being executed after OBP could be doing anything at this point).
The computation of the
accumulated_error()
andleft_over_error_budget()
were fixed to respect the Minkowski inequality. This is necessary, because a general Lp-norm (other thanp=2
) does not satisfy the parallelogram law which resulted in a non-rigorous upper bound of the actual accumulated errors (and left-over error budgets by extension).