SimpleLayerGenerator
- class SimpleLayerGenerator(two_qudit_gate=CNOTGate, single_qudit_gate_1=U3Gate, single_qudit_gate_2=None, initial_layer_gate=None)[source]
Bases:
LayerGenerator
The SimpleLayerGenerator class.
Starts a circuit by placing a single-qudit gate on each qudit. Expands a circuit by placing a two-qudit building block on all valid links. Each building block is composed of a two-qudit gate followed by two single-qudit gates.
- __init__(two_qudit_gate=CNOTGate, single_qudit_gate_1=U3Gate, single_qudit_gate_2=None, initial_layer_gate=None)[source]
Construct a SimpleLayerGenerator.
- Parameters:
two_qudit_gate (
Gate
) – A two-qudit gate that starts this layer generator’s building block. (Default: CNOTGate())single_qudit_gate_1 (
Gate
) – A single-qudit gate that follows two_qudit_gate in the building block. (Default: U3Gate())single_qudit_gate_2 (
Gate | None
) – An alternate single-qudit gate to be used as the second single-qudit gate in the building block. If left as None, defaults to single_qudit_gate_1. (Default: None)initial_layer_gate (
Gate | None
) – An alternate single-qudit gate that creates the initial layer. If left as None, defaults to single_qudit_gate_1. (Default: None)
- Raises:
ValueError – If two_qudit_gate’s size is not 2, or if any of the single-qudit gates’ size is not 1.
ValueError – If single_qudit_gate_1’s radix does not match the radix of two_qudit_gate’s first qudit, or if single_qudit_gate_2’s radix does not match the radix of two_qudit_gate’s second qudit.
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.