Backends and simulator¶
dynamiqs
¶
compiler
¶
DiscreteVariableState
¶
Bases: AbstractPureState
A pure quantum state for a discrete variable system.
\(|\psi\rangle = \sum_{i} a_i |i\rangle\) where \(a_i\) are amplitudes and \(|i\rangle\) are basis states.
Source code in src/squint/interface/dv.py
MaximallyMixedState
¶
Bases: AbstractMixedState
The maximally mixed state for discrete variable systems.
Represents the completely mixed density matrix \(\rho = I/d\) where \(d\) is the total Hilbert space dimension. This state has maximum von Neumann entropy and represents complete ignorance about the quantum state.
The density matrix is constructed as: \(\(\rho = \frac{1}{d} \sum_{i=0}^{d-1} |i\rangle\langle i|\)\)
where \(d = \prod_i d_i\) is the product of all wire dimensions.
Example
Note
This state requires the "mixed" backend in the circuit.
Source code in src/squint/interface/dv.py
XGate
¶
Bases: AbstractGate
The generalized shift operator, which when dim = 2 corresponds to the standard \(X\) gate.
\(U = \sum_{k=0}^{d-1} |k\rangle \langle (k+1) \mod d|\)
Source code in src/squint/interface/dv.py
ZGate
¶
Bases: AbstractGate
The generalized phase operator, which when dim = 2 corresponds to the standard \(Z\) gate.
\(U = \sum_{k=0}^{d-1} e^{2\pi i k / d} |k\rangle\langle k|\)
Source code in src/squint/interface/dv.py
HGate
¶
Bases: AbstractGate
The generalized discrete Fourier operator, which when dim = 2 corresponds to the standard \(H\) gate.
\(U = \frac{1}{\sqrt{d}} \sum_{j,k=0}^{d-1} e^{2\pi i jk / d} |j\rangle\langle k|\)
Source code in src/squint/interface/dv.py
Conditional
¶
Bases: AbstractGate
The generalized conditional operator. Applies gate \(U\) raised to a power conditional on the control state: \(U = \sum_{k=0}^{d-1} |k\rangle\langle k| \otimes U^k\)
Source code in src/squint/interface/dv.py
RZGate
¶
Bases: AbstractGate
Rotation gate around the Z-axis for qubits and qudits.
For qubits (dim=2), this implements the standard RZ rotation: \(\(R_Z(\phi) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\phi} \end{pmatrix}\)\)
For qudits (dim>2), this generalizes to: \(\(R_Z(\phi) = \sum_{k=0}^{d-1} e^{ik\phi} |k\rangle\langle k|\)\)
Attributes:
| Name | Type | Description |
|---|---|---|
phi |
ArrayLike
|
The rotation angle in radians. |
Source code in src/squint/interface/dv.py
RXGate
¶
Bases: AbstractGate
Rotation gate around the X-axis for qubits.
Implements the standard RX rotation: \(\(R_X(\phi) = \cos(\phi/2) I - i \sin(\phi/2) X = \begin{pmatrix} \cos(\phi/2) & -i\sin(\phi/2) \\ -i\sin(\phi/2) & \cos(\phi/2) \end{pmatrix}\)\)
Attributes:
| Name | Type | Description |
|---|---|---|
phi |
ArrayLike
|
The rotation angle in radians. |
Note
This gate is only defined for qubits (dim=2).
Source code in src/squint/interface/dv.py
RYGate
¶
Bases: AbstractGate
Rotation gate around the Y-axis for qubits.
Implements the standard RY rotation: \(\(R_Y(\phi) = \cos(\phi/2) I - i \sin(\phi/2) Y = \begin{pmatrix} \cos(\phi/2) & -\sin(\phi/2) \\ \sin(\phi/2) & \cos(\phi/2) \end{pmatrix}\)\)
Attributes:
| Name | Type | Description |
|---|---|---|
phi |
ArrayLike
|
The rotation angle in radians. |
Note
This gate is only defined for qubits (dim=2).
Source code in src/squint/interface/dv.py
TwoLocalHermitianBasisGate
¶
Bases: AbstractGate
Two-qubit/qudit gate generated by a tensor product of Gell-Mann basis operators.
Implements gates of the form: \(\(U(\theta) = \exp(-i \theta \cdot G_i \otimes G_j)\)\)
where \(G_i\) and \(G_j\) are Gell-Mann basis operators (generalized Pauli matrices) acting on the first and second wire respectively. For qubits (dim=2), the Gell-Mann operators reduce to the Pauli matrices.
This is the base class for specific two-qubit interaction gates like RXXGate and RZZGate.
Attributes:
| Name | Type | Description |
|---|---|---|
angles |
ArrayLike
|
The rotation angle(s) in radians. |
_basis_op_indices |
tuple[int, int]
|
Indices of the Gell-Mann basis operators to use on each wire. For dim=2: 0=Z, 1=Y, 2=X, 3=I. |
Example
Source code in src/squint/interface/dv.py
tensornetwork
¶
compiler
¶
MapTensorIndicesMixed
¶
Bases: ConversionRule, TensorNetworkBackend
Maps a symbolic circuit object to a string of input/output tensor leg indices
Source code in src/squint/backends/tensornetwork/compiler.py
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 113 114 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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
MapTensorIndicesPure
¶
Bases: ConversionRule, TensorNetworkBackend
Source code in src/squint/backends/tensornetwork/compiler.py
GeneratePureTensors
¶
Bases: ConversionRule, TensorNetworkBackend