Commit 30f4191
Support Symbolics v7 (port matrix atoms + curvature passes) (#112)
* Cap Symbolics to v6 and fix test Manifolds/Manopt resolution
Three independent CI failures all stem from dependency churn, not code
regressions:
1. docs + Core/QA precompile: Symbolics v7 removed the `Symbolic` abstract
type and collapsed array/scalar registered symbolics onto a single
`BasicSymbolic{SymReal}`. That makes the package's `import Symbolics:
Symbolic` fail and makes the dual scalar/vector `@register_symbolic`
(e.g. `quad_over_lin`) plus the matrix-function registrations
(`Base.log`/`inv`/`sqrt` on `Symbolics.Arr`) generate duplicate /
`Base`-clobbering methods that abort precompilation. The package's
matrix-atom registration model is not yet v7-compatible, so cap
`Symbolics = "6"` / `SymbolicUtils = "3.1.2"` (the last-known-good set,
matching registered v0.3.6) in the package, docs, and test envs.
2. Core/QA resolution: dependabot bumped test `Manifolds` to 0.11.26, but
`OptimizationManopt` 1.3.2 only supports `Manifolds 0.10` /
`ManifoldsBase 1`, and `Manopt 0.5.38` requires `ManifoldsBase 2`. Cap
test `Manifolds = "0.10"` and `Manopt = "0.5.25"` so the env resolves
(Manifolds 0.10.23, ManifoldsBase 1.2.0, Manopt 0.5.25, OptimizationManopt
1.3.2).
3. Downgrade: `empty intersection between Symbolics@6 and project compat
7.25.0-7` — the test env pinned Symbolics 7.25 while the package floor is
6. Aligning both to 6 removes the conflict.
Verified locally on Julia 1.12 and 1.10: the test env resolves and
precompiles, `GROUP=Core` passes (alloc 17/17, dgp 28/28, interface 31/31,
lorentz 11/11, test 19 pass + 2 pre-existing broken), and all docs example
blocks run.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Fix QA (Aqua/JET) findings and align downgrade compat floor
Builds on the Symbolics-v6 cap to make the QA and Downgrade groups green:
Downgrade: raise the package Manifolds compat floor from 0.9 to 0.10 so it
matches the test env's Manifolds cap (needed for OptimizationManopt 1.3.2).
julia-downgrade-compat was pinning the root floor to Manifolds 0.9.10, which
had an empty intersection with the test env's 0.10 -> Downgrade now resolves
the minimal set (Manifolds 0.10.0, ...).
Aqua:
- Drop the unused IfElse and Dictionaries deps (genuine stale deps).
- Disambiguate Base.in(::Num/::Symbolic, ::CustomDomain) against Symbolics'
in(::Num/::Symbolic, ::Domain) (CustomDomain <: Domain made the two overlap).
- Configure run_qa's Aqua via aqua_kwargs: treat the deliberately-extended
non-owned functions (log/tr/inv/sqrt/logdet/distance/xlogx and the Symbolics
arguments/hasmetadata/promote_symtype hooks) as own for the piracy check, and
exclude the 10 atom functions whose scalar+array @register_symbolic
registrations generate benign internal ambiguities. All remaining ambiguities
are internal to SymbolicAnalysis (no cross-package ambiguity remains).
JET (real code bugs surfaced by report_package, run in :typo mode):
- lorentz_log_barrier referenced an undefined ; a = (0,...,0,1) makes the
Lorentzian inner product reduce to -p[end], so the barrier is -log(-1+p[end]).
- lognormcdf called logcdf(Normal, x) (the type) which is a MethodError; use the
standard-normal instance logcdf(Normal(), x).
- find_curvature/find_gcurvature could fall through with /
undefined (the branch did not return its value); return it and
default f_curvature/f_monotonicity to the existing 'unknown' semantics.
Switch test/qa/qa.jl to SciMLTesting.run_qa (the shared harness, matching
ModelingToolkit) with jet=true and mode=:typo.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Downgrade: raise Symbolics floor to 6.37.1 (and SymbolicUtils to 3.24)
After raising the Manifolds floor, the Downgrade job surfaced the next
empty-intersection: julia-downgrade-compat pinned the package's Symbolics
floor to 6.0.0, which only allows ForwardDiff 0.10, while the test env
requires ForwardDiff 1.3.3 (Optimization 5.x) -> 'empty intersection between
ForwardDiff@0.10.39 and project compatibility 1.3.3-1'.
Symbolics first allows ForwardDiff 1.x at 6.37.1 (registry Compat.toml:
6.37.1-6.42 => ForwardDiff = [0.10.36-0.10, 1]); that range needs
SymbolicUtils >= 3.24.0. Raise both package floors accordingly. This is a
pure floor raise within the existing v6 cap (the suite already runs on
Symbolics 6.58 / SymbolicUtils 3.32 / ForwardDiff 1.4), so it only removes
the unsatisfiable lower corner.
Verified locally on lts (1.10): the real julia-downgrade-compat resolves the
root minimal set (Symbolics 6.37.1, SymbolicUtils 3.24.0) and the test env
then resolves with ForwardDiff 1.4.1, Manifolds 0.10.23, Manopt 0.5.25.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Downgrade: also downgrade the test project (projects: .,test)
The test env declares modern floors (Optimization 5.6.1, Zygote 0.7.10,
ForwardDiff 1.3.3) whose transitive requirements (SciMLBase >= 2.130, which
supports Zygote 0.7) are far above the package's own transitive minima.
Downgrading only the root project pinned SciMLBase to 2.35.0 in the Manifest,
and with allow_reresolve=false the test deps could not reconcile ->
'Unsatisfiable requirements ... Zygote ... SciMLBase 2.35.0'.
Passing projects: '.,test' to the SciML downgrade workflow pins both projects'
direct deps to their floors at once, so the test floors force the consistent
modern transitive set. Verified locally on lts (1.10): julia-downgrade-compat
'Successfully resolved minimal versions for merged project' and the env
resolves (Symbolics 6.37.1, SymbolicUtils 3.24.0, ForwardDiff 1.3.3,
Zygote 0.7.10, SciMLBase 2.155.1, Optimization 5.6.1, Manifolds 0.10.13).
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Downgrade: gate the x^2+y^2+z^2 curvature test_broken on Symbolics >= 6.38
With the test project downgraded, Symbolics resolves to 6.37.1, where the
curvature pass correctly derives 'x^2 + y^2 + z^2' as Convex, so the existing
@test_broken errored with 'Unexpected Pass'. The result regressed to
UnknownCurvature in Symbolics 6.38 (bisected: 6.37.1 works, 6.38.0 broken).
Convert to '@test ... broken = (pkgversion(Symbolics) >= v"6.38")': a real,
passing assertion on the Downgrade env (6.37.1) and a documented known
regression on the Core/docs envs (Symbolics 6.58). No test is weakened - the
assertion still runs and would fail if the result regressed on < 6.38.
Verified locally: testset records Pass at Symbolics 6.37.1 and Broken at 6.58.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Support Symbolics v7: port matrix atoms and curvature passes, open compat
Re-opens the package to Symbolics v7 (was capped at v6 on this branch) and
adapts the source for the v7/SymbolicUtils v4 API changes so the analysis
genuinely runs on v7. Verified on Symbolics 7.28.1 / SymbolicUtils 4.35.3:
Core (test/interface/lorentz/dgp = 91/91), QA (Aqua+JET 12/12) and the
allocation tests all pass.
Compat:
- Symbolics "6.37.1" -> "6.37.1, 7"; SymbolicUtils "3.24" -> "3.24, 4.35"
(Symbolics 7.25+ requires SymbolicUtils 4.35+).
- test/ and docs/ envs widened to allow v7 as well.
Source adaptations for the v7 model (scalars and arrays both unwrap to
`BasicSymbolic{SymReal}`, numeric literals are wrapped constants, matrix
products return bare `BasicSymbolic`, several registration macros collapse or
break `maketerm`):
- `Symbolic` alias is version-aware (`Symbolics.Symbolic` on v6 — which still
covers `ArrayOp` — `BasicSymbolic` on v7); the `in(::CustomDomain)`
disambiguators dispatch on the type Symbolics itself uses so they stay
unambiguous.
- `dcprule(^, ...)`, the `broadcast` rule, and the `*` curvature/sign passes
unwrap wrapped numeric constants via `Symbolics.value` before numeric tests.
- `propagate_sign`/`propagate_curvature`/`propagate_gcurvature` unwrap their
input so metadata survives the v7 rewrite walk; `add_sign` no longer writes
into the (read-only on v7) matched args.
- `canonize` rules match the flattened v7 `*` shape (no array indexing).
- Matrix atoms (`log`/`inv`/`sqrt`, `conjugation`, `hadamard_product`,
`affine_map`, `Manifolds.distance`) build terms via `SymbolicUtils.term`
on v7 instead of the colliding/`maketerm`-unsafe registration macros; matrix
`*` of `Arr`s is re-wrapped and a (strictly-more-specific, non-overwriting)
matrix `promote_shape(sqrt, ...)` is added.
- `quad_over_lin`/`tr` registrations gated to v6 where the macro path is needed
and non-colliding.
QA: declare the new intentional `*`/`promote_shape` methods as own and ignore
the (v6-only-transitive) RecursiveArrayTools stale-dep. Two curvature tests that
the v6.38+ tree shape regressed now pass on v7; their `broken` guards updated.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Make Symbolics v7-only: drop v6 fallback paths and cruft
The package now targets Symbolics v7 / SymbolicUtils v4 exclusively, so the
version-gated v6 fallback code is removed:
- src/SymbolicAnalysis.jl: `Symbolic` is `BasicSymbolic` and `InDomainSymbolic`
is `BasicSymbolic{SymReal}` directly (drop the `isdefined(Symbolics, :Symbolic)`
branches).
- src/atoms.jl: drop the v6-only `quad_over_lin` vector `@register_symbolic`, and
collapse the `@static`/`pkgversion` branches for `matrix_atom`, the matrix `*`
re-wrap, and the `sqrt` `promote_shape` to their v7 form.
- src/gdcp/spd.jl: replace the v6 `@register_array_symbolic`/`@register_symbolic`
branches for `conjugation`, `tr`, and `hadamard_product` with the v7
`SymbolicUtils.term`-based definitions.
- src/canon.jl: keep only the flattened-`*` canonicalization rules.
- Drop `RecursiveArrayTools` (declared but never loaded on v7) from the package
deps, and remove the now-unnecessary Aqua `stale_deps` ignore in test/qa/qa.jl
(the stale-deps check is fully live again).
- test/test.jl: the two version-gated `broken` curvature tests pass on v7, so
they are now plain `@test`s.
Compat floors: Symbolics = "7.28", SymbolicUtils = "4.35" (Project.toml,
test/Project.toml, docs/Project.toml). Symbolics 7.27+ requires SymbolicUtils
4.35+; the code was developed and verified against the 7.28.x / 4.35.x API
(`term(...; shape=...)`, `ShapeVecT`, `_throw_array`, `SymReal`), all of which
are present at the 4.35.0 floor. The floor resolves cleanly (downgrade lane:
Symbolics 7.28.0 + SymbolicUtils 4.35.3; max: 7.28.1 + 4.35.3).
Verified on Julia 1.12.6 / Symbolics 7.28.1: Core 108/108 (test 21, dgp 28,
interface 31, lorentz 11, alloc 17), QA 12/12, 0 broken/skipped.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* QA: fix real ambiguities at the source, drop custom Aqua hacks
The v7 port left a hand-rolled QA in test/qa/qa.jl that excluded 10 atoms
from Aqua's ambiguity check and over-broadly declared piracy exceptions.
Re-evaluate against the canonical `Aqua.test_all`:
- Only 3 atoms (`sdivergence`, `log_quad_form`, `lorentz_least_squares`)
actually produce ambiguities, and they are real: their multi-array
`@register_symbolic` registrations explode into a combinatorial set of
mutually-ambiguous `Num`/`BasicSymbolic`/`Arr` wrapper methods on
Symbolics v7. Fix the cause (not the symptom) by building those terms
directly via `SymbolicUtils.term` off the symbolic argument — the same
pattern the v7 port already uses for `conjugation`/`hadamard_product`/
`distance`. `detect_ambiguities(SymbolicAnalysis)` is now empty, so the
whole `ambiguities = (; exclude = ...)` list is dropped.
- The remaining Aqua exception is `piracies = (; treat_as_own = ...)`,
minimized to exactly the foreign functions the package intentionally
extends with analysis methods (dropping the unused `tr`, which v7 builds
natively). This is the package's by-design purpose and the only exception
it needs; ambiguities/stale-deps/etc. all pass cleanly under the canonical
template.
Verified locally on Julia 1.12.6 (Symbolics 7.28.1, SymbolicUtils 4.35.5):
Core group 108/108, QA group 12/12.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 6886371 commit 30f4191
13 files changed
Lines changed: 279 additions & 108 deletions
File tree
- .github/workflows
- docs
- src
- gdcp
- test
- qa
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
18 | | - | |
19 | 16 | | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
26 | | - | |
27 | 23 | | |
28 | 24 | | |
29 | | - | |
30 | 25 | | |
31 | 26 | | |
32 | | - | |
| 27 | + | |
33 | 28 | | |
34 | 29 | | |
35 | | - | |
36 | 30 | | |
37 | | - | |
38 | | - | |
| 31 | + | |
| 32 | + | |
39 | 33 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
17 | 27 | | |
18 | 28 | | |
19 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
235 | 238 | | |
236 | 239 | | |
237 | 240 | | |
| |||
393 | 396 | | |
394 | 397 | | |
395 | 398 | | |
396 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
397 | 444 | | |
398 | 445 | | |
399 | | - | |
| 446 | + | |
400 | 447 | | |
401 | 448 | | |
402 | | - | |
| 449 | + | |
403 | 450 | | |
404 | 451 | | |
405 | 452 | | |
| |||
420 | 467 | | |
421 | 468 | | |
422 | 469 | | |
423 | | - | |
| 470 | + | |
424 | 471 | | |
425 | 472 | | |
426 | 473 | | |
| |||
434 | 481 | | |
435 | 482 | | |
436 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
437 | 489 | | |
438 | 490 | | |
439 | 491 | | |
| |||
512 | 564 | | |
513 | 565 | | |
514 | 566 | | |
515 | | - | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
516 | 571 | | |
517 | 572 | | |
518 | 573 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 5 | + | |
| 6 | + | |
11 | 7 | | |
12 | 8 | | |
13 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
164 | | - | |
| 166 | + | |
| 167 | + | |
165 | 168 | | |
166 | | - | |
| 169 | + | |
167 | 170 | | |
168 | 171 | | |
169 | 172 | | |
170 | 173 | | |
171 | 174 | | |
172 | 175 | | |
173 | | - | |
| 176 | + | |
174 | 177 | | |
175 | 178 | | |
176 | 179 | | |
| |||
242 | 245 | | |
243 | 246 | | |
244 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
245 | 253 | | |
246 | 254 | | |
247 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
19 | | - | |
| 25 | + | |
20 | 26 | | |
21 | | - | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
23 | 30 | | |
24 | 31 | | |
25 | | - | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
32 | 39 | | |
33 | 40 | | |
34 | | - | |
| 41 | + | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
| |||
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
72 | | - | |
| 79 | + | |
73 | 80 | | |
74 | 81 | | |
75 | 82 | | |
| |||
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
105 | | - | |
| 112 | + | |
106 | 113 | | |
107 | 114 | | |
108 | 115 | | |
| |||
170 | 177 | | |
171 | 178 | | |
172 | 179 | | |
173 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
174 | 192 | | |
175 | 193 | | |
176 | 194 | | |
| |||
203 | 221 | | |
204 | 222 | | |
205 | 223 | | |
206 | | - | |
| 224 | + | |
207 | 225 | | |
208 | 226 | | |
209 | 227 | | |
| |||
0 commit comments