Circuits
Builders
PauliPropagation.tfitrottercircuit
— Functiontfitrottercircuit(nqubits::Integer, nlayers::Integer; topology=bricklayertopology(nqubits), start_with_ZZ=true)
Create a circuit that corresponds to a Trotterization of the transverse-field Ising Hamiltonian.
\[H = ∑_{(i,j) ∈ topology} J_{ij} Z_i Z_j + ∑_{i=1 ... nqubits} h_i X_i\]
This returns only the sequence of gates, not their parameters. A topology can be specified as a list of pairs of qubit indices. If no topology is specified, a bricklayer topology is used. If start_with_ZZ
is set to true
, the circuit starts with a layer of ZZ gates, else with a layer of X gates. This is relevant depending on the initial state.
PauliPropagation.tiltedtfitrottercircuit
— Functiontiltedtfitrottercircuit(nqubits::Integer, nlayers::Integer; topology=bricklayertopology(nqubits))
Create a circuit that corresponds to a Trotterization of the transverse-field Ising Hamiltonian.
\[H = ∑_{(i,j) ∈ topology} J_{ij} Z_i Z_j + ∑_{i=1 ... nqubits} h_i Z_i + ∑_{i=1 ... nqubits} b_i X_i\]
This returns only the sequence of gates, not their parameters. A topology can be specified as a list of pairs of qubit indices. If no topology is specified, a bricklayer topology is used.
PauliPropagation.heisenbergtrottercircuit
— Functionheisenbergtrottercircuit(nqubits::Integer, nlayers::Integer; topology=bricklayertopology(nqubits))
Create a circuit that corresponds to a Trotterization of the Heisenberg Hamiltonian.
\[H = ∑_{(i,j) ∈ topology} Jzz_{ij} Z_i Z_j + Jxx_{ij} X_i X_j + Jyy_{ij} Y_i Y_j\]
This returns only the sequence of gates, not their parameters. A topology can be specified as a list of pairs of qubit indices. If no topology is specified, a bricklayer topology is used. Note that the gates are applied as layers of XX-YY-ZZ gates, not as layers of XX on all, then YY on all, then ZZ on all.
PauliPropagation.hardwareefficientcircuit
— Functionhardwareefficientcircuit(nqubits::Integer, nlayers::Integer; topology=bricklayertopology(nqubits))
Create a hardware-efficient circuit consisting of layers of single-qubit X-Z-X Pauli gates and YY entangling gates. A topology can be specified as a list of pairs of qubit indices. If no topology is specified, a bricklayer topology is used.
PauliPropagation.efficientsu2circuit
— Functionefficientsu2circuit(nqubits::Integer, nlayers::Integer; topology=bricklayertopology(nqubits))
Create a hardware-efficient circuit consisting of layers of single-qubit Y-Z Pauli gates and CNOT entangling gates. A topology can be specified as a list of pairs of qubit indices. If no topology is specified, a bricklayer topology is used.
PauliPropagation.su4circuit
— Functionsu4circuit(nqubits::Integer, nlayers::Integer; topology=bricklayertopology(nqubits))
Create a circuit that consists of layers of SU(4) gates on a given topology. SU(4) gates are decomposed via the KAK Decomposition into single-qubit Z-X-Z gates on each qubit, followed by XX-YY-ZZ gates and again single-qubit Z-X-Z gates, for a total of 15 Pauli gates. A topology can be specified as a list of pairs of qubit indices. If no topology is specified, a bricklayer topology is used.
PauliPropagation.rxlayer!
— Functionrxlayer!(circuit, nqubits)
Append a layer of single-qubit PauliRotation(:X, qind)
gates to the circuit for each pair in the topology.
PauliPropagation.rylayer!
— Functionrylayer!(circuit, nqubits)
Append a layer of single-qubit PauliRotation(:Y, qind)
gates to the circuit for each pair in the topology.
PauliPropagation.rzlayer!
— Functionrzlayer!(circuit, nqubits)
Append a layer of single-qubit PauliRotation(:Z, qind)
gates to the circuit for each pair in the topology.
PauliPropagation.rxxlayer!
— Functionrxxlayer!(circuit, topology)
Append a layer of two-qubit PauliRotation([:X, :X], pair)
gates to the circuit for each pair in the topology.
PauliPropagation.ryylayer!
— Functionryylayer!(circuit, topology)
Append a layer of two-qubit PauliRotation([:Y, :Y], pair)
gates to the circuit for each pair in the topology.
PauliPropagation.rzzlayer!
— Functionrzzlayer!(circuit, topology)
Append a layer of two-qubit PauliRotation([:Z, :Z], pair)
gates to the circuit for each pair in the topology.
PauliPropagation.qcnncircuit
— Functionqcnncircuit(nqubits::Integer; periodic=false)
Create a Quantum Convolutional Neural Network (QCNN) circuit on nqubits
qubits. The topology for the circuit is created by creating bricklayer topologies on half the qubits every layer. The final qubits are qubit 1 and ~nqubits/2
, which should be measured.
PauliPropagation.appendSU4!
— FunctionappendSU4!(circuit, pair)
Append a layer of SU(4) gates to a circuit on a given pair of qubits. The SU(4) gate is decomposed via the KAK Decomposition into single-qubit Z-X-Z gates on each qubit, followed by XX-YY-ZZ gates and again single-qubit Z-X-Z gates, for a total of 15 Pauli gates.
Topologies
PauliPropagation.bricklayertopology
— Methodbricklayertopology(qindices; periodic=false)
Create the topology of a so-called 1D bricklayer circuit on a subset of qubits indicated by qindices
. If periodic
is set to true
, the last qubit is connected to the first qubit.
PauliPropagation.bricklayertopology
— Methodbricklayertopology(nqubits::Integer; periodic=false)
Create the topology of a so-called 1D bricklayer circuit on nqubits
qubits. It consists of two sublayers connecting odd-even and eve-odd qubit indices, respectively. If periodic
is set to true
, the last qubit is connected to the first qubit.
PauliPropagation.rectangletopology
— Methodrectangletopology(nx::Integer, ny::Integer; periodic=false)
Create a 2D topology on a grid of nx
by ny
qubits. The order is none in particular and may need to be adapted for specific purposes. If periodic
is set to true
, the grid is connected periodically in both directions.
PauliPropagation.staircasetopology
— Methodstaircasetopology(nqubits::Integer; periodic=false)
Create a 1D staircase topology on nqubits
qubits. The qubits are connected in a staircase pattern, where qubit i
is connected to qubit i+1
. If periodic
is set to true
, the last qubit is connected to the first qubit.
PauliPropagation.staircasetopology2d
— Methodstaircasetopology2d(nx::Integer, ny::Integer)
Create a 2D staircase topology on a grid of nx
by ny
qubits. Mind the order of the topology, which forms a staircase spanning the grid -> in the Schrödinger picture <-. An observable acting on qubits index nqubits
may interact non-trivially with every gate on the topology. Can topology can either be pathological or the most simple, depending on which index observables are non-identity.
PauliPropagation.ibmeagletopology
— Constantibmeagletopology
Topology of the IBM Eagle device with 127 qubits. Also called the heave-hex topology on 127 qubits.
Utils
PauliPropagation.countparameters
— Methodcountparameters(circuit)
Utility function to count the number of gates of type ParametrizedGate
in a circuit.
PauliPropagation.getparameterindices
— Methodgetparameterindices(circuit, ::PauliRotation, gate_symbols::Vector{Symbol}), qinds::Vector{Int})
Utility function to get the parameter indices of PauliRotation
gates with symbol gate_symbols
acting on the qubits qinds
. For example, getparameterindices(circuit, PauliRotation, [:X], [1])
.
PauliPropagation.getparameterindices
— Methodgetparameterindices(circuit, ::PauliRotation, gate_symbols::Vector{Symbol}))
Utility function to get the parameter indices of PauliRotation
gates with symbol gate_symbols
. For example, getparameterindices(circuit, PauliRotation, [:X])
.
PauliPropagation.getparameterindices
— Methodgetparameterindices(circuit, GateType<:ParametrizedGate)
Utility function to get the parameter indices of gates of type GateType
in a circuit. This naturally only works for gates that subtype ParametrizedGate
.