Skip to content

feat: make HarmonicEquation contain source system - #38

Merged
oameye merged 7 commits into
mainfrom
source
Jul 26, 2026
Merged

oameye merged 7 commits into
mainfrom
source

Conversation

@oameye

@oameye oameye commented Jul 3, 2025

Copy link
Copy Markdown
Member

Description

HarmonicEquation hardcoded the assumption that it was derived from a second order DifferentialEquation in the lab frame, keeping it in a natural_equation::DifferentialEquation field. That assumption does not hold for harmonic equations derived from QuantumCumulants.MeanfieldEquations, which HarmonicSteadyState.jl's QuantumCumulantsExt constructs, and which previously had to fall back on an empty placeholder DifferentialEquation().

This PR lifts the source system into a type parameter:

  • HarmonicEquation becomes HarmonicEquation{T}, with natural_equation::DifferentialEquation replaced by source_equations::T.
  • QuestBase.source(eom) returns the source system, QuestBase.source_type(eom) returns its type so downstream code can dispatch on the origin of a HarmonicEquation without materialising it.
  • Field order changed: jacobian now precedes source_equations, and the five-argument constructor takes the source system explicitly instead of defaulting to DifferentialEquation().

The struct stays concretely typed (all_concrete still passes), because T is now a parameter rather than an abstract field.

Migration

eom.natural_equation                 # before
QuestBase.source(eom)                # after

HarmonicEquation(eqs, vars, pars, jac)                 # before
HarmonicEquation(eqs, vars, pars, jac, source_system)  # after

Related issues or PRs

Requires companion changes downstream:

Additional context

Breaking, so this releases as 0.5.0. A patch release would have been auto-resolved by the already-released HarmonicSteadyState 0.5.3 and HarmonicBalance 0.17.1, both of which carry QuestBase = "0.4.1", and would have broken them at precompile time.

@codecov

codecov Bot commented Jul 3, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@d656a7a). Learn more about missing BASE report.
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/HarmonicEquation.jl 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #38   +/-   ##
=======================================
  Coverage        ?   79.68%           
=======================================
  Files           ?       10           
  Lines           ?      448           
  Branches        ?        0           
=======================================
  Hits            ?      357           
  Misses          ?       91           
  Partials        ?        0           

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

oameye added 3 commits July 26, 2026 20:34
Bring the source-propagation work up to date with main, which has since
migrated to SymbolicUtils 4 / Symbolics 7 and gained the Bareiss-based
symbolic linear solve.

Resolved Project.toml: main released 0.4.1 and 0.4.2 in the meantime, so the
version becomes 0.4.3 rather than the 0.4.0 the branch was cut against.
Follow-up polish on the source-propagation change:

- Document `source` and `source_type` and list them in the API reference.
- Rewrite the `HarmonicEquation` docstring to describe the type parameter
  instead of claiming the equations always come from a `DifferentialEquation`,
  and drop a stray trailing backtick that broke the QuantumCumulants link.
- Rename the four-argument constructor's `natural_equation` argument to
  `source_equations`, and correct the `jacobian` field description.
- Add a CHANGELOG entry for 0.4.3.
- Cover `source_type` and a non-DifferentialEquation source system in the
  tests. The construction testset looped over `[heq1, heq2]` but reassigned
  `heq = heq1` in the body, so `heq2` was never actually exercised.
- Fix the two HarmonicBalance.jl doc links: both pointed at the
  Krylov-Bogoliubov anchor, so the harmonic balance link went to the wrong
  section, and both were missing the trailing slash. HarmonicBalance's docs
  site currently 404s below its root, so linkcheck is now warn-only.
Removing `natural_equation`, reordering the fields and adding a type parameter
to `HarmonicEquation` are all visible to anything that touches the struct, and
HarmonicBalance.jl is such a consumer. A patch release would have been
auto-resolved by the already-released HarmonicSteadyState 0.5.3 and
HarmonicBalance 0.17.1, both of which carry `QuestBase = "0.4.1"`, and would
have broken them at precompile time. A minor bump excludes them by caret bound
instead.

Reframe the CHANGELOG entry as breaking to match.
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.

1 participant