Repository navigation
v0.1.0 release prep: cleanup + compat polish + absorb dependabot PRs - #14
Merged
Merged
Conversation
Annotate the primal kernels and Enzyme/ForwardDiff rules for klein_map, gsylv_kamenik, lyapd, and lyapdkr with inline comments referencing the labelled algorithm/JVP/VJP steps in the corresponding docs/src/<name>.md page. Goal: any reader who already understands the math can pattern-match each mul!/ldiv!/sylvds! to its equation without re-deriving. Two independent math audits (Codex + a follow-up review) verified the annotations correctly identify the code → derivation mapping and that the code matches the docs in sign, transpose, and Kronecker convention. Doc cleanups from the Codex audit: - docs/src/lyapd.md: stale impl pointer — the cache and helpers were claimed to live in ext/enzyme_lyapunov.jl; they actually live in src/lyapd.jl. Fixed and split between primal/Enzyme/ForwardDiff. - docs/src/sylvester_kamenik.md: `using Enzyme: ...` doesn't bind the module name, so `Enzyme.Const` in the in-place forward example would fail. Added `Const` to the import. - docs/src/ared.md: "first column / second" of K phrased as if K were 2×2; it's 2×1. Changed to "first/second component". - docs/src/index.md: extension table missing the two *StaticArraysExt triple extensions. Added. - docs/src/lyapd.md + lyapdkr.md: three fragile section-anchor links (klein_map.md#quick-start:-parameters-to-policy) — switched to Documenter `[…](@ref "…")` form, verified resolves on docs build. Code cleanups: - ext/enzyme_sylvester_kamenik.jl: 34-line file-header math-summary trimmed to 10 lines (scope + docs pointer; full derivation lives in the docs page). Dropped redundant `copyto!(kron_buf, reshape(s2, …))` in both dC branches of the forward rule — subtract directly from the reshape view, kron_buf scratch deleted. - src/sylvester_kamenik.jl: gsylv_kamenik! docstring's 50-line algorithm dump replaced with a 12-line REPL-help-style summary (contract, dimensions, docs pointer). Private factor/solve comment block trimmed from 11 lines to 5. Verification: - `julia --project=test test/runtests.jl` — full suite green. - `julia --project=docs docs/make.jl` — doctests pass, cross-refs resolve, no Documenter warnings other than the two pre-existing benign ones (oversized example HTML; no deploy env). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Default CI was running ~12 min; bulk was Enzyme rule sweeps (EnzymeTestUtils.test_forward / test_reverse) recompiling for each fixture. Add a single env-var gate so CI runs ~5 min by default but the full coverage is one `RUN_SLOW_TESTS=true` away. Mechanism: - test/runtests.jl defines `const RUN_SLOW_TESTS = get(ENV, ..., "false") == "true"` and conditionally `include`s test files for non-exported wrappers (gsylv, gsylvkr, sylvkr). - Inside kept files, heavy `@testset` blocks are wrapped in `if _RUN_SLOW_TESTS`. The flag is re-read per file so each can be `include`d standalone for REPL iteration. On default CI (target: ~5 min): - All primal correctness on RBC/RBC_SV/SGU/FVGQ Kamenik, five Klein fixtures, lyapd / lyapdkr smoke. - One manual Enzyme-reverse-vs-FD anchor per AD'd function (Kamenik RBC, lyapd n=2, lyapdkr n=2, klein RBC) — replaces a heavy EnzymeTestUtils sweep with one tiny `central_fdm` cross-check. - All small ForwardDiff Dual tests. - ared Enzyme rules (kept). - DifferentiationInterface end-to-end klein∘lyapdkr integration. Under RUN_SLOW_TESTS=true (target: ~12 min): adds EnzymeTestUtils sweeps for Kamenik / lyapd / lyapdkr / klein_map, BatchDuplicated(4) SGU smoke for Kamenik forward, SGU/FVGQ Enzyme reverse smoke, FVGQ M_ws workspace tests (FD + Enzyme), the gsylv/gsylvkr/sylvkr non-exported wrappers, the README gsylv Enzyme example, and the SMatrix native lyapdkr Enzyme path. While here, fixed the long-standing `klein_map ForwardDiff rules — SGU heap in-place` flake: high-frequency FD probe vectors (sin(3·k), cos(4·k)) amplified central-FD truncation error past the 1e-7 tolerance at n=15. Switched to matching the OOP testset's sin(k), cos(2·k) probes and relaxed tolerance to 1e-6 — math and rule unchanged, just a more robust test. The testset now passes on the default tier. Verification: - `julia --project=test test/runtests.jl` — exit 0, ~5 min wall. - `RUN_SLOW_TESTS=true julia --project=test test/runtests.jl` — exit 0, 42 testsets, no failures. CI.yml unchanged (default-off). Slow tests run locally with `RUN_SLOW_TESTS=true julia --project=test test/runtests.jl`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ry comments - README: shorten `gsylv_kamenik` scope line. - docs/src/lyapd.md: add hot-loop pattern example showing the `lyapd!(X, cache::LyapDSchurCache, C)` cache-taking overload. - ext/forwarddiff_lyapdkr.jl: dedupe OOP + in-place `lyapdkr`/`lyapdkr!` Dual dispatches behind a shared `_lyapdkr_forwarddiff_solve` helper. - ext/enzyme_sylvester_kamenik.jl: trim 34-line file header to 10 (scope + docs pointer); drop the narrative paragraph in front of the in-place forward rule. - src/sylvester_kamenik.jl: condense the inline math annotations in `_gsylv_kamenik_solve!` from ~40 to ~25 lines while preserving every step's link to the docs equation. - ext/klein_map_derivatives.jl: shrink the file-header derivation block and the per-function step-by-step preambles to one-line docs pointers. - All test files: strip "(~Xs)" runtime estimates from the gating comments (numbers rot), drop the war-story narration. - Section dividers: replace the heavy `# ─── ... ─────` style with plain one-line comments throughout AD rules + runtests.jl. - test/test_enzyme_dlyap.jl → test_enzyme_lyapd_small.jl test/test_forwarddiff_dlyap.jl → test_forwarddiff_lyapd_small.jl (the old name pre-dated the upstream `dlyap` → `lyapd` rename). - benchmark/baseline-prelyapdkr.json: delete (9.2 MB stale snapshot from the lyapdkr refactor; never referenced; superseded by baseline.json). All three verification gates green: - Default-tier test suite. - RUN_SLOW_TESTS=true full sweep (42 testsets). - docs/make.jl (clean, only pre-existing benign warnings).
…ject pins Main Project.toml (registration polish): - ConcreteStructs: "0.2.4" → "0.2" (caret-on-minor, stops CompatHelper spam without changing the actually-supported version range). - MatrixEquations: "2.5.8" → "2.5" (same). Subproject pins absorbed from dependabot PRs #5–#13 so we land on a clean PR slate before tagging v0.1.0: test/Project.toml — new [compat]: - Enzyme = "0.13.149" - ForwardDiff = "1.3.3" - MatrixEquations = "2.5.8" - StaticArrays = "1.9.18" docs/Project.toml — appended to existing [compat]: - Enzyme = "0.13.149" - ForwardDiff = "1.3.3" - MatrixEquations = "2.5.8" - Plots = "1.41.6" - StaticArrays = "1.9.18" Closes #5 #6 #7 #8 #9 #10 #11 #12 #13.
This was referenced May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Everything needed to make
mainregistry-ready for the v0.1.0 General-registry submission, rolled into one PR.Four commits on top of
main:a0614dd— docs+comments: map AD-rule code to derivation steps; cleanup pass. Per-step links from the AD-rule source back to the matching equations in the docs derivations (lyapd, lyapdkr, sylvester_kamenik, klein_map).0fb125a— test: addRUN_SLOW_TESTSgate to bring CI under 10 min. Default tier 23 testsets (~5 min);RUN_SLOW_TESTS=trueruns the full 42-testset sweep (~12 min).ab99539— docs+code: cleanup pass. README/Project polish, dedupelyapdkrForwardDiff dispatches behind a shared helper, condense math annotations in_gsylv_kamenik_solve!, trim narrative headers, renametest_*_dlyap.jl→test_*_lyapd_small.jl(post upstreamdlyap→lyapdrename), and delete a 9.2 MB stale benchmark snapshot.9d47d91— chore(compat): registry-ready Project.toml + absorb dependabot subproject pins. Relaxes mainProject.tomlcompat (ConcreteStructs 0.2.4 → 0.2,MatrixEquations 2.5.8 → 2.5) and absorbs the nine open dependabot PRs (build(deps): update Enzyme requirement to 0.13.149 in /docs #5-build(deps): update MatrixEquations requirement to 2.5.8 in /test #13) intotest/Project.tomlanddocs/Project.toml.No public API change.
Registry-readiness checklist (verified)
name,uuid,version = "0.1.0",authorscorrect.[deps]and[weakdeps]have compat entries (post-relaxation).julia = "1.12"compat.LICENSE(MIT) at repo root.Manifest.tomltracked (.gitignorecovers**/Manifest*.toml).[extras]↔[targets].testconsistent.[extensions]modules exist underext/and match[weakdeps].CI.yml(Julia 1.12 + docdeploy + doctests),Register.yml(RegisterAction@latest),TagBot.yml(DOCUMENTER_KEYSSH),CompatHelper.yml.Test plan
julia --project=test test/runtests.jlexit 0 (23 testsets, default tier).RUN_SLOW_TESTS=true julia --project=test test/runtests.jlexit 0 (42 testsets).julia --project=docs docs/make.jlclean.After merge
Register Packageworkflow with input0.1.0(or comment@JuliaRegistrator registeron the merge commit). General has a 3-day waiting period before AutoMerge for first-time registrations.v0.1.0tag and GitHub Release once the General PR merges.Pkg.add(url=...)snippet in README withPkg.add("MatrixEquationsAD").Closes #5 #6 #7 #8 #9 #10 #11 #12 #13.
🤖 Generated with Claude Code