DiscreteLayerGenerator
- class DiscreteLayerGenerator(gateset=[HGate, TGate, CNOTGate], double_headed=False, dividing_gate_type=<class 'bqskit.ir.gates.parameterized.pauliz.PauliZGate'>)[source]
Bases:
LayerGeneratorThe DiscreteLayerGenerator class.
Expands circuits using only discrete gates. This is a non-reinforcement learning version of diagonalizing in https://arxiv.org/abs/2409.00433.
- __init__(gateset=[HGate, TGate, CNOTGate], double_headed=False, dividing_gate_type=<class 'bqskit.ir.gates.parameterized.pauliz.PauliZGate'>)[source]
Construct a DiscreteLayerGenerator.
- Parameters:
gateset (
Sequence[Gate]) – A sequence of gates that can be used in the output circuit. These must be non-parameterized gates. (Default: [HGate, TGate, CNOTGate])double_headed (
bool) – If True, successors will be generated by both appending and prepending gates. This lets unitaries be diagonalized instead of inverted. (Default: False)dividing_gate (
Callable[[int],Gate]) – A gate that goes between the two heads of the discrete searches. If double_headed is False, this gate simply goes at the beggining of the circuit. (Default: PauliZGate)
- Raises:
ValueError – If the gateset is not a sequence.
ValueError – If the gateset contains a parameterized gate.
ValueError – If the radices of gates are different.
Methods
cancels_something(circuit, gate, location)Ensure applying gate at location does not cancel a previous gate.
count_repeats(circuit, gate, qudit)Count the number of times the last gate is repeated on qudit.
gen_initial_layer(target, data)Generate the initial layer, see LayerGenerator for more.
gen_successors(circuit, data)Generate the successors of a circuit node.
hash_circuit_structure(circuit)