Skip to content

feat: take ANM's residual orders one at a time from jet_orders - #1

Merged
nmoinvaz merged 1 commit into
mainfrom
feat/jet-orders
Nov 16, 2026
Merged

nmoinvaz merged 1 commit into
mainfrom
feat/jet-orders

Conversation

@nmoinvaz

@nmoinvaz nmoinvaz commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

anm::series called residual_jet with every coefficient vector at every order, so each order recomputed all the lower ones and a series of order N cost N evaluations of growing length. A problem had no way to keep its lower orders between calls.

ResidualJet gains a provided method jet_orders, which returns a JetOrders session: each next(z) call takes the newest coefficient vector z_(k-1) and returns order k of the residual's series with z_k left out, the right-hand side of the order-k solve. The default, Recompute, does exactly what series did before, so every existing problem gives the same bits. A problem that keeps its lower orders between calls overrides jet_orders and makes the series cost N orders.

The new test anm_takes_the_orders_from_jet_orders gives the planted polynomial branch a session that keeps each unknown's coefficients and its square's between calls, and redoes the square's order k - 1 once z_(k-1) is known. Its series matches the residual_jet series bit for bit in double- and quad-double. The control drops that redo, and the series then differs from order 2 on.

Summary by CodeRabbit

  • New Features
    • Taylor-series residual orders can now be requested one at a time. Implementations can retain intermediate results between orders to avoid repeated calculations; the default behavior recomputes each order.
  • Documentation
    • Clarified the default calculation behavior and how implementations can reduce repeated work.

The series of a branch evaluated the residual's whole series again at
every order, so a problem had no way to keep its lower orders. ResidualJet
gains jet_orders, a session that returns order k once z_(k-1) is given,
by default by residual_jet as before, and anm::series takes its orders
from it.
@nmoinvaz nmoinvaz added the enhancement New feature or request label Nov 16, 2026
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds an iterator API for residual orders and updates series generation to consume one residual order per coefficient. The default iterator recomputes residuals. The test implementation also adds a provider that retains intermediate coefficients and compares its output with the default mode.

Changes: Residual-order iteration

Layer / File(s) Summary
Iterator API and fallback
src/lib.rs, README.md
ResidualJet gains jet_orders, which returns a Recompute iterator by default. Recompute stores coefficient vectors and calls residual_jet to return each requested order. The README documents the default and describes overriding the method to retain lower orders.
Series coefficient generation
src/anm.rs
series obtains a jet_orders iterator and uses each returned residual to form the next coefficient. It passes the latest coefficient parts to the next iterator call.
Retained-coefficient provider and tests
tests/anm.rs
Poly selects either Recompute or PolyOrders by mode. PolyOrders retains unknown coefficients and their squares between calls. Tests compare modes in double- and quad-double precision and check where mode 2 first differs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant series
  participant ResidualJet
  participant Recompute
  series->>ResidualJet: jet_orders(order)
  ResidualJet-->>series: Recompute iterator
  loop Each coefficient
    series->>Recompute: next(last, par)
    Recompute->>ResidualJet: residual_jet(stored coefficients)
    ResidualJet-->>Recompute: residual orders
    Recompute-->>series: next residual
  end
Loading
Merge Risk: Minimal · up to 4e8b3

This change adds an opt-in way for problems to supply residual orders incrementally. Existing problems keep their current behavior through the default implementation. No concrete merge-blocking risk was identified, though the tests were not run during review.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: ANM's residual orders are now taken one at a time from the new jet_orders method. The raw summary and objectives confirm that src/anm.rs series consumes orders from Re…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: ANM's residual orders are now taken one at a time from the new jet_orders method. The raw summary and objectives confirm that src/anm.rs series consumes orders from ResidualJet::jet_orders, which is the core of the PR. The title is specific and does not describe anything absent from the changeset. The conventional 'feat:' prefix is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 3586c0dd-6237-4008-8881-7bd381ec2e10
Commits

Reviewing files that changed from the base of the PR and between 1b8bbb6 and 4e8b3c8.

Files selected for processing: 4

  • README.md
  • src/anm.rs
  • src/lib.rs
  • tests/anm.rs

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@nmoinvaz
nmoinvaz merged commit e49e206 into main Nov 16, 2026
16 checks passed
@nmoinvaz
nmoinvaz deleted the feat/jet-orders branch November 16, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant