diff options
Diffstat (limited to 'packages/gsl/src/Numeric/GSL/Interpolation.hs')
-rw-r--r-- | packages/gsl/src/Numeric/GSL/Interpolation.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/gsl/src/Numeric/GSL/Interpolation.hs b/packages/gsl/src/Numeric/GSL/Interpolation.hs index 4d72ee2..d060468 100644 --- a/packages/gsl/src/Numeric/GSL/Interpolation.hs +++ b/packages/gsl/src/Numeric/GSL/Interpolation.hs | |||
@@ -32,8 +32,7 @@ module Numeric.GSL.Interpolation ( | |||
32 | , evaluateIntegralV | 32 | , evaluateIntegralV |
33 | ) where | 33 | ) where |
34 | 34 | ||
35 | import Data.Packed.Vector(Vector, fromList, dim) | 35 | import Numeric.LinearAlgebra(Vector, fromList, size, Numeric) |
36 | import Data.Packed.Foreign(appVector) | ||
37 | import Foreign.C.Types | 36 | import Foreign.C.Types |
38 | import Foreign.Marshal.Alloc(alloca) | 37 | import Foreign.Marshal.Alloc(alloca) |
39 | import Foreign.Ptr(Ptr) | 38 | import Foreign.Ptr(Ptr) |
@@ -57,6 +56,9 @@ methodToInt CSplinePeriodic = 3 | |||
57 | methodToInt Akima = 4 | 56 | methodToInt Akima = 4 |
58 | methodToInt AkimaPeriodic = 5 | 57 | methodToInt AkimaPeriodic = 5 |
59 | 58 | ||
59 | dim :: Numeric t => Vector t -> Int | ||
60 | dim = size | ||
61 | |||
60 | applyCFun hsname cname fun mth xs ys x | 62 | applyCFun hsname cname fun mth xs ys x |
61 | | dim xs /= dim ys = error $ | 63 | | dim xs /= dim ys = error $ |
62 | "Error: Vectors of unequal sizes " ++ | 64 | "Error: Vectors of unequal sizes " ++ |
@@ -115,7 +117,7 @@ evaluate :: InterpolationMethod -- ^ What method to use to interpolate | |||
115 | -> Double -- ^ Point at which to evaluate the function | 117 | -> Double -- ^ Point at which to evaluate the function |
116 | -> Double -- ^ Interpolated result | 118 | -> Double -- ^ Interpolated result |
117 | evaluate mth pts = | 119 | evaluate mth pts = |
118 | applyCFun "evaluate" "spline_eval" c_spline_eval_deriv | 120 | applyCFun "evaluate" "spline_eval" c_spline_eval |
119 | mth (fromList xs) (fromList ys) | 121 | mth (fromList xs) (fromList ys) |
120 | where | 122 | where |
121 | (xs, ys) = unzip pts | 123 | (xs, ys) = unzip pts |