[
https://issues.apache.org/jira/browse/MAHOUT-625?focusedWorklogId=991549&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-991549
]
ASF GitHub Bot logged work on MAHOUT-625:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 13/Nov/25 16:52
Start Date: 13/Nov/25 16:52
Worklog Time Spent: 10m
Work Description: guan404ming commented on code in PR #626:
URL: https://github.com/apache/mahout/pull/626#discussion_r2524213504
##########
testing/test_single_qubit_gates.py:
##########
@@ -386,6 +417,67 @@ def test_u_gate_operations(
f"Expected ~0.5 probability for |1⟩ after
U({theta},{phi},{lambd}), "
f"got {prob_one}"
)
+ elif expected_behavior == "superposition":
+ # Should create a superposition (not all probability in one state)
+ prob_zero, prob_one = get_superposition_probabilities(results,
num_qubits=1)
+ # At least one state should have significant probability (> 0.1)
+ # and not all probability should be in one state (< 0.9)
+ assert (
+ prob_zero > 0.1 or prob_one > 0.1
+ ), f"Expected superposition after U({theta},{phi},{lambd}), got
prob_zero={prob_zero:.4f}, prob_one={prob_one:.4f}"
+ assert (
+ prob_zero < 0.9 and prob_one < 0.9
+ ), f"Expected superposition after U({theta},{phi},{lambd}), got
prob_zero={prob_zero:.4f}, prob_one={prob_one:.4f}"
+
+
+def test_u_gate_cross_backend_consistency():
+ """Test that U gate produces consistent results across all backends."""
+ # Test cases with non-zero phi to detect decomposition errors
+ test_cases = [
Review Comment:
Let's make them parameterized~
Issue Time Tracking
-------------------
Worklog Id: (was: 991549)
Remaining Estimate: 0h
Time Spent: 10m
> Some of generated patterns have support higher than in reality
> --------------------------------------------------------------
>
> Key: MAHOUT-625
> URL: https://issues.apache.org/jira/browse/MAHOUT-625
> Project: Mahout
> Issue Type: Bug
> Affects Versions: 0.4
> Reporter: Jaroslaw Odzga
> Assignee: Robin Anil
> Priority: Major
> Fix For: 0.5
>
> Attachments: FPGrowth.java, MAHOUT-625-patch.txt, bugfix-patch.txt,
> dataset_ok.txt, final_patch_with_bug_fix_test_and_the_dataset.txt,
> mahout-test.zip
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> It turnes out that some of generated patterns have incorrect support. The
> returned support is slightly higher than the true one.
> I attached the test, which proves that FPGrowth has a bug. Test is using data
> (retail) found here: http://fimi.ua.ac.be/data/
> The pattern (36, 39, 41) occurs in the transactions 572 times (this is also
> calculated in test), but the FPGrowth returns pattern (36, 39, 41) with
> support 573.
> Please note that mentioned pattern is not the only one with incorrect support
> - the test only point out one example to hace something to focus on. There is
> plenty more patterns with support higher than the real one. The biggest
> difference I noticed was support 8 higher than the real one for one of
> patterns.
> Please find attached failing unit test - it's actually a maven project, which
> contains test data and is ready to run.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)