JiangJiaWei1103 commented on code in PR #724:
URL: https://github.com/apache/mahout/pull/724#discussion_r2616005630


##########
docs/api.md:
##########
@@ -112,3 +139,19 @@
 - **Parameters**:
     - `param_name` (str): The name of the parameter to handle.
 - **Usage**: Automatically invoked when applying parameterized gates to keep 
track of parameters efficiently.
+
+## `swap_test(self, ancilla_qubit, qubit1, qubit2)`
+- **Purpose**: Builds the swap-test subcircuit (H–CSWAP–H) to compare two 
quantum states.
+- **Parameters**:
+    - `ancilla_qubit` (int): Index of the ancilla control qubit.
+    - `qubit1` (int): Index of the first state qubit.
+    - `qubit2` (int): Index of the second state qubit.
+- **Usage**: Used in overlap/fidelity estimation between two states.
+
+## `measure_overlap(self, qubit1, qubit2, ancilla_qubit=0)`
+- **Purpose**: Executes the swap test and returns |⟨ψ|φ⟩|² using 
backend-specific measurement parsing.
+- **Parameters**:
+    - `qubit1` (int): Index of the first state qubit.
+    - `qubit2` (int): Index of the second state qubit.
+    - `ancilla_qubit` (int, optional): Index of the ancilla qubit; defaults to 
0.

Review Comment:
   ```suggestion
       - `ancilla_qubit` (int, default to 0): Index of the ancilla qubit.
   ```
   
   nit: Slightly different from idiomatic usage of specifying "optional" for 
default to `None`.



##########
docs/api.md:
##########
@@ -64,10 +72,20 @@
     - `qubit_index` (int): Index of the qubit.
 - **Usage**: Alters the phase of a qubit without changing its amplitude.
 
+## `apply_t_gate(self, qubit_index)`
+- **Purpose**: Applies the T (π/8) phase gate to a specified qubit.
+- **Parameters**:
+    - `qubit_index` (int): Index of the qubit.
+- **Usage**: Adds a π/4 phase to |1⟩; with H and CNOT it enables universal 
single-qubit control.

Review Comment:
   ```suggestion
   - **Usage**: Adds a π/4 phase to |1⟩. Together with the Hadamard (H) and 
CNOT gates, it enables universal single-qubit control.
   ```
   
   nit: Make the usage description clearer.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to