The current cubic_interp API is a global formulation that guarantees C2 continuity, so it does not currently provide the kind of local C1 Hermite-style interface you described.
I do think this kind of local C1 scheme would be a useful feature, so I’ll add it to the higher-priority items on my development roadmap.
Since the relevant Hermite-style infrastructure is already in place internally, I expect it should be quite feasible to implement. My current thinking is that this would more likely become a separate API, rather than an extension of cubic_interp, to keep it clearly distinct from the existing C2 formulation. That said, nothing is fixed yet, and I still want to think through the most ergonomic interface.
I’ll try to work on it soon after finishing the issues I’m already working on.
If you want, it would also be great to open an issue on the GitHub page to discuss the details further and keep track of updates.
@hersle
A new version of FastInterpolations.jl (v0.4.8) has just been released, and it finally supports a C¹-continuous local cubic Hermite family!
Note that cubic_interp in this package is the global cubic spline, so for the local cubic Hermite (with a pre-defined slope dydx as you asked) you use a separate entry point hermite_interp.
In addition to the user-provided slope case, there are also pchip_interp, cardinal_interp, and akima_interp, which compute the slopes automatically by their own rules (monotone-preserving, Catmull-Rom with tension, Akima, respectively):
using FastInterpolations
# One-shot API
hermite_interp(x, y, dydx, 1.0) # user-supplied slopes (dydx)
# Interpolant API
itp = hermite_interp(x, y, dydx) # build a reusable interpolant
itp(1.0) # evaluate at x = 1.0
# auto-slope variants (no dydx needed)
pchip_interp(x, y, 1.0) # monotone-preserving
cardinal_interp(x, y, 1.0) # Catmull-Rom with tension
akima_interp(x, y, 1.0) # Akima
They all work in both 1D and ND (except hermite_interp for ND, which will come in a later release). Not every advanced feature is fully covered yet, but most of the common usage already works, and I will keep improving it in the upcoming releases.