An Interface to 'SUNDIALS' Ordinary Differential Equation (ODE) Solvers
Overview
Provides a way to call the functions in 'SUNDIALS' C ODE solving library (https://computing.llnl.gov/projects/sundials). Currently the serial version of ODE solver, 'CVODE', sensitivity calculator 'CVODES' and differential algebraic solver 'IDA' from the 'SUNDIALS' library are implemented. The package requires ODE to be written as an 'R' or 'Rcpp' function and does not require the 'SUNDIALS' library to be installed on the local machine.
- **New feature**: the C API gains a second integrator,
ARKODErun as a fully implicit ESDIRK method (singly diagonally implicit Runge-Kutta with an explicit first stage) with Newton iteration and a dense linear solver. Itssundialr_arkode_*entry points mirror thesundialr_cvode_*ones one for one — the same callback types, handle lifecycle, tolerance and step-size setters,set_udata, step counting, and the same no-throw, no-allocation-on-reuse and one-handle-per-thread contracts — so a host loop written against the CVODE API can switch integrator by changing which entry points it looks up. The method defaults toARKODE_ESDIRK436L2SA_6_3_4(order 4);sundialr_arkode_set_order()picks ARKODE's default ESDIRK of order 2 to 5 andsundialr_arkode_set_table_name()any ARKODE DIRK table by name. Status codes are ARKODE's, mirrored asSUNDIALR_ARK_*; they coincide with the CVODE codes for the common failures but not everywhere.sundialr_arkode_reinit()is warm: it usesARKodeReset, which keeps the step size and the error controller's history from the previous segment, the natural restart after a dose within one trajectory.sundialr_arkode_reinit_cold()is the full re-initialisation (ARKStepReInit), withCVodeReInit's semantics: it leaves a used handle exactly as a new one would be (pinned bit for bit by a test), so a handle reused across unrelated problems, such as the subjects of a population, gives results that do not depend on what it solved before; the step count keeps running across it. The addition is binary-compatible, soSUNDIALR_ABI_VERSIONstays 1. To support it the bundled build now compilesARKODE, with CRAN-compliance patches for thestdoutreferences in its parameter-printing paths - Updated the underlying SUNDIALS library to v7.9.0 (Sep 2026). The changes relevant to the bundled solvers are bug fixes: the
SUNNonlinearSolver_Autostiffness switch no longer moves to Newton iteration prematurely, andIDAno longer writes duplicate keys in its logging output (logging is disabled in this build). Thesundialrinterface and the C API are unchanged, and the existing CRAN-compliance patches apply to the new sources without modification. The installed headers change accordingly: theN_Vectoroperations table gains annvsetdevicearraypointerentry, so code compiled against these headers must also be built against 7.9.0 sources - The
cmakecall now uses the current option namesSUNDIALS_ENABLE_C_EXAMPLESandSUNDIALS_ENABLE_CXX_EXAMPLES, silencing two deprecation warnings during installation - The build no longer needs Perl's
openmodule. The step that normalises the line endings of the twocmake-generated headers usedperl -Mopen=IO,:raw, andopenis not part of the minimalperl-base, so installing from source on a minimal Debian/Ubuntu image (for examplerocker/r-ver) failed with "Can't locate open.pm in @INC". The step now uses POSIXtr, which behaves the same on Linux, macOS and Windows (Rtools) - **New feature**: two additions to the C API for host loops that drive many small solves.
sundialr_cvode_set_udata()replaces the callback-data pointer on an existing handle, so one handle can serve many parameter sets — a population of subjects — instead of paying a create/free cycle (SUNContext,cvode_mem, matrix and linear solver allocations) per set.sundialr_cvode_reset_stats()zeroes the accumulated step count sosundialr_cvode_get_num_steps()can report per-subject counts from a shared handle. Both are additive and binary-compatible, soSUNDIALR_ABI_VERSIONstays 1 - Fixed
sundialr_cvode_get_num_steps()under the reinit-per-segment pattern:CVodeReInitzeroesCVODE's internal step counter, so the count previously restarted at everysundialr_cvode_reinit()and never reflected more than the current segment, despite being documented as a running total. The handle now accumulates the count across reinits, counting fromcreate()or the lastreset_stats() - The C API's handle-reuse and thread-safety contracts are now documented in
sundialr_capi.hand pinned by tests: after the firstreinit+solvecycle, furtherreinit/solvecalls on a handle perform no heap allocation (a tight-loop test drives 10^4 segments and checks the state buffer is never reallocated), and distinct handles — each owning its ownSUNContextand error record, with no global mutable state and no R API on any entry point — may be driven from concurrent threads, one handle per thread (pinned by a two-thread test) - The vignette has a new section, "Using
ARKODEandCVODEfrom compiled code", showing how another package uses the C API: it looks up thesundialr_arkode_*entry points withR_GetCCallable, simulates repeated doses of a one-compartment model withARKODE, restarting the integrator at each dose, and checks the result against the closed-form solution. It also covers method selection, warm and cold reinitialisation and switching toCVODE. The Introduction and Summary no longer describeARKODEas a future addition; it is available through the C API, though not yet as anRfunction
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK10 OK2026-04-25
- ERROR5 OK, 2 NOTE, 1 WARNING, 1 ERROR2026-04-22
Documentation
- Help pages
- 4
- Examples that run
- 100%4 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- not tracked
- Return-value docs
- not tracked
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 88%
- Median days to close, 50 most recently updated closed issues
- not measured
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
Commit identities over time
11 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/sn248/sundialr on 2026-10-25.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-18 · The repository has a site deploy workflow
pkgdown site last built 2026-10-18
Show all practicesHide 1 practice
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-03-28Named in .Rbuildignore: .claude, CLAUDE.mdNamed in .gitignore: CLAUDE.mdPull request it wrote: opened by a project memberCommits: at least 16 crediting it in the message
- Claude Opus 5.58 commits · Oct 2026
- Claude Opus 54 commits · Aug 2026
- Claude Sonnet 4.63 commits · Mar 2026
Dependencies
Installing sundialr adds 2 packages (2 with compiled code, 2.8 MB of source tarballs). Heaviest: Rcpp 1.8 MB, RcppArmadillo 1.0 MB.
Code & Tests
People & History
Show 8 of 12 peopleHide 8 people
Pick two releases to compare their code metrics.
- 0.2.1Latest
- 0.2.02026-08-07 · diff ↗
- RR 4.6.0 released · 2026-04-24
- unarchivedReturned to CRAN2026-04-21
- 0.1.72026-04-21 · diff ↗
- archivedRemoved from CRAN2025-05-12issues were not corrected despite reminders
- RR 4.5.0 released · 2025-04-11
- 0.1.6.22025-01-14 · diff ↗
- 0.1.6.12024-12-18 · diff ↗
- 0.1.62024-12-15 · diff ↗
- 0.1.52024-11-11 · diff ↗
- unarchivedReturned to CRAN2024-07-02
- 0.1.4.22024-07-02 · diff ↗
- RR 4.4.0 released · 2024-04-24
- archivedRemoved from CRAN2023-05-19issues were not corrected in time Policy violation on bundled-only use of external libs Policy violation on improperly forward emails to 'gmail.com'
- RR 4.3.0 released · 2023-04-21
Show 15 earlier eventsHide 15 earlier events
- RR 4.2.0 released · 2022-04-22
- RR 4.1.0 released · 2021-05-18
- 0.1.4.12021-05-16 · diff ↗
- 0.1.42020-05-31 · diff ↗
- RR 4.0.0 released · 2020-04-24
- 0.1.32019-06-09 · diff ↗
- RR 3.6.0 released · 2019-04-26
- unarchivedReturned to CRAN2019-01-12
- 0.1.22019-01-12 · diff ↗
- archivedRemoved from CRAN2019-01-09installation problems reported in August 2018 had not been corrected install with parallel make often failed
- unarchivedReturned to CRAN2018-07-22
- 0.1.12018-07-22 · diff ↗
- archivedRemoved from CRAN2018-07-19installation errors were not corrected despite reminder
- 0.1.02018-07-05
- RR 3.5.0 released · 2018-04-23
Package metadata
- First published
- 2018-07-05
- Total releases
- 14 / 8 yrs
- License
- BSD_3_clause + file LICENSE OSI · relicensed from GPL (>= 2) in 0.1.4
- Copyright
- See COPYRIGHTS in the package
- Download size
- 2.4 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("sundialr")The package provides a citation file, so citation() returns the authors' own entry.
It points to 10.5281/zenodo.5501631.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-26, which the citation names so these numbers can be found later. More on citing and the projects behind them.