module Numeric.Interpolation.Basis (
Compact.linear,
Compact.hermite1,
Compact.cubicLinear,
Compact.cubicParabola,
coefficientsToLinear,
coefficientsToHermite1,
coefficientsToCubicLinear,
coefficientsToCubicParabola,
) where
import qualified Numeric.Interpolation.Basis.Compact as Compact
import qualified Numeric.Interpolation.NodeList as Nodes
import Numeric.Interpolation.Private.Basis
(parabolaDerivativeCenterNode, hermite1Split)
import Numeric.Interpolation.Private.List (mapAdjacent3, )
coefficientsToLinear :: [a] -> [b] -> Nodes.T a b
coefficientsToLinear xs = Nodes.fromList . zip xs
coefficientsToHermite1 :: [a] -> [b] -> Nodes.T a (b, b)
coefficientsToHermite1 xs =
Nodes.fromList . zip xs . hermite1Split xs
coefficientsToCubicLinear :: (Fractional a) => [a] -> [a] -> Nodes.T a (a, a)
coefficientsToCubicLinear xs =
Nodes.fromList .
mapAdjacent3 (\(xl,yl) (xn,yn) (xr,yr) -> (xn, (yn, (yryl)/(xrxl)))) .
zip xs
coefficientsToCubicParabola :: (Fractional a) => [a] -> [a] -> Nodes.T a (a, a)
coefficientsToCubicParabola xs =
Nodes.fromList .
mapAdjacent3
(\pl pn@(xn,yn) pr ->
(xn, (yn, parabolaDerivativeCenterNode pl pn pr))) .
zip xs