Skip to content

Add matrix support for AkimaInterpolation#521

Open
mrarat wants to merge 1 commit into
SciML:masterfrom
mrarat:akima-array-input
Open

Add matrix support for AkimaInterpolation#521
mrarat wants to merge 1 commit into
SciML:masterfrom
mrarat:akima-array-input

Conversation

@mrarat

@mrarat mrarat commented May 6, 2026

Copy link
Copy Markdown

Summary

This PR adds AbstractMatrix input support for AkimaInterpolation.

Previously, AkimaInterpolation(u, t) only accepted vector-like u, while the documented interface supports stacked array data where the last dimension corresponds to time. With this change, matrix-valued data can be passed as:

u::AbstractMatrix  # rows are output components, columns correspond to t
t::AbstractVector
A = AkimaInterpolation(u, t)

For scalar evaluation times, A(t_eval) now returns a vector containing the interpolated value for each row of u.

Changes

  • Added an AkimaInterpolation(u::AbstractMatrix, t; ...) constructor.
  • Added matrix-valued Akima interpolation evaluation.
  • Added matrix-valued Akima derivative support for in-domain evaluation.
  • Added matrix-valued Akima integral support for in-domain integration.
  • Added tests comparing matrix Akima behavior against independent row-wise scalar Akima interpolations.

Known limitation

This PR intentionally does not fix matrix-valued extrapolation.

The current generic extrapolation code in DataInterpolations uses first(A.u) and last(A.u) to obtain endpoint values. For
matrix-valued u, those return scalar array entries, not the first/last output column. This affects matrix-valued extrapolation more generally, not only Akima.

Because of that, matrix-valued extrapolation and extrapolated derivative/integral behavior should be addressed in a separate PR with a global fix.

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.

Additional information

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.

Add vector output support for AkimaInterpolation

1 participant