Skip to content

Add a QuantumCumulants.jl extension for express - #216

Open
AJ0070 wants to merge 2 commits into
QuantumSavory:mainfrom
AJ0070:fix/73
Open

Add a QuantumCumulants.jl extension for express#216
AJ0070 wants to merge 2 commits into
QuantumSavory:mainfrom
AJ0070:fix/73

Conversation

@AJ0070

@AJ0070 AJ0070 commented Jul 29, 2026

Copy link
Copy Markdown

Closes #73.

Adds a QuantumCumulants.jl extension, so symbolic operators can be converted into the
second-quantized operators QuantumCumulants works with and fed to meanfield,
cumulant_expansion, etc.

h = FockSpace(:cavity)  NLevelSpace(:atom, (:g,:e))
repr = QuantumCumulantsRepr(h, [:a, ])

H = express*(n̂  Iₐ) + g*(âꜛ  σ₋ + â  σ₊), repr)   # Δ*a'*a + g*(a'*σ₁₂ + a*σ₂₁)
J = [express Iₐ, repr), express(Ic  σ₋, repr)]
eqs = complete(cumulant_expansion(meanfield([a'*a, σ(:e,:e)], H, J; rates=[κ, γ]), 2))

Changes

  • ext/QuantumCumulantsExt/QuantumCumulantsExt.jl (+251) — the conversion: Fock operators,
    qubit operators as Transitions on an NLevelSpace or Paulis on a PauliSpace,
    projectors/outer products (incl. qudits), identities, tensor products placed across
    subsystems, sums/products/scalings/commutators/daggers.
  • src/QSymbolicsBase/QSymbolicsBase.jl (+45 −1) — exports QuantumCumulantsRepr. The
    Hilbert space is given explicitly or derived from the expression's basis.
  • test/general/quantumcumulants_tests.jl (+200) — 75 tests.
  • docs/src/quantumcumulants.md (+123), docs/make.jl, docs/src/express.md — new docs page.
  • Project.toml + test/docs/benchmark manifests, CHANGELOG.md — weakdep, compat 0.7,
    version bump to 0.4.17.

Notes

  • Z₁ = |0⟩ maps to the excited level, so σ₋ becomes the decay operator σ^ge.
  • Both packages export Destroy, Create, dagger, commutator; the clash is documented,
    with the unicode aliases (â, âꜛ, ) as the escape hatch.
  • Unitaries, two-qubit gates, MixedState, conj/transpose and partial traces throw —
    none are expressible in a polynomial operator algebra.

AI Disclosure: I used Claude Opus 5 to initially understand the problem, code scaffolding, adding comments, documentation, and getting full test coverage.

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.28814% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.11%. Comparing base (35154cf) to head (229648b).

Files with missing lines Patch % Lines
ext/QuantumCumulantsExt/QuantumCumulantsExt.jl 87.38% 14 Missing ⚠️
src/QSymbolicsBase/QSymbolicsBase.jl 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #216      +/-   ##
==========================================
+ Coverage   68.89%   71.11%   +2.22%     
==========================================
  Files          21       22       +1     
  Lines         987     1101     +114     
==========================================
+ Hits          680      783     +103     
- Misses        307      318      +11     

☔ View full report in Codecov by Harness.
📢 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.

@AJ0070

AJ0070 commented Aug 2, 2026

Copy link
Copy Markdown
Author

@Krastanov gentle ping!

@AJ0070

AJ0070 commented Aug 17, 2026

Copy link
Copy Markdown
Author

@Krastanov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A backend for QuantumCumulants.jl [$200]

1 participant