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 the backpropagate() 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 a TruncationErrorBudget class, given an observable truncation strategy (e.g. max_error_total, max_error_per_slice, p_norm).

Upgrade Notes

  • The backpropagate() function no longer accepts max_paulis and max_qwc_groups kwargs for constraining the size of the operator during back-propagation. Users should instead use the new operator_budget kwarg, which takes an OperatorBudget 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 from backpropagate(). Users should now only pass in slices which they intend to back-propagate. If a user wants to attempt to only back-propagate the last 20 slices of an N-slice circuit, they would simply pass in the last 20 slices to backpropagate() and, recombine any slices remaining after back-propagation with the original N-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 in setup_budget() has been renamed to num_slices.

  • The max_slices attribute in OBPMetadata has been renamed to num_slices.

  • The project’s root Python namespace has been changed from obp to qiskit_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, and p_norm kwargs from the backpropagate() signature. Instead, users must specify their observable truncation strategy with the new truncation_error_budget kwarg which accepts a TruncationErrorBudget instance.

  • Removed the per_slice_budget, max_error_total, and p_norm fields from the OBPMetadata class. These fields will now be accessed through the new truncation_error_budget field, which holds a TruncationErrorBudget instance.

Bug Fixes

  • The setup_budget() erroneously distributed the max_error_total when num_slices was also set. This has been fixed now, such that the budget always gets distributed evenly, regardless of the value of p_norm.

  • When the max_seconds argument to the backpropagate() 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).