mindquantum.core.gates
Gate module that provides different quantum gate.
Base Class
BasicGate is the base class of all gates. |
|
Base class for non-parametric gates. |
|
Gate that is parameterized. |
|
Base class for quantum gates. |
|
Noise gate class. |
Quantum Gate
API Name |
Description |
Math |
Control-X gate. |
No formula yet. |
|
FSim gate represent fermionic simulation gate. |
\({\rm FSim}(\theta, \phi) =\begin{pmatrix}1 & 0 & 0 & 0\\0 & \cos(\theta) & -i\sin(\theta) & 0\\0 & -i\sin(\theta) & \cos(\theta) & 0\\0 & 0 & 0 & e^{-i\phi}\\\end{pmatrix}\) |
|
Global phase gate. |
\({\rm GlobalPhase}=\begin{pmatrix}\exp(-i\theta)&0\\0&\exp(-i\theta)\end{pmatrix}\) |
|
Hadamard gate. |
\({\rm H}=\frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}\) |
|
Identity gate. |
\({\rm I}=\begin{pmatrix}1&0\\0&1\end{pmatrix}\) |
|
ISWAP gate. |
No formula yet. |
|
Measurement gate that measure quantum qubits. |
No formula yet. |
|
Phase shift gate. |
\({\rm PhaseShift}=\begin{pmatrix}1&0\\0&\exp(i\theta)\end{pmatrix}\) |
|
Pauli rotate about a arbitrary axis in bloch sphere. |
\(\begin{aligned}{\rm Rn}(\alpha, \beta, \gamma)&= e^{-i(\alpha \sigma_x + \beta \sigma_y + \gamma \sigma_z)/2}\\&= \cos(f/2)I-i\sin(f/2)(\alpha \sigma_x + \beta \sigma_y + \gamma \sigma_z)/f\\&\text{where } f=\sqrt{\alpha^2 + \beta^2 + \gamma^2}\end{aligned}\) |
|
Rotation gate around x-axis. |
\({\rm RX}=\begin{pmatrix}\cos(\theta/2)&-i\sin(\theta/2)\\-i\sin(\theta/2)&\cos(\theta/2)\end{pmatrix}\) |
|
Rxx gate. |
\(Rxx(\theta) = \exp{\left(-i\frac{\theta}{2} X\otimes X\right)} =\begin{pmatrix}\cos{\frac{\theta}{2}} & 0 & 0 & -i\sin{\frac{\theta}{2}}\\0 & \cos{\frac{\theta}{2}} & -i\sin{\frac{\theta}{2}} & 0\\0 & -i\sin{\frac{\theta}{2}} & \cos{\frac{\theta}{2}} & 0\\-i\sin{\frac{\theta}{2}} & 0 & 0 & \cos{\frac{\theta}{2}}\\\end{pmatrix}\) |
|
Rxy gate. |
\(Rxy(\theta) = \exp{\left(-i\frac{\theta}{2} Y\otimes X\right)} =\begin{pmatrix}\cos{\frac{\theta}{2}} & 0 & 0 & -\sin{\frac{\theta}{2}}\\0 & \cos{\frac{\theta}{2}} & -\sin{\frac{\theta}{2}} & 0\\0 & \sin{\frac{\theta}{2}} & \cos{\frac{\theta}{2}} & 0\\\sin{\frac{\theta}{2}} & 0 & 0 & \cos{\frac{\theta}{2}}\\\end{pmatrix}\) |
|
Rxz gate. |
\(Rxz(\theta) = \exp{\left(-i\frac{\theta}{2} Z\otimes X\right)} =\begin{pmatrix}\cos{\frac{\theta}{2}} & -i\sin{\frac{\theta}{2}} & 0 & 0\\-i\sin{\frac{\theta}{2}} & \cos{\frac{\theta}{2}} & 0 & 0\\0 & 0 & \cos{\frac{\theta}{2}} & i\sin{\frac{\theta}{2}}\\0 & 0 & i\sin{\frac{\theta}{2}} & \cos{\frac{\theta}{2}}\\\end{pmatrix}\) |
|
Rotation gate around y-axis. |
\({\rm RY}=\begin{pmatrix}\cos(\theta/2)&-\sin(\theta/2)\\\sin(\theta/2)&\cos(\theta/2)\end{pmatrix}\) |
|
Ryy gate. |
\(Ryy(\theta) = \exp{\left(-i\frac{\theta}{2} Y\otimes Y\right)} =\begin{pmatrix}\cos{\frac{\theta}{2}} & 0 & 0 & i\sin{\frac{\theta}{2}}\\0 & \cos{\frac{\theta}{2}} & -i\sin{\frac{\theta}{2}} & 0\\0 & -i\sin{\frac{\theta}{2}} & \cos{\frac{\theta}{2}} & 0\\i\sin{\frac{\theta}{2}} & 0 & 0 & \cos{\frac{\theta}{2}}\\\end{pmatrix}\) |
|
Ryz gate. |
\(Ryz(\theta) = \exp{\left(-i\frac{\theta}{2} Z\otimes Y\right)} =\begin{pmatrix}\cos{\frac{\theta}{2}} & -\sin{\frac{\theta}{2}} & 0 & 0\\\sin{\frac{\theta}{2}} & \cos{\frac{\theta}{2}} & 0 & 0\\0 & 0 & \cos{\frac{\theta}{2}} & \sin{\frac{\theta}{2}}\\0 & 0 & -\sin{\frac{\theta}{2}} & \cos{\frac{\theta}{2}}\\\end{pmatrix}\) |
|
Rotation gate around z-axis. |
\({\rm RZ}=\begin{pmatrix}\exp(-i\theta/2)&0\\0&\exp(i\theta/2)\end{pmatrix}\) |
|
Rzz gate. |
\(Rzz(\theta) = \exp{\left(-i\frac{\theta}{2} Z\otimes Z\right)} =\begin{pmatrix}e^{-i\frac{\theta}{2}} & 0 & 0 & 0\\0 & e^{i\frac{\theta}{2}} & 0 & 0\\0 & 0 & e^{i\frac{\theta}{2}} & 0\\0 & 0 & 0 & e^{-i\frac{\theta}{2}}\\\end{pmatrix}\) |
|
Arbitrary pauli string rotation. |
\(U(\theta)=e^{-i\theta P/2}, P=\otimes_i\sigma_i, \text{where } \sigma \in \{X, Y, Z\}\) |
|
S gate. |
\({\rm S}=\begin{pmatrix}1&0\\0&i\end{pmatrix}\) |
|
SWAP gate that swap two different qubits. |
No formula yet. |
|
SWAP alpha gate. |
\(\text{SWAP}(\alpha) =\begin{pmatrix}1 & 0 & 0 & 0\\0 & \frac{1}{2}\left(1+e^{i\pi\alpha}\right) & \frac{1}{2}\left(1-e^{i\pi\alpha}\right) & 0\\0 & \frac{1}{2}\left(1-e^{i\pi\alpha}\right) & \frac{1}{2}\left(1+e^{i\pi\alpha}\right) & 0\\0 & 0 & 0 & 1\\\end{pmatrix}\) |
|
Sqrt X (SX) gate. |
\({\rm SX}=\frac{1}{2}\begin{pmatrix}1+i&1-i\\1-i&1+i\end{pmatrix}\) |
|
T gate. |
\({\rm T}=\begin{pmatrix}1&0\\0&(1+i)/\sqrt(2)\end{pmatrix}\) |
|
U3 gate represent arbitrary single qubit gate. |
\({\rm U3}(\theta, \phi, \lambda) =\begin{pmatrix}\cos(\theta/2)&-e^{i\lambda}\sin(\theta/2)\\e^{i\phi}\sin(\theta/2)&e^{i(\phi+\lambda)}\cos(\theta/2)\end{pmatrix}\) |
|
Pauli-X gate. |
\({\rm X}=\begin{pmatrix}0&1\\1&0\end{pmatrix}\) |
|
Pauli Y gate. |
\({\rm Y}=\begin{pmatrix}0&-i\\i&0\end{pmatrix}\) |
|
Pauli-Z gate. |
\({\rm Z}=\begin{pmatrix}1&0\\0&-1\end{pmatrix}\) |
|
Multi qubit pauli string gate. |
\(U =\otimes_i\sigma_i, \text{where } \sigma \in \{I, X, Y, Z\}\) |
|
Givens rotation gate. |
\({\rm G}(\theta)=\exp{\left(-i\frac{\theta}{2} (Y\otimes X - X\otimes Y)\right)} =\begin{pmatrix}1 & 0 & 0 & 0\\0 & \cos{\theta} & -\sin{\theta} & 0\\0 & \sin{\theta} & \cos{\theta} & 0\\0 & 0 & 0 & 1\\\end{pmatrix}\) |
Functional Gate
Universal math gate. |
|
Generate a customer parameterized gate based on the single parameter defined unitary matrix. |
|
Barrier gate will separate two gate in two different layer. |
pre-instantiated gate
The gates blow are the pre-instantiated quantum gates, which can be used directly as an instance of quantum gate.
pre-instantiated gate |
gate |
---|---|
mindquantum.core.gates.CNOT |
|
mindquantum.core.gates.I |
|
mindquantum.core.gates.ISWAP |
|
mindquantum.core.gates.H |
|
mindquantum.core.gates.S |
|
mindquantum.core.gates.SWAP |
|
mindquantum.core.gates.SX |
|
mindquantum.core.gates.T |
|
mindquantum.core.gates.X |
|
mindquantum.core.gates.Y |
|
mindquantum.core.gates.Z |
Quantum Channel
API Name |
Description |
Math |
Amplitude damping channel express error that qubit is affected by the energy dissipation. |
\(\begin{gather*}\epsilon(\rho) = E_0 \rho E_0^\dagger + E_1 \rho E_1^\dagger\\\text{where}\ {E_0}=\begin{bmatrix}1&0\\0&\sqrt{1-\gamma}\end{bmatrix},\ {E_1}=\begin{bmatrix}0&\sqrt{\gamma}\\0&0\end{bmatrix}\end{gather*}\) |
|
A bit flip channel. |
\(\epsilon(\rho) = (1 - P)\rho + P X \rho X\) |
|
A bit&phase flip channel. |
\(\epsilon(\rho) = (1 - P)\rho + P Y \rho Y\) |
|
A depolarizing channel. |
\(\epsilon(\rho) = (1 - P)\rho + P/4( I \rho I + X \rho X + Y \rho Y + Z \rho Z)\) |
|
A kraus channel. |
\(\epsilon(\rho) = \sum_{k=0}^{m-1} E_k \rho E_k^\dagger\) |
|
A pauli channel. |
\(\epsilon(\rho) = (1 - P_x - P_y - P_z)\rho + P_x X \rho X + P_y Y \rho Y + P_z Z \rho Z\) |
|
A group of pauli channels. |
\(\epsilon(\rho) = \otimes_i \epsilon_\text{pauli}^i(\rho)\) |
|
A phase damping channel. |
\(\begin{gather*}\epsilon(\rho) = E_0 \rho E_0^\dagger + E_1 \rho E_1^\dagger\\\text{where}\ {E_0}=\begin{bmatrix}1&0\\0&\sqrt{1-\gamma}\end{bmatrix},\ {E_1}=\begin{bmatrix}0&0\\0&\sqrt{\gamma}\end{bmatrix}\end{gather*}\) |
|
A phase flip channel. |
\(\epsilon(\rho) = (1 - P)\rho + P Z \rho Z\) |
|
Thermal relaxation channel. |
\(\begin{gather*}\epsilon(\rho) = \text{tr}_1 \left[ \Lambda \left( \rho^T \otimes I \right) \right],\Lambda=\begin{pmatrix}\epsilon_{T_1} & 0 & 0 & \epsilon_{T_2} \\0 & 1-\epsilon_{T_1} & 0 & 0 \\0 & 0 & 0 & 0 \\\epsilon_{T_2} & 0 & 0 & 1\end{pmatrix}\\\text{where}\ \epsilon_{T_1}=e^{-T_g/T_1}, \epsilon_{T_2}=e^{-T_g/T_2}\end{gather*}\) |
Functional Class
Measurement result container. |
|
Power operator on a non parameterized gate. |