diff options
Diffstat (limited to 'packages/gsl/src')
-rw-r--r-- | packages/gsl/src/Numeric/GSL/Interpolation.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/gsl/src/Numeric/GSL/Interpolation.hs b/packages/gsl/src/Numeric/GSL/Interpolation.hs index d060468..6f02405 100644 --- a/packages/gsl/src/Numeric/GSL/Interpolation.hs +++ b/packages/gsl/src/Numeric/GSL/Interpolation.hs | |||
@@ -1,3 +1,5 @@ | |||
1 | {-# LANGUAGE MagicHash, UnboxedTuples #-} | ||
2 | |||
1 | {- | | 3 | {- | |
2 | Module : Numeric.GSL.Interpolation | 4 | Module : Numeric.GSL.Interpolation |
3 | Copyright : (c) Matthew Peddie 2015 | 5 | Copyright : (c) Matthew Peddie 2015 |
@@ -40,6 +42,10 @@ import Foreign.Storable(peek) | |||
40 | import Numeric.GSL.Internal | 42 | import Numeric.GSL.Internal |
41 | import System.IO.Unsafe(unsafePerformIO) | 43 | import System.IO.Unsafe(unsafePerformIO) |
42 | 44 | ||
45 | -- FIXME | ||
46 | import qualified Data.Vector.Storable as S | ||
47 | import GHC.Base (IO(..), realWorld#) | ||
48 | |||
43 | data InterpolationMethod = Linear | 49 | data InterpolationMethod = Linear |
44 | | Polynomial | 50 | | Polynomial |
45 | | CSpline | 51 | | CSpline |
@@ -59,6 +65,12 @@ methodToInt AkimaPeriodic = 5 | |||
59 | dim :: Numeric t => Vector t -> Int | 65 | dim :: Numeric t => Vector t -> Int |
60 | dim = size | 66 | dim = size |
61 | 67 | ||
68 | -- FIXME | ||
69 | appVector f x = unsafeInlinePerformIO (S.unsafeWith x (return . f)) | ||
70 | |||
71 | unsafeInlinePerformIO (IO f) = case f realWorld# of | ||
72 | (# _, x #) -> x | ||
73 | |||
62 | applyCFun hsname cname fun mth xs ys x | 74 | applyCFun hsname cname fun mth xs ys x |
63 | | dim xs /= dim ys = error $ | 75 | | dim xs /= dim ys = error $ |
64 | "Error: Vectors of unequal sizes " ++ | 76 | "Error: Vectors of unequal sizes " ++ |