Portability | portable |
---|---|
Stability | experimental |
Maintainer | Aleksey Khudyakov <alexey.skladnoy@gmail.com> |
Safe Haskell | None |
Function interpolation.
Sine interpolation using cubic splines:
>>>
let tbl = cubicSpline $ tabulateFun (uniformMesh (0,10) 100) sin
>>>
tbl `at` 1.786
0.9769239849844867
- class (IndexVal (interp mesh) ~ (Double, Double), Indexable (interp mesh), IndexVal mesh ~ Double, Mesh mesh) => Interpolation interp mesh where
- at :: interp mesh -> Double -> Double
- unsafeTabulate :: Vector v Double => mesh -> v Double -> interp mesh
- interpolationMesh :: interp mesh -> mesh
- interpolationTable :: interp mesh -> Vector Double
- tabulate :: (Interpolation i m, Vector v Double) => m -> v Double -> i m
- tabulateFun :: Interpolation i m => m -> (Double -> Double) -> i m
- data LinearInterp mesh
- linearInterp :: LinearInterp mesh -> LinearInterp mesh
- data CubicSpline a
- cubicSpline :: CubicSpline a -> CubicSpline a
- module Numeric.Tools.Mesh
- defaultInterpSize :: Interpolation i m => i m -> Int
- defaultInterpIndex :: Interpolation i m => i m -> Int -> (Double, Double)
Type class
class (IndexVal (interp mesh) ~ (Double, Double), Indexable (interp mesh), IndexVal mesh ~ Double, Mesh mesh) => Interpolation interp mesh whereSource
Type class for Interpolation algorithms. Since some algorithms
require some particular mesh type it's present as type class
parameter. Every algorithms should be instance of Indexable
as
well. Indexing should return pair (x,y)
for u'th mesh node.
at :: interp mesh -> Double -> DoubleSource
Interpolate function at some point. Function should not fail outside of mesh however it may and most likely will give nonsensical results
unsafeTabulate :: Vector v Double => mesh -> v Double -> interp meshSource
Use table of already evaluated function and mesh. Sizes of mesh
and table must coincide but it's not checked. Do not use this
function use tabulate
instead.
interpolationMesh :: interp mesh -> meshSource
Get mesh.
interpolationTable :: interp mesh -> Vector DoubleSource
Get table of function values
(Mesh mesh, ~ * (IndexVal mesh) Double) => Interpolation CubicSpline mesh | |
(Mesh mesh, ~ * (IndexVal mesh) Double) => Interpolation LinearInterp mesh |
tabulate :: (Interpolation i m, Vector v Double) => m -> v Double -> i mSource
Use table of already evaluated function and mesh. Sizes of mesh and table must coincide.
tabulateFun :: Interpolation i m => m -> (Double -> Double) -> i mSource
Tabulate function.
Linear interpolation
data LinearInterp mesh Source
Data for linear interpolation
Typeable1 LinearInterp | |
(Mesh mesh, ~ * (IndexVal mesh) Double) => Interpolation LinearInterp mesh | |
Eq mesh => Eq (LinearInterp mesh) | |
Data mesh => Data (LinearInterp mesh) | |
Show mesh => Show (LinearInterp mesh) | |
(Mesh mesh, ~ * (IndexVal mesh) Double) => Indexable (LinearInterp mesh) |
linearInterp :: LinearInterp mesh -> LinearInterp meshSource
Function used to fix types
Cubic splines
data CubicSpline a Source
Natural cubic splines
Typeable1 CubicSpline | |
(Mesh mesh, ~ * (IndexVal mesh) Double) => Interpolation CubicSpline mesh | |
Eq a => Eq (CubicSpline a) | |
Data a => Data (CubicSpline a) | |
Show a => Show (CubicSpline a) | |
(Mesh mesh, ~ * (IndexVal mesh) Double) => Indexable (CubicSpline mesh) |
cubicSpline :: CubicSpline a -> CubicSpline aSource
Function used to fix types
Reexport of mesh type
module Numeric.Tools.Mesh
Default methods
defaultInterpSize :: Interpolation i m => i m -> IntSource
Default implementation of size
for interpolation algorithms.
defaultInterpIndex :: Interpolation i m => i m -> Int -> (Double, Double)Source
Default implementation of unsafeIndex
for interpolation algorithms.