Rebase2QuditGatePass

class Rebase2QuditGatePass(gate_in_circuit, new_gate, max_depth=3, max_retries=-1, success_threshold=1e-08, cost=<bqskit.ir.opt.cost.functions.residuals.hilbertschmidt.HilbertSchmidtResidualsGenerator object>, instantiate_options={}, single_qudit_gate=U3Gate)[source]

Bases: BasePass

The Rebase2QuditGatePass class.

Will use instantiation to change the a 2-qudit gate to a different one.

__init__(gate_in_circuit, new_gate, max_depth=3, max_retries=-1, success_threshold=1e-08, cost=<bqskit.ir.opt.cost.functions.residuals.hilbertschmidt.HilbertSchmidtResidualsGenerator object>, instantiate_options={}, single_qudit_gate=U3Gate)[source]

Construct a Rebase2QuditGatePass.

Parameters:
  • gate_in_circuit (Gate | Sequence[Gate]) – The two-qudit gate or gates in the circuit that you want to replace.

  • new_gate (Gate | Sequence[Gate]) – The two-qudit new gate or gates you want to put in the circuit.

  • max_depth (int) – The maximum number of new gates to replace an old gate with. (Default: 3)

  • max_retries (int) – The number of retries for the same gate before we increase the maximum depth. If left as -1, then never increase max depth. (Default: -1)

  • success_threshold (float) – The distance threshold that determines successful termintation. Measured in cost described by the hilbert schmidt cost function. (Default: 1e-8)

  • cost (CostFunction | None) – The cost function that determines successful removal of a gate. (Default: HilbertSchmidtResidualsGenerator())

  • (dict[str (instantiate_options) – Any]): Options passed directly to circuit.instantiate when instantiating circuit templates. (Default: {})

  • single_qudit_gate (Gate) – A single-qudit gate to fill in between two-qudit gates.

Raises:
  • ValueError – If gate_in_circuit or new_gate is not a 2-qudit gate.

  • ValueError – if max_depth is nonnegative.

Attributes

name

The name of the pass.

Methods

execute(*args, **kwargs)

Map a function over iterable arguments in parallel.

generate_new_gate_templates(new_gates, ...)

Generate the templates to be instantiated over old circuits.

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.

group_near_gates(circuit, center, gates)

Group gates similar to the gate at center on the same qubits.

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.