Skip to content

Conversation

@H33T589
Copy link

@H33T589 H33T589 commented Oct 27, 2025

This PR introduces a new helper function _to_pauli_liouville_fht that uses the Fast Walsh–Hadamard Transform to convert a Liouville superoperator to its Pauli‑Liouville representation in O(N log N) time. The function applies the transform along rows and columns and optionally normalizes the result. No existing functionality is removed; the new helper can be called by existing conversion routines for improved performance.

Resolves or addresses issue #1632 (Fast conversion to and from Pauli basis). Adds 46 lines of code.

Comment on lines +2315 to +2327
def _fht(vec):
"""In-place 1D Fast Walsh–Hadamard Transform."""
n = len(vec)
h = 1
while h < n:
for i in range(0, n, h * 2):
for j in range(i, i + h):
a = vec[j]
b = vec[j + h]
vec[j] = a + b
vec[j + h] = a - b
h *= 2
return vec
Copy link
Contributor

@renatomello renatomello Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# Normalize if required (divide by sqrt of dimension)
if normalize:
import math
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not need to be outside toplevel

@renatomello renatomello added the run-workflow Forces github workflow execution label Oct 28, 2025
@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 4.34783% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.92%. Comparing base (61472bc) to head (4983b6c).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...qibo/quantum_info/superoperator_transformations.py 4.34% 22 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1736      +/-   ##
==========================================
- Coverage   99.09%   98.92%   -0.17%     
==========================================
  Files          80       80              
  Lines       13083    13106      +23     
==========================================
+ Hits        12964    12965       +1     
- Misses        119      141      +22     
Flag Coverage Δ
unittests 98.92% <4.34%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@renatomello renatomello linked an issue Oct 29, 2025 that may be closed by this pull request
@renatomello renatomello marked this pull request as draft December 4, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request run-workflow Forces github workflow execution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fast conversion to and from Pauli basis

2 participants