This example demonstrates the basic functions and workflow of the qINTERCONNECT solver. The fidelity and probability of success are calculated for an ideal NLS gate, which applies a phase shift to only the two-photon component of an input state. Additionally, it shows how to perform sweeps over circuit parameters and how these changes impact the fidelity and probability of success. Finally, it demonstrates how to account for photon loss via additional loss channels.
Overview
Understand the simulation workflow and key results
The simulations in this example are performed with the qINTERCONNECT solver. The simulation is set up and run through the Python API, which can either be run directly in INTERCONNECT or in an external Python environment. Since qINTERCONNECT requires an INTERCONNECT GUI license to run, at least two GUI licenses are required to run qINTERCONNECT directly from the INTERCONNECT environment. Documentation for the Python API is available here .
The NLS gate is a key resource for facilitating nonlinear photon-photon interactions using only linear optical devices [2]. The NLS gate consists of a signal channel and two additional ancilla channels, which facilitate the nonlinear interaction. The circuit contains three beam splitters and one phase shifter. The parameters of these components are carefully chosen such that when one photon is sent into the first ancilla channel and zero photons are sent to the second ancilla channel, a phase shift of π is applied to a two-photon input state but leaves a zero- or one-photon input state unchanged. The gate will operate successfully only when the output of the first ancilla channel is one photon and the output of the second ancilla channel is zero photons, which occurs with a success rate of 25%.
Step 1: Single simulation of ideal NLS gate circuit with qINTERCONNECT
In this step, we calculate the probability of success and fidelity for a single set of parameters.
Step 2: Parameter sweep
A sweep will be performed over the coupling parameter \( \theta_1 \) of the first waveguide coupler. The fidelity and probability of success will be shown as a function of \( \theta_1 \).
Step 3: Simulation of a lossy circuit
A sweep will be performed over loss values for one of the waveguide couplers in the NLS gate. The fidelity and probability of success will be shown as a function of this loss.
Run and Results
Instructions for running the model and discussion of key results
Step 1: Single simulation of ideal NLS gate circuit with qINTERCONNECT
- Open and run the script NLS_ideal.py in the INTERCONNECT environment. Alternatively, the script can be run from the command line or an external python environment assuming the path to Lumerical’s python module has been specified. NOTE: Running qINTERCONNECT in the INTERCONNECT requires 2 GUI licenses.
The simulation parameters are set in the nlsparams dictionary and are used as an input to the solver, which can then be run.
nls = QSolver(**nlsparams)
success_prob=nls.run()
The solver first opens the circuit in INTERCONNECT and extracts the classical S-Parameters into a matrix, checking to make sure it’s unitary. After the simulation is completed, the fidelity and probability of success are displayed
Visit the user guide for more information on accessing simulation results such as the output density matrix, quantum scattering matrix, and more.
Step 2: Parameter sweep
- Open and run the script NLS_sweep.py
An additional parameter is included in the nlsparams dictionary, corresponding to a dictionary of parameters in the circuit to be swept over. The coupling parameter \( \theta_1 \) of the first waveguide coupler is swept from 1.00 to 1.3 radians in increments of 0.025.
"parameters":{
"theta_1":[1.00,1.3,0.025]
},
Check to verify that “theta_1” is the expression used to determine the coupling parameter of the first waveguide coupler in the project file.
The sweep can then be run.
nls = QSolver(**nlsparams)
success_prob=nls.run_sweep()
We then plot the fidelity and probability of success as a function of \( \theta_1 \).
As the value of \( \theta_1 \) deviates from the value of 65.5302° (1.144 radians) the fidelity decreases, meaning that the output state is diverging from the expected result. In contrast, the probability of success is maximized at 26% for \( \theta_1 = 1.069 \). This is because the success probability only depends on the ancilla channels having the correct output and is unaffected by the output in the signal channel.
Step 3: Simulation of a lossy circuit
- Open and run the script NLS_loss.py
Unlike a classical system, we cannot account for loss simply by removing a fraction of photons through lossy elements. The time evolution of our quantum system must be unitary, and thus reversible. Consequently, we must keep track of all the photons in our system that are "lost". Loss is thus incorporated via waveguide couplers, where the signal photons continue through the circuit and the "lost" photons are redirected to additional loss channels. Since the evolution must be reversible, these additional loss channels will have both input and output channels. An NLS gate with these additional channels added can be seen in 'NLS_gate_with_losses.icp'.
Along with specifying the additional loss ports, the key "loss_dims" must also be specified, which is the maximum photon number in each loss channel.
Here we sweep the value of “loss_theta” from 1.4708 to 1.5709 radians and plot the fidelity and the probability of success. Since the loss is parametrized in terms of a beamsplitter, the loss fraction is given by the cosine of the coupling value: \( loss = cos(\theta) \).
Important Model Settings
Description of important objects and settings used in this model
The simulation parameters are set in a dictionary, for example, nlsparams in NLS_ideal.py.
nlsparams = {
"mode_per_channel": 1,
"nchannel": 3,
"interconnect_file": "NLS_ideal.icp",
"circuit": "NLS",
"input_ports": ["signal_in", "ancilla1_in", "ancilla0_in"],
"output_ports": ["signal_out", "ancilla1_out", "ancilla0_out"],
"nmax":3,
"input_dims": [3,3,3],
"ket_in":{
(0, 1, 0): [0.4,0],
(1, 1, 0): [0.1,0],
(2, 1, 0): [0.91104,0]
},
"ket_out":{
(0,): [0.4,0],
(1,): [0.1,0],
(2,): [-0.91104,0]
},
"measurement_mask":[100,1,0]
}
Common settings
interconnect_file : the name of the INTERCONNECT file “NLS_ideal.icp” containing the circuit for the NLS gate.
circuit, nchannel, mode per channel : Every circuit simulated in qINTERCONNECT must be contained in a compound element, so we provide the name of this compound element (circuit) as “NLS”. The NLS circuit contains three channels, corresponding to the signal and two ancilla channels, so we set nchannel to 3, and we set mode_per_channel to 1.
Input_ports, output_ports : we provide the names of the input and output ports as they are named in the INTERCONNECT circuit.
nmax : Since we are simulating up to two signal photons and one ancilla photon, we set the maximum number of photons ‘nmax’ to 3.
input_dims : the maximum number of photons to be simulated in each mode, which in this case is 3.
ket_in : The input state is specified in the Fock basis under dictionary “ket_in”, where the key is a tuple corresponding to the number of photons in each channel, and the value is a list corresponding to the probability amplitude of the state in polar coordinates, ordered by the magnitude and then the angle. Here the input in the signal channel corresponds to the state
$$ \vert \psi \rangle_{in} = 0.4 \vert 0 \rangle + 0.1 \vert 1 \rangle + 0.91104 \vert 2 \rangle $$
Or, including the ancilla channels, we can write the input state as
$$ \vert \psi \rangle_{in} = 0.4 \vert 010 \rangle + 0.1 \vert 110 \rangle + 0.91104 \vert 210 \rangle $$
measurement_mask : refers to what we are measuring at the output of each mode. A value of 100 means we do not directly measure the mode, but we want to know its state at the end of the simulation, whereas a value of 200 means the information in the mode is traced over, so that it doesn’t appear in the final density matrix. Any other value means we only keep the outcomes where such a number of photons is detected.
For instance, the NLS gate will only correctly flip the sign of the input when there is a single photon detected at the 'ancilla1' output port and no photon detected at the 'ancilla0' output port. Since we want to know final state of the output at the signal port, the measurement mask for this case will read [100,1,0] corresponding to the signal channel, ancilla 1 channel, and ancilla 0 channel, respectively.
ket_out : the expected output state in the signal channel is
$$ \vert \psi \rangle_{out} = 0.4 \vert 0 \rangle + 0.1 \vert 1 \rangle - 0.91104 \vert 2 \rangle $$
Where the sign of the two-photon component is flipped. By putting the expected behaviour of the circuit into ‘ket_out’, the fidelity of the gate can be determined.
For parameter sweep
parameters : this dictionary contains the parameters to sweep through. Each parameter should correspond to a circuit parameter in INTERCONNECT
"parameters":{ #parameters to sweep through, has to correspond to circuit params in INTERCONNECT
"theta_1":[1.00,1.3,0.025]
},
For lossy circuits
loss_input, loss_output : loss input and output channels
"loss_inputs":["BS_1_Tloss_in", "BS_2_Rloss_in", "BS_1_Rloss_in","BS_3_Tloss_in","BS_3_Rloss_in","BS_2_Tloss_in"],
"loss_outputs":["BS_1_Tloss_out","BS_2_Rloss_out", "BS_1_Rloss_out","BS_3_Tloss_out","BS_3_Rloss_out","BS_2_Tloss_out"],
loss_dims : maximum photon number in each loss channel.
"loss_dims": [3,2,3,3,3,2],
Updating the Model With Your Parameters
Instructions for updating the model based on your device parameters
Changing circuit parameters
The waveguide coupler parameters \( \theta_1 \), \( \theta_2 \), \( \theta_3 \) and the phase shift value \( \phi \) can be adjusted in the project file.
Changing simulation parameters
The probability amplitudes of the input state can be adjusted in the nlsparams dictionary to match the statistics of a desired input state.
Taking the Model Further
Information and tips for users that want to further customize the model
- The phase shifter and waveguide couplers in the project file can be replaced with custom components, provided they have the same S-parameters and are connected in the same order.
- Waveguides can be added as circuit elements, simulating the phase evolution due to propagation. Additionally, waveguide loss can be incorporated by introducing additional loss channels.
Additional Resources
Additional documentation, examples and training material
Related Publications
- Nielsen & I. Chuang, Quantum Computation and Quantum Information, Cambridge University Press (2010)
- Knill, E., Laflamme, R. & Milburn, G. A scheme for efficient quantum computation with linear optics. Nature 409, 46–52 (2001). https://doi.org/10.1038/35051009