nl
The quotonic.nl module includes functions required to construct the transfer matrix of a specified set of
single-site optical nonlinearities across \(m\) optical modes.
All code in this module is inspired by Bosonic: A Quantum Optics Library, as originally designed for use in G. R. Steinbrecher et al., “Quantum optical neural networks”, npj Quantum Inf 5, 60 (2019), and by Cascaded Optical Systems Approach to Neural Networks (CasOptAx) as originally designed for use in J. R. Basani et al., "Universal logical quantum photonic neural network processor via cavity-assisted interactions", npj Quantum Inf 11, 142 (2025).
build_kerr(n, m, varphi, basis_type='secq', burnout_map=None)
¶
Construct the diagonal nonlinear Kerr unitary in the relevant basis.
This function constructs the diagonal unitary matrix, \(\boldsymbol{\Sigma}(\varphi)\), corresponding to single-site Kerr nonlinearities of strength \(\varphi\) applied across a set of \(m\) optical modes. If all single-site nonlinearities are applied, then this matrix is expressed mathematically as,
From this form, it is evident that \(\boldsymbol{\Sigma}(\varphi)\) is the \(N\times N\) identity matrix ( \(\mathbf{I}_N\)), where \(N\) is the Fock basis dimension, in cases of \(n < 2\), where \(n\) is the number of photons. The \(n\) is the previous expression is better explained as the number of photons in the optical mode for which a single-site optical Kerr nonlinearity is applied. This is best displayed by example. In the case where \(n=3\), \(m=2\), the Fock basis has a dimension of \(N = 4\) with basis states \(\left\{\left|30\right\rangle, \left|21\right\rangle, \left|12\right\rangle, \left|03\right\rangle\right\}\). As evident from the expression above, given the orthonormality of the Fock basis, the only nonzero elements lie on the diagonal of the unitary \(\boldsymbol{\Sigma}(\varphi)\). Consider the calculation of the element located at the row and column both corresponding to state \(\left|21\right\rangle\),
From the tensor products, it is evident that the Kerr nonlinearities are single-site and thus applied by mode. After completing the calculation of the other elements along the diagonal, the resulting unitary is given as follows,
where the ordering of the rows and columns follows that in which the basis states were listed previously. The
previous process can be modified by burning out some of the single-site nonlinearities. This is conducted by
passing an array of binary/boolean values to the function in burnoutMap. This 1D array has \(m\) elements,
each respectively telling the function whether the single-site nonlinearity at a specific mode is on or off.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
number of photons, \(n\) |
required |
m
|
int
|
number of optical modes, \(m\) |
required |
varphi
|
float | np_ndarray
|
effective nonlinear phase shifts for each single-site nonlinear element in \(\text{rad}\), \(\varphi\), a float when all \(m\) are the same, otherwise an \(m\)-length array |
required |
basis_type
|
str
|
specifies whether the unitary should be constructed in the first or second-quantized basis |
'secq'
|
burnout_map
|
np_ndarray | None
|
array of length \(m\), with either boolean or binary elements, specifying whether nonlinearities are on/off for specific modes |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Sigma |
np_ndarray
|
\(N\times N\) array, the matrix representation of the set of single-site Kerr nonlinearities resolved in the relevant basis |
Source code in src/quotonic/nl.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
build_photon_mp(n, m, varphi1, varphi2, basis_type='secq', burnout_map=None)
¶
Construct the diagonal nonlinear \(\Lambda\)-type 3LS photon \(\mp\) unitary in the relevant basis.
This function constructs the diagonal unitary matrix, \(\boldsymbol{\Sigma}(\varphi)\), corresponding to
single-site optical nonlinearities applied across a set of \(m\) optical modes via a cavity-assisted interaction with
a \(\Lambda\)-type 3LS. It is designed in analogy with build_kerr, so refer to that documentation for further
details. The only difference is that there are two controllable phase shift parameters, \(\varphi_1\) and
\(\varphi_2\). When \(n\) photons enter each nonlinear component, one of them is deterministically subtracted from
the rest, picking up a phase shift of \(\varphi_1\), while the remaining \(n - 1\) each pick up a phase shift of
\(\varphi_2\). This is outlined in further detail in the publication that proposed these nonlinear components,
J. R. Basani et al., "Universal logical quantum photonic neural network processor via cavity-assisted
interactions", npj Quantum Inf 11, 142 (2025).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
number of photons, \(n\) |
required |
m
|
int
|
number of optical modes, \(m\) |
required |
varphi1
|
float
|
phase shift applied to the subtracted photon in \(\text{rad}\), \(\varphi_1\) |
required |
varphi2
|
float
|
phase shift applied to the remaining photons in \(\text{rad}\), \(\varphi_2\) |
required |
basis_type
|
str
|
specifies whether the unitary should be constructed in the first or second-quantized basis |
'secq'
|
burnout_map
|
np_ndarray | None
|
array of length \(m\), with either boolean or binary elements, specifying whether nonlinearities are on/off for specific modes |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Sigma |
np_ndarray
|
\(N\times N\) array, the matrix representation of the set of single-site photon \(\mp\) nonlinearities resolved in the relevant basis |
Source code in src/quotonic/nl.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |