Manual
HChebInterp.BatchFunction
— TypeBatchFunction(f, [x])
Wrapper for an out-of-place function of the form f.(x)
, where the input x
will be a vector with a similar element type to the input domain. Optionally provide a resizeable vector x
to store the input points.
HChebInterp.HAdaptError
— TypeHAdaptError(; n=10)
Estimate the error of the interpolant by dividing the panel into two, computing interpolants on the subpanels, and computing the maximum error between interpolants at n*p
equispaced points, where p
is the number of points used to compute each interpolant.
HChebInterp.SpectralError
— TypeSpectralError(; n=3)
Estimate the error of the interpolant by as the sum of the norm of the last n
Chebyshev coefficients. Use abs
to compute the norm of each coefficient.
HChebInterp.hchebinterp
— Methodhchebinterp(f, a, b, [criterion=SpectralError()]; order=defaultorder(criterion), atol=0, rtol=0, norm=norm, maxevals=typemax(Int), initdiv=1, reuse=true)
Return a piecewise polynomial interpolant of f
on the interval $[a,b]$ of degree order
that is pointwise accurate to the requested tolerances. Uses criterion::AbstractAdaptCriterion
to estimate the interpolant error for h-adaptation. By default, the order
for SpectralError()
is 15 and for HAdaptError()
is 4.
The reuse
keyword requires at least HChebInterp v1.1.
The keyword reuse
specifies that the algorithm will reuse function evaluations on the interpolation grid whenever possible. For expensive functions and interpolation problems on the order of seconds, the benefit will be noticeable, i.e. roughly a 12% saving in function evaluations for the default solver. Since looking up the interpolation points is not necessarily fast, reuse=false
can be set to turn off this optimization.
HChebInterp.AbstractAdaptCriterion
— TypeAbstractAdaptCriterion
Abstract supertype for error criteria for adaptive refinement.
Batching
We also support a batching interface with out-of-place functions that can be parallelized by the user. For example
using HChebInterp
f = x -> cis(x^2)
b = BatchFunction(x -> f.(x))
p = hchebinterp(b, 0.0, 4.0)