BlockConversionPass

class BlockConversionPass(convert_target, convert_variable=True, convert_constant=True, convert_circuitgates=True)[source]

Bases: BasePass

Converts blocks of one type to another type.

Blocks are either described by a constant or variable unitary gate or as a circuit gate. Often during the flow of compilatin we will need to convert them from one form to another for a future pass.

__init__(convert_target, convert_variable=True, convert_constant=True, convert_circuitgates=True)[source]

Construct a BlockConversionPass.

Parameters:
  • convert_target (str) – Either variable or constant. Blocks will be converted to the form described here. If this is variable all gates will be converted to VariableUnitaryGate s. If this is constant blocks will be converted to ConstantUnitaryGate s. Blocks cannot be converted to circuit gates, that can be caried out by synthesis.

  • convert_variable (bool) – If this is true, this will replace VariableUnitaryGate’s in the circuit with one’s specified in convert_target.

  • convert_constant (bool) – If this is true, this will replace ConstantUnitaryGate’s in the circuit with one’s specified in convert_target.

  • convert_circuitgates (bool) – If this is true, this will replace CircuitGate’s in the circuit with one’s specified in convert_target. The subcircuit information captured in the circuit gate will be lost.

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.