[ 
https://issues.apache.org/jira/browse/MAHOUT-607?focusedWorklogId=991851&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-991851
 ]

ASF GitHub Bot logged work on MAHOUT-607:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/Nov/25 17:02
            Start Date: 15/Nov/25 17:02
    Worklog Time Spent: 10m 
      Work Description: rich7420 commented on code in PR #630:
URL: https://github.com/apache/mahout/pull/630#discussion_r2530012706


##########
docs/basic_gates.md:
##########
@@ -46,10 +46,55 @@ The T-Gate applies a **π/4 phase shift** to the qubit. It 
is essential for quan
 \[ T|0⟩ = |0⟩ \]
 \[ T|1⟩ = e^{i\pi/4} |1⟩ \]
 
+## CSWAP Gate (Controlled-SWAP / Fredkin Gate)
+The CSWAP gate, also known as the **Fredkin gate**, is a three-qubit gate that 
conditionally swaps the states of two target qubits based on the state of a 
control qubit. If the control qubit is in the |1⟩ state, it swaps the states of 
the two target qubits; otherwise, it leaves them unchanged.
+
+### Mathematical Definition
+
+The CSWAP gate acts on three qubits: a control qubit |c⟩ and two target qubits 
|t₁⟩ and |t₂⟩. The operation is:
+
+\[ \text{CSWAP}|c\rangle|t_1\rangle|t_2\rangle = \begin{cases} 
|c\rangle|t_1\rangle|t_2\rangle & \text{if } c = 0 \\ 
|c\rangle|t_2\rangle|t_1\rangle & \text{if } c = 1 \end{cases} \]
+
+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} \]
+
+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⟩ states in the system (conserves the 
Hamming weight).
+
+## U Gate (Universal Single-Qubit Gate)
+The U gate is a **universal single-qubit gate** parameterized by three angles 
(θ, φ, λ) that can represent any single-qubit unitary operation. It provides a 
complete parameterization of single-qubit rotations and is essential for 
implementing arbitrary quantum operations.
+
+### Mathematical Definition
+
+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} \]
+
+The U gate can be decomposed into rotations around the Z, Y, and Z axes:
+
+\[ U(\theta, \phi, \lambda) = R_z(\phi) \cdot R_y(\theta) \cdot R_z(\lambda) \]
+
+This decomposition shows that the U gate applies:
+1. A rotation by λ around the Z-axis
+2. A rotation by θ around the Y-axis
+3. A rotation by φ around the Z-axis
+
+### Special Cases
+
+- **Identity**: U(0, 0, 0) = I
+- **Pauli X**: U(π, 0, π) = X
+- **Pauli Y**: U(π, π/2, π/2) = Y
+- **Pauli Z**: U(0, π, 0) = Z

Review Comment:
   oh ok, my mistake. 





Issue Time Tracking
-------------------

    Worklog Id:     (was: 991851)
    Time Spent: 1h 10m  (was: 1h)

> Count used and neglected elements in MaybePruneRowsMapper
> ---------------------------------------------------------
>
>                 Key: MAHOUT-607
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-607
>             Project: Mahout
>          Issue Type: Improvement
>    Affects Versions: 0.4
>            Reporter: Sebastian Schelter
>            Assignee: Sean R. Owen
>            Priority: Minor
>             Fix For: 0.5
>
>         Attachments: MAHOUT-607.patch
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> MaybePruneRowsMapper is used to prune the overall number of 
> preferences/ratings our distributed recommender looks at. The patch adds 
> counters to the code so we can see the number of used and neglected 
> preferences in the jobtracker.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to