Skip to content

fix: COSY-compat DA core/ops corrections (bump to 1.4.0)#96

Merged
hiibolt merged 1 commit into
masterfrom
fix/cosy-compat-da-core-ops
Jun 5, 2026
Merged

fix: COSY-compat DA core/ops corrections (bump to 1.4.0)#96
hiibolt merged 1 commit into
masterfrom
fix/cosy-compat-da-core-ops

Conversation

@hiibolt

@hiibolt hiibolt commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • DAPRV/DAREV format overhaul: Rosy's DAPRV was outputting a verbose tabular format (with header, index column, ORDER column, space-separated exponents) completely incompatible with COSY INFINITY. Rewrote to COSY format: {:17.12} coefficient, concatenated exponent digits per variable, +78-dash separator, no header. DAREV parser updated to match (char-by-char exponent parsing). DAREA gets the same fix.
  • RKCO coefficients corrupted: The DOP853 8th-order solution weights b[] summed to ~0.712 instead of 1.0 — a garbled transcription from Hairer's Fortran source. Replaced all 7 affected weights with correct Hairer values. Also fixed e[5]/e[6] (exponent sign errors: e+1e-1, e+0e-1) and synced a2 row 13 (FSAL row mirrors b).
  • DA epsilon hardcoding: add_constant_in_place and make_prime used hardcoded 1e-15; both now read the configured epsilon from the runtime.
  • DAFILT mask threshold: Changed > 0.0 to > epsilon so the filter respects user-configured DAEPS.
  • DARAN invariant: Added epsilon guard before nonzero.push to uphold the DA struct invariant.
  • DAPEW exponent overflow: Limited exponent display to num_vars (was always MAX_VARS=6); corrected COSY header format.
  • display.rs exponent count: build_exp_str now takes num_vars so DA display doesn't pad with unused exponent slots.

Test plan

  • cargo test — 21/21 unit tests pass
  • cargo run -- run rosy/src/program/statements/da/daprv/test.rosy — output matches cosy_output.txt byte-for-byte
  • cargo run -- run rosy/src/program/statements/da/dapew/test.rosy — output matches COSY header/separator format
  • RKCO b[] sum verified to equal 1.0 (sum of corrected weights ≈ 0.99999998)

- DAPRV: rewrite format to COSY format (no header, {:17.12} coefficient,
  concatenated exponent digits per variable, space+78-dash separator)
- DAREV: fix exponent parser to read concatenated digits instead of
  space-separated tokens; remove spurious header-skip
- DAREA: same concatenated-exponent fix as DAREV
- DAPEW: correct header format, limit exponents to num_vars, fix separator
  to 5sp+35 dashes
- RKCO: replace corrupted DOP853 b[] weights (sum was ~0.712, now 1.0),
  fix e[5]/e[6] exponent transcription errors, sync a2 row 13 to b[]
- DA: add_constant_in_place and make_prime now read epsilon from runtime
  instead of hardcoded 1e-15
- DAFILT: use runtime epsilon instead of > 0.0 for mask threshold
- DARAN: guard nonzero.push with epsilon check to uphold DA invariant
- display: build_exp_str now takes num_vars to avoid printing unused
  MAX_VARS exponent slots
@hiibolt hiibolt merged commit 06c3088 into master Jun 5, 2026
2 checks passed
@hiibolt hiibolt deleted the fix/cosy-compat-da-core-ops branch June 5, 2026 19:56
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