This is an automated email from the ASF dual-hosted git repository.
jiekaichang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git
The following commit(s) were added to refs/heads/main by this push:
new 713ceff41 docs(basic-gates.md): fix broken LaTeX math in GitHub
Markdown (#1127)
713ceff41 is described below
commit 713ceff412622c1b6c7f1c34dc6236709c6b1bc1
Author: Tim Hsiung <[email protected]>
AuthorDate: Fri Mar 6 17:46:01 2026 +0800
docs(basic-gates.md): fix broken LaTeX math in GitHub Markdown (#1127)
---
docs/qumat/basic-gates.md | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/docs/qumat/basic-gates.md b/docs/qumat/basic-gates.md
index 803e36370..b39aa4760 100644
--- a/docs/qumat/basic-gates.md
+++ b/docs/qumat/basic-gates.md
@@ -56,7 +56,19 @@ $$\text{CSWAP}|c\rangle|t_1\rangle|t_2\rangle =
\begin{cases} |c\rangle|t_1\rang
In matrix form (for the 8-dimensional space of three qubits), the CSWAP gate
is:
-$$\text{CSWAP} = \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 &
0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0
& 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0
& 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \end{pmatrix}$$
+$$
+\text{CSWAP} =
+\begin{pmatrix}
+1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
+0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
+0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
+0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
+0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
+0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\
+0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
+0 & 0 & 0 & 0 & 0 & 0 & 0 & 1
+\end{pmatrix}
+$$
The CSWAP gate is fundamental in quantum algorithms such as the swap test,
quantum error correction, and quantum state comparison. The CSWAP gate is
reversible and preserves the number of $|1\rangle$ states in the system
(conserves the Hamming weight).
@@ -67,7 +79,13 @@ The U gate is a **universal single-qubit gate**
parameterized by three angles ($
The U gate matrix representation is:
-$$U(\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}$$
+$$
+U(\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}
+$$
The U gate can be decomposed into rotations around the Z, Y, and Z axes: