You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "shiavm006 (via GitHub)" <gi...@apache.org> on 2025/12/12 10:50:49 UTC

[PR] MAHOUT-682 : add missing QuMat APIs [mahout]

shiavm006 opened a new pull request, #724:
URL: https://github.com/apache/mahout/pull/724

   ### Purpose of PR
   document missing QuMat APIs: `apply_cswap_gate`, `apply_t_gate`, `get_final_state_vector`, `apply_u_gate`, `swap_test`, `measure_overlap`; align API docs with currently implemented methods in `qumat.QuMat`
   
   ### Related Issues or PRs
   Closes #682
   
   ### Changes Made
   <!-- Please mark one with an "x"   -->
   - [ ] Bug fix
   - [ ] New feature
   - [ ] Refactoring
   - [x] Documentation
   - [ ] Test
   - [ ] CI/CD pipeline
   - [ ] Other
   
   ### Breaking Changes
   <!-- Does this PR introduce a breaking change? -->
   - [ ] Yes
   - [x] No
   
   ### Checklist
   <!-- Please mark each item with an "x" when complete -->
   <!-- If not all items are complete, please open this as a **Draft PR**.
   Once all requirements are met, mark as ready for review. -->
   
   - [ ] Added or updated unit tests for all changes
   - [x] Added or updated documentation for all changes
   - [ ] Successfully built and ran all unit tests or manual tests locally
   - [ ] PR title follows "MAHOUT-XXX: Brief Description" format (if related to an issue)
   - [x] Code follows ASF guidelines
   


-- 
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: dev-unsubscribe@mahout.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MAHOUT-682 : add missing QuMat APIs [mahout]

Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming commented on PR #724:
URL: https://github.com/apache/mahout/pull/724#issuecomment-3659563716

   Thanks!


-- 
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: dev-unsubscribe@mahout.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MAHOUT-682 : add missing QuMat APIs [mahout]

Posted by "shiavm006 (via GitHub)" <gi...@apache.org>.
shiavm006 commented on code in PR #724:
URL: https://github.com/apache/mahout/pull/724#discussion_r2616246232


##########
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:
   good catch ! will make the changes 



-- 
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: dev-unsubscribe@mahout.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MAHOUT-682 : add missing QuMat APIs [mahout]

Posted by "JiangJiaWei1103 (via GitHub)" <gi...@apache.org>.
JiangJiaWei1103 commented on code in PR #724:
URL: https://github.com/apache/mahout/pull/724#discussion_r2616298460


##########
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⟩. Together with the Hadamard (H) and CNOT gates, it enables universal single-qubit control.
+
 ## `execute_circuit(self)`
 - **Purpose**: Executes the quantum circuit and retrieves the results.
 - **Usage**: Used to run the entire set of quantum operations and measure the outcomes.
 
+## `get_final_state_vector(self)`
+- **Purpose**: Returns the final state vector of the circuit from the configured backend.
+- **Usage**: Retrieve the full quantum state for simulation and analysis workflows.

Review Comment:
   ```suggestion
   - **Usage**: Retrieves the full quantum state for simulation and analysis workflows.
   ```
   
   nit: Just align with other statements if you don't mind. Thanks!



-- 
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: dev-unsubscribe@mahout.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MAHOUT-682 : add missing QuMat APIs [mahout]

Posted by "JiangJiaWei1103 (via GitHub)" <gi...@apache.org>.
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: dev-unsubscribe@mahout.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MAHOUT-682 : add missing QuMat APIs [mahout]

Posted by "guan404ming (via GitHub)" <gi...@apache.org>.
guan404ming merged PR #724:
URL: https://github.com/apache/mahout/pull/724


-- 
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: dev-unsubscribe@mahout.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org