class documentation

class CVCircuit(QuantumCircuit): (source)

Constructor: CVCircuit(*regs, name, probe_measure)

View In Hierarchy

Extension of QisKit QuantumCircuit to add continuous variable (bosonic) gate support to simulations.

Method __init__ Initialize the registers (at least one must be QumodeRegister) and set the circuit name.
Method add_qubit_register Add a qubit register to the circuit.
Method cv_bs Two-mode beam splitter gate.
Method cv_c_bs Controlled phase two-mode beam splitter
Method cv_c_d Conditional displacement gate.
Method cv_c_multiboson_sampling SNAP (Selective Number-dependent Arbitrary Phase) gates for multiboson sampling.
Method cv_c_pnr PNR (Photon number readout) TODO: Needs comments/explanation/citation!
Method cv_c_r Qubit dependent phase-space rotation gate (i.e., dispersive interaction).
Method cv_c_rx Qubit dependent phase-space rotation around sigma^x gate.
Method cv_c_ry Qubit dependent phase-space rotation around sigma^y gate.
Method cv_c_schwinger General form of a controlled 'Schwinger' gate, containing both the controlled phase beamsplitter and pairs of controlled phase space rotations as special cases.
Method cv_c_sq Conditional squeezing gate.
Method cv_d Displacement gate.
Method cv_delay CV_delay. Implements an identity gate of the specified duration. This is particularly useful for the implementation of a noise pass.
Method cv_ecd Echoed controlled displacement gate.
Method cv_eswap Exponential SWAP gate.
Method cv_gate_from_matrix Converts matrix to gate. Note that if you choose to input some complex gate that would typically be physically implemented by multiple successive gate operations, PhotonLossNoisePass, simulate(discretize=True), and animate may not be applied in a way that is physical.
Method cv_initialize Initialize qumode (or qumodes) to a particular state specified by params
Method cv_measure Measure Qumodes and Qubits in qubit_qumode_list and map onto classical bits specified in cbit_list.
Method cv_r Phase space rotation gate.
Method cv_snap SNAP (Selective Number-dependent Arbitrary Phase) gate. If no qubit is passed, then phases are applied to each qumode Fock state specified in theta and n (without explicit rotation of the qubit). If a qubit is passed, the phase will be multiplied by sigma_z-dependent geometric phase (akin to the implementation of the SNAP gate as described in Heeres et al, PRL (2015).
Method cv_snapshot Wrap the Qiskit QuantumCircuit Snapshot function, giving it a known label for later Wigner function plot generation
Method cv_sq Squeezing gate.
Method cv_sq2 Two-mode squeezing gate
Method cv_sq3 Three-mode squeezing gate
Method cv_testqubitorderf Undocumented
Method get_qmr_cutoff Return the qumode cutoff at the given index
Method get_qmr_index Return the qumode index for the given qubit. If not found, return -1.
Method get_qmr_num_qubits_per_qumode Return the number of qubits in the qumode register at the given index
Method get_qubit_index Return the index of the given Qubit
Method get_qubit_indices Return the indices of the given Qubits
Method measure_x Measure qubit in x using probe qubits
Method measure_y Measure qubit in y using probe qubits
Method measure_z Measure qubit in z using probe qubits
Method merge Merge in properties of QisKit QuantumCircuit into this instance.
Method save_circuit Save the simulator statevector using a qiskit class
Instance Variable cregs Undocumented
Instance Variable cv_snapshot_id Undocumented
Instance Variable ops Undocumented
Instance Variable probe Undocumented
Instance Variable probe_measure Undocumented
Instance Variable qmregs Undocumented
Instance Variable qregs Undocumented
Property cv_gate_labels All the CV gate names on the current circuit. These will be instances of ParameterizedUnitaryGate.
Property qumode_qubit_indices A qubit index list of the qubits representing the qumode registers on the circuit
Property qumode_qubits All the qubits representing the qumode registers on the circuit
Property qumode_qubits_indices_grouped Same as qumode_qubit_indices but it groups qubits representing the same qumode together. Returns a nested list.
Instance Variable _ancillas Undocumented
Instance Variable _calibrations Undocumented
Instance Variable _clbit_indices Undocumented
Instance Variable _clbits Undocumented
Instance Variable _data Undocumented
Instance Variable _metadata Undocumented
Instance Variable _qubit_indices Undocumented
Instance Variable _qubit_regs Undocumented
Instance Variable _qubits Undocumented
def __init__(self, *regs, name: str = None, probe_measure: bool = False): (source)

Initialize the registers (at least one must be QumodeRegister) and set the circuit name.

Parameters
*regsUndocumented
name:str, optionalcircuit name. Defaults to None.
probe_measure:bool, optionalautomatically support measurement with probe qubits. Defaults to False.
Raises
ValueErrorIf no QumodeRegister is provided.
def add_qubit_register(self, *regs): (source)

Add a qubit register to the circuit.

Parameters
*regs:listList of Registers
def cv_bs(self, theta, qumode_a, qumode_b, duration=100, unit='ns'): (source)

Two-mode beam splitter gate.

Parameters
theta:real or complexbeamsplitter phase
qumode_a:listlist of qubits representing first qumode
qumode_b:listlist of qubits representing second qumode
durationUndocumented
unitUndocumented
Returns
InstructionQisKit instruction
def cv_c_bs(self, theta, qumode_a, qumode_b, qubit, duration=100, unit='ns'): (source)

Controlled phase two-mode beam splitter

Parameters
theta:real or complexphase
qumode_a:listlist of qubits representing first qumode
qumode_b:listlist of qubits representing second qumode
qubitUndocumented
durationUndocumented
unitUndocumented
qubit_ancilla:QubitQisKit control Qubit
Returns
InstructionQisKit instruction
def cv_c_d(self, theta, qumode, qubit, beta=None, duration=100, unit='ns'): (source)

Conditional displacement gate.

Parameters
theta:realdisplacement
qumode:listlist of qubits representing qumode
qubit:Qubitcontrol qubit
beta:realBy default is None, and qumode will be displaced by alpha and -alpha for qubit
durationUndocumented
unitUndocumented
state 0 and 1
respectively. If specified
qumode will be displaced by alpha and beta for qubit state 0 and 1.
Returns
InstructionQisKit instruction
def cv_c_multiboson_sampling(self, max, qumode, qubit, duration=1, unit='us'): (source)

SNAP (Selective Number-dependent Arbitrary Phase) gates for multiboson sampling.

Parameters
max:intthe period of the mapping
qumode:listlist of qubits representing qumode
qubit:Qubitcontrol qubit.
durationUndocumented
unitUndocumented
Returns
InstructionQisKit instruction
def cv_c_pnr(self, max, qumode, qubit, duration=100, unit='ns'): (source)

PNR (Photon number readout) TODO: Needs comments/explanation/citation!

Parameters
max:intthe period of the mapping
qumode:listlist of qubits representing qumode
qubit:Qubitcontrol qubit.
durationUndocumented
unitUndocumented
Returns
InstructionQisKit instruction
def cv_c_r(self, theta, qumode, qubit, duration=100, unit='ns'): (source)

Qubit dependent phase-space rotation gate (i.e., dispersive interaction).

Parameters
theta:realphase
qumodeUndocumented
qubitUndocumented
durationUndocumented
unitUndocumented
qumode_a:listlist of qubits representing qumode
qubit_ancilla:qubitQisKit control qubit
Returns
InstructionQisKit instruction
def cv_c_rx(self, theta, qumode, qubit, duration=100, unit='ns'): (source)

Qubit dependent phase-space rotation around sigma^x gate.

Parameters
theta:realphase
qumodeUndocumented
qubitUndocumented
durationUndocumented
unitUndocumented
qumode_a:listlist of qubits representing qumode
qubit_ancilla:qubitQisKit control qubit
Returns
InstructionQisKit instruction
def cv_c_ry(self, theta, qumode, qubit, duration=100, unit='ns'): (source)

Qubit dependent phase-space rotation around sigma^y gate.

Parameters
theta:realphase
qumodeUndocumented
qubitUndocumented
durationUndocumented
unitUndocumented
qumode_a:listlist of qubits representing qumode
qubit_ancilla:qubitQisKit control qubit
Returns
InstructionQisKit instruction
def cv_c_schwinger(self, params, qumode_a, qumode_b, qubit, duration=100, unit='ns'): (source)

General form of a controlled 'Schwinger' gate, containing both the controlled phase beamsplitter and pairs of controlled phase space rotations as special cases.

It has the form exp(-i*beta*(n1_hat.sigma)(n2_hat.S)), where ni_hat = sin(theta_i)*cos(phi_i) + sin(theta_i)*sin(phi_i) + cos(theta_i). sigma = [sigmax, sigmay, sigmaz] is the vector of Pauli operators, and S = [Sx, Sy, Sz] is a vector of Schwinger boson operators,

Sx = (a*bdag + adag*b)/2 Sy = (a*bdag - adag*b)/2i Sz = (bdag*b - adag*a)/2,

obeying the commutation relations [Sj, Sk] = i*epsilon_{ijk}*Sz, where epsilon_{ijk} is the Levi-Civita tensor.

Parameters
params:real[beta, theta_1, phi_1, theta_2, phi_2]
qumode_a:listlist of qubits representing first qumode
qumode_b:listlist of qubits representing second qumode
qubitUndocumented
durationUndocumented
unitUndocumented
qubit_ancilla:QubitQisKit control Qubit
Returns
InstructionQisKit instruction
def cv_c_sq(self, theta, qumode, qubit, duration=100, unit='ns'): (source)

Conditional squeezing gate.

Parameters
theta:real or complexsqueezing ampltiude
qumode:listlist of qubits representing qumode
qubit:Qubitcontrol Qubit
durationUndocumented
unitUndocumented
Returns
InstructionQisKit instruction
def cv_d(self, alpha, qumode, duration=100, unit='ns'): (source)

Displacement gate.

Parameters
alpha:real or complexdisplacement
qumode:listlist of qubits representing qumode
durationUndocumented
unitUndocumented
cutoff:intqumode cutoff
Returns
InstructionQisKit instruction
def cv_delay(self, duration, qumode, unit='ns'): (source)

CV_delay. Implements an identity gate of the specified duration. This is particularly useful for the implementation of a noise pass.

Parameters
duration:realduration of delay gate
qumode:listlist of qubits representing qumode
unitUndocumented
Returns
InstructionQisKit instruction
def cv_ecd(self, theta, qumode, qubit, duration=100, unit='ns'): (source)

Echoed controlled displacement gate.

Parameters
theta:realdisplacement
qumode:listlist of qubits representing qumode
qubitUndocumented
durationUndocumented
unitUndocumented
Returns
InstructionQisKit instruction
def cv_eswap(self, theta, qumode_a, qumode_b, duration=100, unit='ns'): (source)

Exponential SWAP gate.

Parameters
theta:realphase
qumode_a:listlist of qubits representing qumode
qumode_b:listlist of qubits representing qumode
durationUndocumented
unitUndocumented
Returns
InstructionQisKit instruction
def cv_gate_from_matrix(self, matrix, qumodes=[], qubits=[], duration=100, unit='ns', label: str = 'cv_gate_from_matrix'): (source)

Converts matrix to gate. Note that if you choose to input some complex gate that would typically be physically implemented by multiple successive gate operations, PhotonLossNoisePass, simulate(discretize=True), and animate may not be applied in a way that is physical.

Parameters
matrix:np.array/nested listMatrix for conversion into gate
qumodes:QumodeRegister/listQumodes initialized by QumodeRegister
qubits:QuantumRegister/listQubits initialized by QuantumRegister
durationUndocumented
unitUndocumented
label:strUndocumented
Returns
InstructionQisKit instruction
def cv_initialize(self, params, qumodes): (source)

Initialize qumode (or qumodes) to a particular state specified by params

Parameters
params:list or intIf an int, all specified qumodes will be initialized to the Fock state with n=params. If a list, all specified qumodes will be initialized to a superposition of Fock states, with params[n] the complex amplitude of Fock state |n>. The length of params must be less than or equal to the cutoff.
qumodes:listlist of qubits representing a single qumode, or list of multiple qumodes
Raises
ValueErrorIf the Fock state is greater than the cutoff.
def cv_measure(self, qubit_qumode_list, cbit_list): (source)

Measure Qumodes and Qubits in qubit_qumode_list and map onto classical bits specified in cbit_list.

Parameters
qubit_qumode_list:ListList of individual Qubits and Qumodes (i.e., indexed elements of QubitRegisters and QumodeRegisters)
cbit_list:ListList of classical bits to map measurements onto. Note: Measurement of qumodes requires log(c) classical bits, where c is the cutoff. If len(cbit_list) is greater than the required number of classical bits, excess will be ignored. If len(cbit_list) is insufficient, an error will be thrown.
Returns
InstructionQisKit measure instruction
def cv_r(self, theta, qumode, duration=100, unit='ns'): (source)

Phase space rotation gate.

Parameters
theta:realrotation
qumode:listlist of qubits representing qumode
durationUndocumented
unitUndocumented
cutoff:intqumode cutoff
Returns
InstructionQisKit instruction
def cv_snap(self, theta, n, qumode, qubit=None, duration=100, unit='ns'): (source)

SNAP (Selective Number-dependent Arbitrary Phase) gate. If no qubit is passed, then phases are applied to each qumode Fock state specified in theta and n (without explicit rotation of the qubit). If a qubit is passed, the phase will be multiplied by sigma_z-dependent geometric phase (akin to the implementation of the SNAP gate as described in Heeres et al, PRL (2015).

Parameters
theta:real or list[real]phase
n:integer or list[integer]Fock state in which the mode should acquire the phase
qumode:listlist of qubits representing qumode
qubit:Qubitcontrol qubit. If no qubit is passed, the gate will implement for sigma^z = +1.
durationUndocumented
unitUndocumented
Returns
InstructionQisKit instruction
def cv_snapshot(self): (source)

Wrap the Qiskit QuantumCircuit Snapshot function, giving it a known label for later Wigner function plot generation

def cv_sq(self, theta, qumode, duration=100, unit='ns'): (source)

Squeezing gate.

Parameters
theta:real or complexsqueeze
qumode:listlist of qubits representing qumode
durationUndocumented
unitUndocumented
Returns
InstructionQisKit instruction
def cv_sq2(self, theta, qumode_a, qumode_b, duration=100, unit='ns'): (source)

Two-mode squeezing gate

Parameters
theta:real or complexsqueeze
qumode_a:listlist of qubits representing first qumode
qumode_b:listlist of qubits representing second qumode
durationUndocumented
unitUndocumented
Returns
InstructionQisKit instruction
def cv_sq3(self, theta, qumode_a, qumode_b, qumode_c, duration=100, unit='ns'): (source)

Three-mode squeezing gate

Parameters
theta:real or complexsqueeze
qumode_a:listlist of qubits representing first qumode
qumode_b:listlist of qubits representing second qumode
qumode_c:listlist of qubits representing third qumode
durationUndocumented
unitUndocumented
Returns
InstructionQisKit instruction
def cv_testqubitorderf(self, phi, qubit_1, qubit_2, duration=100, unit='ns'): (source)

Undocumented

def get_qmr_cutoff(self, qmr_index: int): (source)

Return the qumode cutoff at the given index

def get_qmr_index(self, qubit): (source)

Return the qumode index for the given qubit. If not found, return -1.

def get_qmr_num_qubits_per_qumode(self, qmr_index: int): (source)

Return the number of qubits in the qumode register at the given index

def get_qubit_index(self, qubit): (source)

Return the index of the given Qubit

def get_qubit_indices(self, qubits: list): (source)

Return the indices of the given Qubits

def measure_x(self, qubit, cbit): (source)

Measure qubit in x using probe qubits

Parameters
qubit:QubitQisKit qubit to measure
cbit:ClassicalBitQisKit classical bit to measure into
Returns
InstructionQisKit measure instruction
def measure_y(self, qubit, cbit): (source)

Measure qubit in y using probe qubits

Parameters
qubit:QubitQisKit qubit to measure
cbit:ClassicalBitQisKit classical bit to measure into
Returns
InstructionQisKit measure instruction
def measure_z(self, qubit, cbit, duration=100, unit='ns'): (source)

Measure qubit in z using probe qubits

Parameters
qubit:QubitQisKit qubit to measure
cbit:ClassicalBitQisKit classical bit to measure into
durationUndocumented
unitUndocumented
Returns
InstructionQisKit measure instruction
def merge(self, circuit: QuantumCircuit): (source)

Merge in properties of QisKit QuantumCircuit into this instance.

Useful if QisKit returned a new instance of QuantumCircuit after passing in this instance. Calling merge() can merge the two, keeping this instance.

See https://qiskit.org/documentation/_modules/qiskit/circuit/quantumcircuit.html#QuantumCircuit.copy

def save_circuit(self, conditional, pershot, label='statevector'): (source)

Save the simulator statevector using a qiskit class

Undocumented

cv_snapshot_id: int = (source)

Undocumented

Undocumented

Undocumented

probe_measure = (source)

Undocumented

Undocumented

Undocumented

@property
cv_gate_labels = (source)

All the CV gate names on the current circuit. These will be instances of ParameterizedUnitaryGate.

@property
qumode_qubit_indices = (source)

A qubit index list of the qubits representing the qumode registers on the circuit

@property
qumode_qubits = (source)

All the qubits representing the qumode registers on the circuit

@property
qumode_qubits_indices_grouped = (source)

Same as qumode_qubit_indices but it groups qubits representing the same qumode together. Returns a nested list.

_ancillas = (source)

Undocumented

_calibrations = (source)

Undocumented

_clbit_indices = (source)

Undocumented

Undocumented

Undocumented

_metadata = (source)

Undocumented

_qubit_indices = (source)

Undocumented

_qubit_regs: list = (source)

Undocumented

Undocumented