shiavm006 opened a new pull request, #627: URL: https://github.com/apache/mahout/pull/627
### Purpose of PR Add comprehensive qubit index validation to all gate methods in the QuMat frontend layer, preventing cryptic backend-specific errors and improving developer experience with clear, actionable error messages. ### Related Issues or PRs Fixes #624 ### Changes Made - [x] Bug fix - [ ] New feature - [ ] Refactoring - [ ] Documentation - [ ] Test - [ ] CI/CD pipeline - [ ] Other ### Description Added `_validate_qubit_index()` helper method that validates: - Type checking (must be integer) - Range validation (non-negative) - Bounds checking (within 0 to num_qubits-1) Integrated validation into all 13 gate application methods: - Single-qubit gates (9): `apply_hadamard_gate`, `apply_not_gate`, `apply_pauli_x_gate`, `apply_pauli_y_gate`, `apply_pauli_z_gate`, `apply_rx_gate`, `apply_ry_gate`, `apply_rz_gate`, `apply_u_gate` - Two-qubit gates (3): `apply_cnot_gate`, `apply_swap_gate`, plus multi-index `apply_cswap_gate` - Three-qubit gates (1): `apply_toffoli_gate` ### Breaking Changes - [ ] Yes - [x] No ### Checklist - [x] Added or updated unit tests for all changes - [x] Added or updated documentation for all changes - [x] 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
