Operations
Operations are common PrimitiveBlocks
, these are often
called gates elsewhere.
Constant blocks
X(target)
Y(target)
Z(target)
I(target)
H(target)
S(target)
SDagger(target)
Bases: PrimitiveBlock
The Hermitian adjoint/conjugate transpose of the S / Phase gate.
Source code in qadence/operations/primitive.py
SWAP(control, target)
Bases: PrimitiveBlock
The SWAP gate.
Source code in qadence/operations/primitive.py
T(target)
TDagger(target)
Bases: PrimitiveBlock
The Hermitian adjoint/conjugate transpose of the T gate.
Source code in qadence/operations/primitive.py
CNOT(control, target)
CY gate not implemented
CZ(control, target)
CPHASE(control, target, parameter)
Parametrized blocks
RX(target, parameter)
Bases: ParametricBlock
The Rx gate.
Source code in qadence/operations/parametric.py
RY(target, parameter)
RZ(target, parameter)
CRX(control, target, parameter)
CRY(control, target, parameter)
CRZ(control, target, parameter)
PHASE(target, parameter)
Bases: ParametricBlock
The Parametric Phase / S gate.
Source code in qadence/operations/parametric.py
Hamiltonian Evolution
HamEvo(generator, parameter, qubit_support=None)
Bases: TimeEvolutionBlock
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:
|
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: HamEvo
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
|
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
|
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
|
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 |
---|---|
InteractionBlock
|
a |