paulicirc.layers
Layers of Pauli gadgets.
Layer
- final class Layer(num_qubits)[source]
Bases:
objectA layer of Pauli gadgets with compatible legs.
- static __new__(cls, num_qubits)[source]
Create an empty Pauli layer with the given number of qubits.
- add_gadget(gadget_or_legs, phase=None)[source]
Add a gadget to the layer.
- Parameters:
gadget_or_legs (
PauliArray|Gadget)
- Return type:
- commutes_with(legs, /)[source]
Check if the legs commute with the current layer.
- Parameters:
legs (
PauliArray|Gadget)- Return type:
- classmethod from_gadgets(gadgets, num_qubits=None)[source]
Constructs a layer from the given gadgets.
- is_compatible_with(legs, /)[source]
Check if the legs are compatible with the current layer.
- Parameters:
legs (
PauliArray|Gadget)- Return type:
- property legs
Legs of the Pauli layer.
- Return type:
- phase(legs)[source]
Get the phase of the given legs in the layer, or
Noneif the legs are incompatible with the layer.- Parameters:
legs (
PauliArray)- Return type:
- static select_leg_subset(qubits, legs)[source]
Selects legs based on the given subset of qubits.
- Parameters:
legs (
PauliArray)
- Return type:
- statevec(input, canonical_phase=True, _use_cupy=False)[source]
Computes the statevector resulting from the application of this gadget circuit to the given input statevector.
- Parameters:
input (
ComplexArray1D|FloatArray1D)canonical_phase (
bool; default =True)_use_cupy (
bool; default =False)
- Return type:
LayeredCircuit
- final class LayeredCircuit(num_qubits)[source]
Bases:
objectA quantum circuit, represented as a sequential composition of Pauli layers.
- circuit()[source]
Returns a circuit constructed from the current gadget layers, where the gadgets for each layer are listed in canonical order.
- Return type:
- random_circuit(*, rng)[source]
Returns a circuit constructed from the current gadget layers, where the gadgets for each layer are listed in random order.
- statevec(input, canonical_phase=True, _use_cupy=False)[source]
Computes the statevector resulting from the application of this gadget circuit to the given input statevector.
- Parameters:
input (
ComplexArray1D|FloatArray1D)canonical_phase (
bool; default =True)_use_cupy (
bool; default =False)
- Return type: