IfThenElsePass

class IfThenElsePass(condition, on_true, on_false=None)[source]

Bases: BasePass

The IfThenElsePass class.

This is a control pass that conditionally executes a workflow.

__init__(condition, on_true, on_false=None)[source]

Construct a IfThenElsePass.

Parameters:
  • condition (PassPredicate) – The condition checked.

  • on_true (WorkflowLike) – The pass or passes to execute if condition is true.

  • on_false (WorkflowLike | None) – If specified, the pass or passes to execute if condition is false. Defaults to None, which does is equivalent to a No-Op.

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.