Skip to content

CollectiveTransiton implementation#211

Merged
ChristophHotter merged 12 commits into
mainfrom
CollectiveTransition_v2
Jul 16, 2026
Merged

CollectiveTransiton implementation#211
ChristophHotter merged 12 commits into
mainfrom
CollectiveTransition_v2

Conversation

@ChristophHotter

Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Benchmark Results

Details
Benchmark suite Current: f11b699 Previous: e7e7648 Ratio
Accumulation/Many-mode H/foldl M=16 10671 ns 10980 ns 0.97
Accumulation/Many-mode H/foldl M=24 23163 ns 24876 ns 0.93
Accumulation/Many-mode H/foldl M=8 2719.5555555555557 ns 2800.777777777778 ns 0.97
Accumulation/Many-mode H/sum M=16 1639.1 ns 1697.1 ns 0.97
Accumulation/Many-mode H/sum M=24 2260.8888888888887 ns 2305.4444444444443 ns 0.98
Accumulation/Many-mode H/sum M=8 706.1102941176471 ns 729.7297297297297 ns 0.97
Accumulation/Same-site/foldl 6342 ns 6275.6 ns 1.01
Accumulation/Same-site/sum 2287.6666666666665 ns 2295.3333333333335 ns 1.00
Commutator/Nested JC/depth=1 1677.2 ns 1705.1 ns 0.98
Commutator/Nested JC/depth=2 18114 ns 17583 ns 1.03
Commutator/Nested JC/depth=3 67427 ns 66503 ns 1.01
Commutator/Nested JC/depth=4 169008 ns 168372 ns 1.00
Commutator/Nested JC/depth=5 372422 ns 372361 ns 1.00
Commutator/Schrieffer-Wolff/[S, V] 195909 ns 198388 ns 0.99
Commutator/Schrieffer-Wolff/[S, [S, H0]] 361582 ns 367321 ns 0.98
Indexing/Diagonal collapse/[H_Dicke, S_j] 41959 ns 44253 ns 0.95
Indexing/Diagonal collapse/[H_JC, σ_j] 60214 ns 63227 ns 0.95
Indexing/Simplify/double-sum spin-spin 16000 ns 16551 ns 0.97
Indexing/Simplify/indexed JC H 1200.3 ns 1169.1 ns 1.03
Indexing/Sum construction/double Σ_ij(J_ij*S_i*S_j) 7980 ns 8766 ns 0.91
Indexing/Sum construction/single Σ_i(σ_i*σ_j) 10219 ns 10669 ns 0.96
Normal Order/Fock (c*c')^n/n=2 608.7865168539325 ns 611.7403314917127 ns 1.00
Normal Order/Fock (c*c')^n/n=3 877.290909090909 ns 892.1754385964912 ns 0.98
Normal Order/Fock (c*c')^n/n=4 1178.2 ns 1183.2 ns 1.00
Normal Order/Fock (c*c')^n/n=5 1562 ns 1565.9 ns 1.00
Normal Order/Ground state/3-level rewrite 826.0298507462686 ns 809.5487804878048 ns 1.02
Normal Order/Multi-mode/2-mode 6-op chain 967.5714285714286 ns 964.421052631579 ns 1.00
Simplify/Jaynes-Cummings/H 1082 ns 1050 ns 1.03
Simplify/Jaynes-Cummings/H² 2421.1111111111113 ns 2412.3333333333335 ns 1.00
Simplify/Two cavities/H 1129.1 ns 1103 ns 1.02
Simplify/Two cavities/H² 4399.714285714285 ns 4495.428571428572 ns 0.98
Simplify/Λ-system/H 1370.6 ns 1352.5 ns 1.01
Simplify/Λ-system/H² 2341.1111111111113 ns 2276.4444444444443 ns 1.03

This comment was automatically generated by workflow using github-action-benchmark.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.87179% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.53%. Comparing base (e7e7648) to head (f11b699).

Files with missing lines Patch % Lines
src/operators/nlevel.jl 91.17% 3 Missing ⚠️
src/operators/operators.jl 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #211      +/-   ##
==========================================
+ Coverage   94.51%   94.53%   +0.01%     
==========================================
  Files          27       27              
  Lines        2937     3001      +64     
==========================================
+ Hits         2776     2837      +61     
- Misses        161      164       +3     

☔ 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.

@ChristophHotter
ChristophHotter requested a review from oameye July 15, 2026 20:56
Comment thread docs/src/examples/dicke_superradiance.md Outdated
Comment thread src/algebra/passes.jl
if cmp === Equal && !_can_commute(a, b)
sw_b, sw_a, residual_coeff, residual_ops = _commute_pair(a, b)
sw_b, sw_a, residual_coeff, residual_ops, residual2_coeff, residual2_ops =
_commute_pair(a, b)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pre-exisiting bug:
commutator(Spin(hs,:A,1), Spin(hs,:B,2)) on one SpinSpace returns im*Bz via the fast path, while simplify(A*B − B*A) returns 0 (the pipeline treats different-named spins as commuting).

Comment thread src/algebra/passes.jl
insert!(residual2, i + k - 1, op)
end
_commute_ops_at(sink, residual2, new_c2, max(i - 1, 1))
end

@oameye oameye Jul 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

_commute_ops_at now computes _mul_cnum(c, residual2_coeff) on every non-commuting swap even for roles whose second slot is always zero; with a symbolic c that's a wasted poly scale. A cheap _iszero_cnum(residual2_coeff) || guard before the multiply would restore the old cost exactly.

@oameye

oameye commented Jul 16, 2026

Copy link
Copy Markdown
Member

We need to bump to 0.9.4

@ChristophHotter
ChristophHotter merged commit 764b0a2 into main Jul 16, 2026
13 checks passed
@ChristophHotter
ChristophHotter deleted the CollectiveTransition_v2 branch July 16, 2026 17:29
oameye added a commit that referenced this pull request Jul 17, 2026
Bring the backend-agnostic numeric refactor up to date with main. Carry
over the op_type/sparse-default contract (#208) into the new numeric_materialize
hook (QOB sparse default; QTB keeps its solver-native lazy VecSum), port
CollectiveTransition numeric support on ManyBodyBasis (#211), and bump to 0.10.0.
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.

2 participants