DataInterpolations.jl
DataInterpolations.jl copied to clipboard
Add missing matrix support for AkimaInterpolation and QuadraticSpline
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
AbstractMatrixconstructor and_interpolatemethod - QuadraticSpline: Added
AbstractMatrixconstructor and_interpolatemethod
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
absfunction not working with vector elements
🤖 Generated with Claude Code