-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | piecewise linear and cubic Hermite interpolation -- -- Represent real functions by linear or cubic polynomial segments. The -- package provides both data structures for efficient lookup of -- interpolation intervals, and computation of basis functions. -- -- There are two examples that can be built with -- --
--   cabal install -fbuildExamples
--   
-- -- -- -- The package needs only Haskell 98. Most of the package dependencies -- are only needed for the examples and are only installed if you enable -- to build them. @package interpolation @version 0.1.1 module Numeric.Interpolation.NodeList data T x y Interval :: T x y Node :: (x, y) -> T x y -> T x y -> T x y -- | list must be sorted with respect to first element fromList :: [(x, y)] -> T x y toList :: T x y -> [(x, y)] singleton :: x -> y -> T x y lookup :: Ord x => T x y -> x -> (Maybe (x, y), Maybe (x, y)) instance (GHC.Show.Show x, GHC.Show.Show y) => GHC.Show.Show (Numeric.Interpolation.NodeList.T x y) instance (GHC.Classes.Ord x, GHC.Classes.Ord y) => GHC.Classes.Ord (Numeric.Interpolation.NodeList.T x y) instance (GHC.Classes.Eq x, GHC.Classes.Eq y) => GHC.Classes.Eq (Numeric.Interpolation.NodeList.T x y) instance GHC.Base.Functor (Numeric.Interpolation.NodeList.T x) instance Data.Foldable.Foldable (Numeric.Interpolation.NodeList.T x) instance Data.Traversable.Traversable (Numeric.Interpolation.NodeList.T x) -- | Interpolation basis functions using all given nodes. The represented -- functions are equivalent to the ones from -- Numeric.Interpolation.Basis.Compact but less efficient for -- evaluation. module Numeric.Interpolation.Basis.Full linear :: Num b => [a] -> [T a b] hermite1 :: Num b => [a] -> [T a (b, b)] -- | Interpolation basis functions represented with a minimum of required -- nodes. module Numeric.Interpolation.Basis.Compact linear :: Num b => [a] -> [T a b] hermite1 :: Num b => [a] -> [T a (b, b)] -- | Cubic interpolation where the derivative at a node is set to the slope -- of the two adjacent nodes. cubicLinear :: Fractional a => [a] -> [T a (a, a)] -- | Cubic interpolation where the derivative at a node is set to the slope -- of the parabola through the current and the two adjacent nodes. cubicParabola :: Fractional a => [a] -> [T a (a, a)] -- | Generate lists of basis functions with respect to interpolation nodes -- and generate functions from coefficients with respect to these bases. -- -- A basis function is one where all but one features are zero. E.g. in a -- linear basis a basis function is one at one node, and zero at all the -- other interpolation nodes. -- -- You need the basis functions for setting up the matrix for a linear -- least-squares solver for curve fitting. The solver computes some -- coefficients and in a second step you convert these coefficients to -- the piecewise interpolation function. module Numeric.Interpolation.Basis linear :: Num b => [a] -> [T a b] hermite1 :: Num b => [a] -> [T a (b, b)] -- | Cubic interpolation where the derivative at a node is set to the slope -- of the two adjacent nodes. cubicLinear :: Fractional a => [a] -> [T a (a, a)] -- | Cubic interpolation where the derivative at a node is set to the slope -- of the parabola through the current and the two adjacent nodes. cubicParabola :: Fractional a => [a] -> [T a (a, a)] -- | coefficientsToLinear nodes coefficients creates an -- interpolation function for nodes, where the -- coefficients correspond to the basis functions constructed -- with Basis.linear nodes. coefficientsToLinear :: [a] -> [b] -> T a b -- | Cf. coefficientsToLinear coefficientsToHermite1 :: [a] -> [b] -> T a (b, b) -- | Cf. coefficientsToLinear coefficientsToCubicLinear :: Fractional a => [a] -> [a] -> T a (a, a) -- | Cf. coefficientsToLinear coefficientsToCubicParabola :: Fractional a => [a] -> [a] -> T a (a, a) module Numeric.Interpolation.Piece type T x y ny = (x, ny) -> (x, ny) -> x -> y linear :: Fractional a => T a a a -- | Hermite interpolation with one derivative per node. That is, the -- interpolating polynomial is cubic. hermite1 :: Fractional a => T a a (a, a) module Numeric.Interpolation.Sample type T x y = [x] -> x -> [(Int, y)] linear :: (Fractional a, Ord a) => T a a hermite1 :: (Fractional a, Ord a) => T a a cubicLinear :: (Fractional a, Ord a) => T a a cubicParabola :: (Fractional a, Ord a) => T a a module Numeric.Interpolation.Type data T x y ny Cons :: ([x] -> [y] -> String) -> T x y ny -> Int -> ([x] -> [T x ny]) -> ([x] -> x -> [(Int, y)]) -> ([x] -> [y] -> T x ny) -> (ny -> y) -> T x y ny [ssvFromNodes] :: T x y ny -> [x] -> [y] -> String [interpolatePiece] :: T x y ny -> T x y ny -- | maximum difference of indices of basis functions that overlap plus one [basisOverlap] :: T x y ny -> Int [basisFunctions] :: T x y ny -> [x] -> [T x ny] [sampleBasisFunctions] :: T x y ny -> [x] -> x -> [(Int, y)] [coefficientsToInterpolator] :: T x y ny -> [x] -> [y] -> T x ny [valueFromNode] :: T x y ny -> ny -> y linear :: (Fractional a, Ord a, Show a) => T a a a hermite1 :: (Fractional a, Ord a, Show a) => T a a (a, a) cubicLinear :: (Fractional a, Ord a, Show a) => T a a (a, a) cubicParabola :: (Fractional a, Ord a, Show a) => T a a (a, a) module Numeric.Interpolation.Piecewise -- | It is a checked error to interpolate outside of the range of nodes. interpolate :: Ord x => T x y ny -> T x ny -> x -> y -- | Outside the range of nodes the interpolation function takes the value -- of the respective border. interpolateConstantExt :: Ord x => T x y ny -> T x ny -> x -> y