[
https://issues.apache.org/jira/browse/MAHOUT-681?focusedWorklogId=995102&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-995102
]
ASF GitHub Bot logged work on MAHOUT-681:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Dec/25 04:51
Start Date: 08/Dec/25 04:51
Worklog Time Spent: 10m
Work Description: Copilot commented on code in PR #693:
URL: https://github.com/apache/mahout/pull/693#discussion_r2597029402
##########
qumat/qumat.py:
##########
@@ -251,6 +251,20 @@ def apply_pauli_z_gate(self, qubit_index):
self._validate_qubit_index(qubit_index)
self.backend_module.apply_pauli_z_gate(self.circuit, qubit_index)
+ def apply_t_gate(self, qubit_index):
+ """Apply a T-gate (π/8 gate) to the specified qubit.
+
+ Applies a π/4 phase shift to the qubit. Essential for universal
+ quantum computation when combined with Hadamard and CNOT gates.
Review Comment:
The docstring incorrectly states "Applies a π/4 phase shift" but the T-gate
actually applies a π/4 phase to the |1⟩ state, not a π/4 phase shift to the
overall state. More accurately, the T-gate can be described as applying a
relative phase of π/4 or introducing a phase of e^(iπ/4) = e^(i45°) to the |1⟩
state. The phase shift terminology is potentially misleading.
```suggestion
Applies a relative phase of π/4 (i.e., multiplies the |1⟩ state by
e^(iπ/4)).
Essential for universal quantum computation when combined with
Hadamard and CNOT gates.
```
##########
qumat/qumat.py:
##########
@@ -251,6 +251,20 @@ def apply_pauli_z_gate(self, qubit_index):
self._validate_qubit_index(qubit_index)
self.backend_module.apply_pauli_z_gate(self.circuit, qubit_index)
+ def apply_t_gate(self, qubit_index):
+ """Apply a T-gate (π/8 gate) to the specified qubit.
+
+ Applies a π/4 phase shift to the qubit. Essential for universal
+ quantum computation when combined with Hadamard and CNOT gates.
+
+ :param qubit_index: Index of the qubit.
+ :type qubit_index: int
+ :raises RuntimeError: If the circuit has not been initialized.
+ """
+ self._ensure_circuit_initialized()
+ self._validate_qubit_index(qubit_index)
+ self.backend_module.apply_t_gate(self.circuit, qubit_index)
Review Comment:
The newly added `apply_t_gate` method lacks test coverage. The test file
`testing/test_single_qubit_gates.py` has comprehensive test classes for all
other single-qubit gates (TestPauliXGate, TestPauliYGate, TestPauliZGate,
TestHadamardGate, TestNOTGate, TestUGate), but no `TestTGate` class exists.
Consider adding a test class similar to the existing ones that verifies:
1. T-gate state transitions (e.g., T|0⟩ = |0⟩, T|1⟩ applies phase)
2. T-gate phase accumulation (T^8 = I)
3. Cross-backend consistency
4. Combination with Hadamard to verify phase effect
Issue Time Tracking
-------------------
Worklog Id: (was: 995102)
Time Spent: 0.5h (was: 20m)
> Remove AsymmetricSampledNormal, SampledNormal, L1, Normal Models and
> Distributions
> ----------------------------------------------------------------------------------
>
> Key: MAHOUT-681
> URL: https://issues.apache.org/jira/browse/MAHOUT-681
> Project: Mahout
> Issue Type: Improvement
> Components: classic
> Affects Versions: 0.4
> Reporter: Sean R. Owen
> Assignee: Jeff Eastman
> Priority: Minor
> Fix For: 0.5
>
> Attachments: MAHOUT-681.patch
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> As discussed on the mailing list, it looks like these classes are deprecated,
> and actually unused outside of tests. Here's my proposal to remove them.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)