DoThenDecide

class DoThenDecide(condition, workflow)[source]

Bases: BasePass

The DoThenDecide class.

This is a control pass that executes a workflow and then conditionally accepts the resulting circuit or reverts to the original state.

__init__(condition, workflow)[source]

Construct a DoThenDecide.

Parameters:
  • condition (Callable[[Circuit, Circuit], bool]) – The condition function that determines if the new circuit (second parameter) after running workflow should replace the original circuit (first parameter). If the condition returns True, then replace the original circuit with the new one. Note when passing callables to BQSKit passes, they need to be defined at the module level (0-indent) with a name (no lambdas).

  • workflow (WorkflowLike) – The pass or passes to execute.

Attributes

name

The name of the pass.

Methods

execute(*args, **kwargs)

Map a function over iterable arguments in parallel.

get_connectivity(_, data)

Retrieve the current connectivity of the circuit.

get_model(_, data)

Retrieve the machine model from the data dictionary.

get_placement(_, data)

Retrieve the logical to physical qubit map from the data dictionary.

get_target(_, data)

Retrieve the target from the data dictionary.

in_parallel(data)

Return true if pass is being executed in a parallel.

run(circuit, data)

Perform the pass's operation, see BasePass for more.