DataInterpolations.jl icon indicating copy to clipboard operation
DataInterpolations.jl copied to clipboard

Add missing matrix support for AkimaInterpolation and QuadraticSpline

Open ChrisRackauckas-Claude opened this issue 3 months ago • 0 comments

Summary

Fixes #206 by implementing missing matrix dispatch methods for AkimaInterpolation and QuadraticSpline.

Previously, only LinearInterpolation, QuadraticInterpolation, LagrangeInterpolation, and ConstantInterpolation supported matrices. This PR adds matrix support to the remaining methods.

Changes Made

  • AkimaInterpolation: Added AbstractMatrix constructor and _interpolate method
  • QuadraticSpline: Added AbstractMatrix constructor and _interpolate method

Matrix Interface

The matrix interface allows interpolating multiple functions simultaneously, where each row of the matrix represents a different function evaluated at the same time points.

Example usage:

t = 0.0:0.1:1.0
u_matrix = [sin.(t) cos.(t)]'  # 2×11 matrix (2 functions, 11 time points)

# Now works for all methods:
itp1 = AkimaInterpolation(u_matrix, t)
itp2 = QuadraticSpline(u_matrix, t)

result = itp1(0.5)  # Returns [sin(0.5), cos(0.5)] approximately

Test Results

All methods now have consistent matrix support:

  • ✅ LinearInterpolation, QuadraticInterpolation, LagrangeInterpolation, ConstantInterpolation (already worked)
  • ✅ AkimaInterpolation, QuadraticSpline (newly fixed)
  • ✅ CubicSpline (already worked)

Notes

  • BSplineInterpolation and BSplineApprox still have constructor issues, but these appear to be separate bugs not related to matrix support
  • Vector of Vectors support for AkimaInterpolation remains a separate issue due to the abs function not working with vector elements

🤖 Generated with Claude Code

ChrisRackauckas-Claude avatar Sep 07 '25 15:09 ChrisRackauckas-Claude