Copyright | (c) 2011 diagrams-lib team (see LICENSE) |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | diagrams-discuss@googlegroups.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A cubic spline is a smooth, connected sequence of cubic curves passing through a given sequence of points. This module implements a straightforward spline generation algorithm based on solving tridiagonal systems of linear equations.
- solveTriDiagonal :: Fractional a => [a] -> [a] -> [a] -> [a] -> [a]
- solveCyclicTriDiagonal :: Fractional a => [a] -> [a] -> [a] -> [a] -> a -> a -> [a]
- solveCubicSplineDerivatives :: Fractional a => [a] -> [a]
- solveCubicSplineDerivativesClosed :: Fractional a => [a] -> [a]
- solveCubicSplineCoefficients :: Fractional a => Bool -> [a] -> [[a]]
Solving for spline coefficents
solveTriDiagonal :: Fractional a => [a] -> [a] -> [a] -> [a] -> [a] Source
Solves a system of the form 'A*X=D' for x
where A
is an
n
by n
matrix with bs
as the main diagonal and
as
the diagonal below and cs
the diagonal above.
See: http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm
solveCyclicTriDiagonal :: Fractional a => [a] -> [a] -> [a] -> [a] -> a -> a -> [a] Source
Solves a system similar to the tri-diagonal system using a special case
of the Sherman-Morrison formula http://en.wikipedia.org/wiki/Sherman-Morrison_formula.
This code is based on Numerical Recpies in C's cyclic
function in section 2.7.
solveCubicSplineDerivatives :: Fractional a => [a] -> [a] Source
Use the tri-diagonal solver with the appropriate parameters for an open cubic spline.
solveCubicSplineDerivativesClosed :: Fractional a => [a] -> [a] Source
Use the cyclic-tri-diagonal solver with the appropriate parameters for a closed cubic spline.
solveCubicSplineCoefficients :: Fractional a => Bool -> [a] -> [[a]] Source
Use the cyclic-tri-diagonal solver with the appropriate parameters for a closed cubic spline.