class documentation

class CVOperators: (source)

View In Hierarchy

Build operator matrices for continuously variable bosonic gates.

Static Method call_op Call the operator function to build the array using the bound parameter values.
Method ajc Anti-Jaynes-Cummings gate
Method bs Two-mode beam splitter operator
Method c_multiboson_sampling SNAP gate creation for multiboson sampling purposes.
Method cbs Controlled phase two-mode beam splitter operator
Method cd Controlled displacement operator
Method cr Controlled phase space rotation operator
Method crx Controlled phase space rotation operator around sigma^x
Method cry Controlled phase space rotation operator around sigma^x
Method cschwinger General form of a controlled Schwinger gate
Method csnap SNAP (Selective Number-dependent Arbitrary Phase) operator, with explicit sigma_z in exponential. Can be used to generate fock-number selective qubit rotations.
Method csq Single-mode squeezing operator
Method csum Conditional two-qumode sum gate
Method d Displacement operator
Method ecd Echoed controlled displacement operator
Method eswap Exponential SWAP operator
Method gate_from_matrix Converts matrix into gate. Called using ParameterizedUnitaryGate.
Method get_a Annihilation operator
Method get_ad Creation operator
Method get_eye Identity matrix
Method get_N Number operator
Method get_op Helper function to construct creation/annihilation operators symbolically
Method get_projector Undocumented
Method jc Jaynes-Cummings gate
Method multicsnap SNAP (Selective Number-dependent Arbitrary Phase) operator for multiple Fock states. Generates an arbitrary number of fock-number selective qubit rotations, with the qubit that accrues the geometric phase explicit.
Method multisnap SNAP (Selective Number-dependent Arbitrary Phase) operator for multiple Fock states. Generates an arbitrary number of fock-number selective qubit rotations.
Method pnr Support gate for photon number readout (see Curtis et al., PRA (2021) and Wang et al., PRX (2020))
Method r Phase space rotation operator
Method rb Rabi interaction gate
Method s Single-mode squeezing operator
Method s2 Two-mode squeezing operator
Method s3 Three-mode squeezing operator
Method snap SNAP (Selective Number-dependent Arbitrary Phase) operator
Method sqr SQR gate (Liu et al, arXiv 2024)
Method sum Two-qumode sum gate
def call_op(op_func: UnitaryFunc, params: Sequence[complex | ParameterExpression], cutoffs: Sequence[int]) -> NDArray[np.complexfloating]: (source)

Call the operator function to build the array using the bound parameter values.

def ajc(self, theta: float, phi: float, cutoff: int) -> sp.csc_array: (source)

Anti-Jaynes-Cummings gate

Parameters
theta:real[0, 2pi)
phi:real[0, 2pi)
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def bs(self, theta: complex, cutoff_a: int, cutoff_b: int) -> sp.csc_array: (source)

Two-mode beam splitter operator

Parameters
theta:complexphase
cutoff_a:intUndocumented
cutoff_b:intUndocumented
Returns
csc_arrayoperator matrix
def c_multiboson_sampling(self, max: int, cutoff: int) -> sp.csc_array: (source)

SNAP gate creation for multiboson sampling purposes.

Parameters
max:intthe period of the mapping
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def cbs(self, theta: complex, cutoff_a: int, cutoff_b: int) -> sp.csc_array: (source)

Controlled phase two-mode beam splitter operator

Parameters
theta:complexbeamsplitter phase
cutoff_a:intUndocumented
cutoff_b:intUndocumented
Returns
csc_arrayoperator matrix
def cd(self, alpha: complex, beta: complex | None, cutoff: int) -> sp.csc_array: (source)

Controlled displacement operator

Parameters
alpha:complexdisplacement for qubit state 0
beta:complexdisplacement for qubit state 1. If None, use -alpha.
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def cr(self, theta: float, cutoff: int) -> sp.csc_array: (source)

Controlled phase space rotation operator

Parameters
theta:realphase
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def crx(self, theta: float, cutoff: int) -> sp.csc_array: (source)

Controlled phase space rotation operator around sigma^x

Parameters
theta:realphase
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def cry(self, theta: float, cutoff: int) -> sp.csc_array: (source)

Controlled phase space rotation operator around sigma^x

Parameters
theta:realphase
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def cschwinger(self, beta: float, theta_1: float, phi_1: float, theta_2: float, phi_2: float, cutoff_a: int, cutoff_b: int) -> sp.csc_array: (source)

General form of a controlled Schwinger gate

Parameters
beta:floatUndocumented
theta_1:floatUndocumented
phi_1:floatUndocumented
theta_2:floatUndocumented
phi_2:floatUndocumented
cutoff_a:intUndocumented
cutoff_b:intUndocumented
params:real[beta, theta_1, phi_1, theta_2, phi_2]
Returns
csc_arrayoperator matrix
def csnap(self, theta: float, n: int, cutoff: int) -> sp.csc_array: (source)

SNAP (Selective Number-dependent Arbitrary Phase) operator, with explicit sigma_z in exponential. Can be used to generate fock-number selective qubit rotations.

Parameters
theta:realphase
n:integerFock state in which the mode should acquire the phase
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def csq(self, theta: complex, cutoff: int) -> sp.csc_array: (source)

Single-mode squeezing operator

Parameters
theta:complexsqueeze
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def csum(self, scale: float, cutoff_a: int, cutoff_b: int) -> sp.csc_array: (source)

Conditional two-qumode sum gate

Parameters
scale:realarbitrary scale factor
cutoff_a:intUndocumented
cutoff_b:intUndocumented
Returns
csc_arrayoperator matrix
def d(self, alpha: complex, cutoff: int) -> sp.csc_array: (source)

Displacement operator

Parameters
alpha:complexdisplacement
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def ecd(self, theta: complex, cutoff: int) -> sp.csc_array: (source)

Echoed controlled displacement operator

Parameters
theta:complexdisplacement
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def eswap(self, theta, cutoff_a: int, cutoff_b: int) -> sp.csc_array: (source)

Exponential SWAP operator

Parameters
theta:realrotation
cutoff_a:intUndocumented
cutoff_b:intUndocumented
Returns
csc_arrayoperator matrix
def gate_from_matrix(self, matrix: ArrayLike) -> sp.csc_array: (source)

Converts matrix into gate. Called using ParameterizedUnitaryGate.

Parameters
matrix:listthe (unitary) matrix that you wish to convert into a gate
Returns
csc_arrayoperator matrix
def get_a(self, cutoff: int) -> sp.csc_array: (source)

Annihilation operator

def get_ad(self, cutoff: int) -> sp.csc_array: (source)

Creation operator

def get_eye(self, cutoff: int) -> sp.csc_array: (source)

Identity matrix

def get_N(self, cutoff: int) -> sp.csc_array: (source)

Number operator

def get_op(self, expr: str, *cutoffs: int) -> sp.csc_array: (source)

Helper function to construct creation/annihilation operators symbolically

def get_projector(self, n: int, cutoff: int) -> sp.csc_array: (source)

Undocumented

def jc(self, theta: float, phi: float, cutoff: int) -> sp.csc_array: (source)

Jaynes-Cummings gate

Parameters
theta:real[0, 2pi)
phi:real[0, 2pi)
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def multicsnap(self, *args: int | float | np.integer | np.floating) -> sp.csc_array: (source)

SNAP (Selective Number-dependent Arbitrary Phase) operator for multiple Fock states. Generates an arbitrary number of fock-number selective qubit rotations, with the qubit that accrues the geometric phase explicit.

Parameters
*args:List[reals, integers][List of phases, List of Fock states in which the mode should acquire the associated phase]
Returns
csr_matrixoperator matrix
def multisnap(self, *args: int | float | np.integer | np.floating) -> sp.csc_array: (source)

SNAP (Selective Number-dependent Arbitrary Phase) operator for multiple Fock states. Generates an arbitrary number of fock-number selective qubit rotations.

Parameters
*args:List[reals, integers][List of phases, List of Fock states in which the mode should acquire the associated phase]
Returns
csr_matrixoperator matrix
def pnr(self, max: int, cutoff: int) -> sp.csc_array: (source)

Support gate for photon number readout (see Curtis et al., PRA (2021) and Wang et al., PRX (2020))

Parameters
max:intthe period of the mapping
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def r(self, theta: float, cutoff: int) -> sp.csc_array: (source)

Phase space rotation operator

Parameters
theta:realrotation
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def rb(self, theta: complex, cutoff: int): (source)

Rabi interaction gate

Parameters
theta:complexarbitrary scale factor
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def s(self, theta: complex, cutoff: int) -> sp.csc_array: (source)

Single-mode squeezing operator

Parameters
theta:complexsqueeze
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def s2(self, theta: complex, cutoff_a: int, cutoff_b: int) -> sp.csc_array: (source)

Two-mode squeezing operator

Parameters
theta:complexsqueezing factor
cutoff_a:intUndocumented
cutoff_b:intUndocumented
Returns
csc_arrayoperator matrix
def s3(self, theta: complex, cutoff_a: int, cutoff_b: int, cutoff_c: int) -> sp.csc_array: (source)

Three-mode squeezing operator

Parameters
theta:complexsqueezing amount
cutoff_a:intUndocumented
cutoff_b:intUndocumented
cutoff_c:intUndocumented
Returns
csc_arrayoperator matrix
def snap(self, theta: float, n: int, cutoff: int) -> sp.csc_array: (source)

SNAP (Selective Number-dependent Arbitrary Phase) operator

Parameters
theta:realphase
n:integerFock state in which the mode should acquire the phase
cutoff:intUndocumented
Returns
csc_arrayoperator matrix
def sqr(self, *args: float) -> sp.csc_array: (source)

SQR gate (Liu et al, arXiv 2024)

This function assumes that the parameters (minus the cutoff) are concatenated, so it should have length 3*n, where n is the number of distinct fock states to condition on.

Returns
csc_array: The operator matrix
Parameters
*args:floatUndocumented
paramsGate parameters and cutoff, see CVCircuit.cv_sqr for the parameter structure
Returns
sp.csc_arrayUndocumented
def sum(self, scale: float, cutoff_a: int, cutoff_b: int) -> sp.csc_array: (source)

Two-qumode sum gate

Parameters
scale:realarbitrary scale factor
cutoff_a:intUndocumented
cutoff_b:intUndocumented
Returns
csc_arrayoperator matrix