Operations
Operations are common PrimitiveBlocks
, these are often
called gates elsewhere.
Constant blocks
X(target, noise=None)
Y(target, noise=None)
Z(target, noise=None)
I(target, noise=None)
H(target, noise=None)
Bases:
The Hadamard or H gate.
Source code in qadence/operations/primitive.py
S(target, noise=None)
SDagger(target, noise=None)
Bases:
The Hermitian adjoint/conjugate transpose of the S / Phase gate.
Source code in qadence/operations/primitive.py
SWAP(control, target, noise=None)
Bases:
The SWAP gate.
Source code in qadence/operations/primitive.py
T(target, noise=None)
TDagger(target, noise=None)
Bases:
The Hermitian adjoint/conjugate transpose of the T gate.
Source code in qadence/operations/primitive.py
CNOT(control, target, noise=None)
CY gate not implemented
CZ(control, target, noise=None)
CPHASE(control, target, parameter, noise=None)
Bases:
The CPHASE gate.
Source code in qadence/operations/control_ops.py
Parametrized blocks
RX(target, parameter, noise=None)
Bases:
The Rx gate.
Source code in qadence/operations/parametric.py
RY(target, parameter, noise=None)
Bases:
The Ry gate.
Source code in qadence/operations/parametric.py
RZ(target, parameter, noise=None)
Bases:
The Rz gate.
Source code in qadence/operations/parametric.py
CRX(control, target, parameter, noise=None)
Bases:
The CRX gate.
Source code in qadence/operations/control_ops.py
CRY(control, target, parameter, noise=None)
CRZ(control, target, parameter, noise=None)
Bases:
The CRZ gate.
Source code in qadence/operations/control_ops.py
PHASE(target, parameter, noise=None)
Bases:
The Parametric Phase / S gate.
Source code in qadence/operations/parametric.py
Hamiltonian Evolution
HamEvo(generator, parameter, qubit_support=None, duration=None)
Bases:
A block implementing the Hamiltonian evolution operation H where:
H = exp(-iG, t)
where G represents a square generator and t represents the time parameter which can be parametrized.
PARAMETER | DESCRIPTION |
---|---|
generator |
Either a AbstractBlock, torch.Tensor or numpy.ndarray.
TYPE:
|
parameter |
A scalar or vector of numeric or torch.Tensor type.
TYPE:
|
qubit_support |
The qubits on which the evolution will be performed on.
TYPE:
|
duration |
duration of evolution in case of time-dependent generator
TYPE:
|
Examples:
from qadence import RX, HamEvo, run, PI
import torch
hevo = HamEvo(generator=RX(0, PI), parameter=torch.rand(2))
print(run(hevo))
# Now lets use a torch.Tensor as a generator, Now we have to pass the support
gen = torch.rand(2,2, dtype=torch.complex128)
hevo = HamEvo(generator=gen, parameter=torch.rand(2), qubit_support=(0,))
print(run(hevo))
Source code in qadence/operations/ham_evo.py
digital_decomposition(approximation=LTSOrder.ST4)
Decompose the Hamiltonian evolution into digital gates.
PARAMETER | DESCRIPTION |
---|---|
approximation |
Choose the type of decomposition. Defaults to "st4". Available types are: * 'basic' = apply first-order Trotter formula and decompose each term of the exponential into digital gates. It is exact only if applied to an operator whose terms are mutually commuting. * 'st2' = Trotter-Suzuki 2nd order formula for approximating non-commuting Hamiltonians. * 'st4' = Trotter-Suzuki 4th order formula for approximating non-commuting Hamiltonians.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
AbstractBlock
|
a block with the digital decomposition
TYPE:
|
Source code in qadence/operations/ham_evo.py
AnalogSWAP(control, target, parameter=3 * PI / 4)
Bases:
Single time-independent Hamiltonian evolution over a Rydberg Ising.
hamiltonian yielding a SWAP (up to global phase).
Derived from Bapat et al. where it is applied to XX-type Hamiltonian
Source code in qadence/operations/analog.py
AnalogSWAP should be turned into a proper analog block
Analog blocks
AnalogRX(angle, qubit_support='global', add_pattern=True)
Analog X rotation.
Shorthand for AnalogRot
:
PARAMETER | DESCRIPTION |
---|---|
angle |
Rotation angle [rad]
TYPE:
|
qubit_support |
Defines the (local/global) qubit support
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
|
ConstantAnalogRotation |
Source code in qadence/operations/analog.py
AnalogRY(angle, qubit_support='global', add_pattern=True)
Analog Y rotation.
Shorthand for AnalogRot
:
RETURNS | DESCRIPTION |
---|---|
|
ConstantAnalogRotation |
Source code in qadence/operations/analog.py
AnalogRZ(angle, qubit_support='global', add_pattern=True)
Analog Z rotation. Shorthand for AnalogRot
:
Source code in qadence/operations/analog.py
AnalogRot(duration, omega=0, delta=0, phase=0, qubit_support='global', add_pattern=True)
General analog rotation operation.
PARAMETER | DESCRIPTION |
---|---|
duration |
Duration of the rotation [ns].
TYPE:
|
omega |
Rotation frequency [rad/μs]
TYPE:
|
delta |
Rotation frequency [rad/μs]
TYPE:
|
phase |
Phase angle [rad]
TYPE:
|
qubit_support |
Defines the (local/global) qubit support
TYPE:
|
add_pattern |
False disables the semi-local addressing pattern for the execution of this specific block.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
|
ConstantAnalogRotation |
Source code in qadence/operations/analog.py
AnalogInteraction(duration, qubit_support='global', add_pattern=True)
Evolution of the interaction term for a register of qubits.
Constructs a InteractionBlock
.
PARAMETER | DESCRIPTION |
---|---|
duration |
Time to evolve the interaction for in nanoseconds.
TYPE:
|
qubit_support |
Qubits the
TYPE:
|
add_pattern |
False disables the semi-local addressing pattern for the execution of this specific block.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
|
a |