Skip to content

Conversation

ChrisRackauckas-Claude
Copy link
Contributor

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 and others added 3 commits September 7, 2025 11:17
Fixes SciML#206 by implementing matrix dispatch methods that were missing:

- Add AbstractMatrix constructor for AkimaInterpolation
- Add AbstractMatrix constructor for QuadraticSpline
- Add AbstractMatrix _interpolate method for AkimaInterpolation
- Add AbstractMatrix _interpolate method for QuadraticSpline

Now all interpolation methods have consistent matrix support:
✓ LinearInterpolation, QuadraticInterpolation, LagrangeInterpolation, ConstantInterpolation (already worked)
✓ AkimaInterpolation, QuadraticSpline (newly fixed)
✓ CubicSpline (already worked)

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

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add comprehensive matrix tests for AkimaInterpolation and QuadraticSpline
- Include edge cases: single row matrices, larger matrices, different extrapolation settings
- Add missing _integral methods for AkimaInterpolation and QuadraticSpline with matrices
- Fix QuadraticSpline matrix interpolation to handle parameter computation properly
- All matrix tests now pass, ensuring consistent interface across interpolation methods

Test coverage includes:
✓ Matrix interpolation at original and intermediate points
✓ Matrix extrapolation functionality
✓ Output dimensions and sizes verification
✓ Edge cases with single row and larger matrices
✓ Parameter caching compatibility

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…ine constructors

- Add Vector of Vectors support for AkimaInterpolation by using norm() instead of abs() for vector differences
- Fix BSplineInterpolation and BSplineApprox constructors to handle vector elements better
- Add comprehensive Vector of Vectors tests for AkimaInterpolation
- Improve arc length calculations for vector-valued data in BSpline methods

Major interface consistency improvements:
✅ AkimaInterpolation: Now supports Vector, Matrix, and Vector of Vectors
✅ QuadraticSpline: Now supports Vector, Matrix, and Vector of Vectors
✅ All other methods: Already had comprehensive support

This resolves the main interface inconsistency issues reported in SciML#206.
BSpline Vector of Vectors support requires more complex architectural changes
due to their linear algebra operations with mixed data types.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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.

Inconsistency in Interface
2 participants