WideLayerGenerator

class WideLayerGenerator(multi_qudit_gates=IToffoliGate, single_qudit_gate=U3Gate)[source]

Bases: LayerGenerator

A layer generator for use with wide gates like an iToffoli.

Very similar to the simple layer generator. Each additional block adds one multi-qudit gate followed by single-qudit gates on each qudit.

__init__(multi_qudit_gates=IToffoliGate, single_qudit_gate=U3Gate)[source]

Construct a WideLayerGenerator.

Parameters:
  • multi_qudit_gate (Gate | Sequence[Gate]) – A multi-qudit gate or sequence of gates that starts this layer generator’s building block. If multiple gates are given as a sequence, then a successive layer is built for each gate and each location. (Default: IToffoliGate())

  • single_qudit_gate (Gate | None) – A single-qudit gate that follows multi_qudit_gate in the building block. Can set to None to disable single-qudit gates, which might be useful with general multi-qudit gates. (Default: U3Gate())

Raises:
  • ValueError – If the single-qudit gate’s size is not 1.

  • ValueError – If there is any radix mismatch between the gates.

Methods

gen_initial_layer(target, data)

Generate the initial layer, see LayerGenerator for more.

gen_successors(circuit, data)

Generate the successors of a circuit node.