You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by "tingyu-patrick (via GitHub)" <gi...@apache.org> on 2026/10/18 16:27:14 UTC

[PR] [Feature] Add S gate to QuMat [mahout]

tingyu-patrick opened a new pull request, #1540:
URL: https://github.com/apache/mahout/pull/1540

   ### Related Issues
   Part of #1511
   
   ### Changes
   
   - [ ] Bug fix
   - [x] New feature
   - [ ] Refactoring
   - [x] Documentation
   - [x] Test
   - [ ] CI/CD pipeline
   - [ ] Other
   
   ### Why
   
   `QuMat` currently has no S gate (phase of π/2), which is common in textbook circuits and standard transpilation targets. Users have to drop down to the underlying SDK to use it. This PR adds the S gate as one of the gates tracked in #1511 (one gate per PR, as requested there).
   
   ### How
   
   - Added `QuMat.apply_s_gate` in `qumat/qumat.py`, following the pattern of `apply_t_gate`.
   - Implemented it in all three backends: Qiskit, Cirq and Amazon Braket.
   - Added tests in `testing/qumat/test_single_qubit_gates.py` that run on all backends: basis-state preservation, S² = Z, S⁴ = I (each H-sandwiched so the phase becomes measurable), and a sign check (H-S-T-T-H ends in |1⟩, which would fail if the gate were S† instead of S).
   - Added an S-Gate section and an Updates entry to `docs/qumat/basic-gates.md`.
   
   All tests in `testing/qumat/` pass locally on all backends, and ruff passes. The ty and Rust pre-commit hooks could not run in my Windows environment (`uv` and `cargo` were not found by the hooks), so I am relying on CI for those.
   
   AI assistance: I used Claude to help draft the tests and docs. I reviewed and ran all of it and can explain every change.
   
   ## Checklist
   
   - [x] Added or updated unit tests for all changes
   - [x] Added or updated documentation for all 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: commits-unsubscribe@mahout.apache.org

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


Re: [PR] [Feature] Add S gate to QuMat [mahout]

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

   Hi @400Ping , sorry to bother you. When you have some free time, could you please take a look at this PR? Any feedback would be greatly appreciated!


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

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