From a326060dd1cf43bd3050126a9801d97a1d2da7e6 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Wed, 2 Nov 2016 18:55:43 +0100 Subject: provisional fix for interpolation --- packages/gsl/src/Numeric/GSL/Interpolation.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'packages/gsl/src/Numeric/GSL/Interpolation.hs') 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 @@ +{-# LANGUAGE MagicHash, UnboxedTuples #-} + {- | Module : Numeric.GSL.Interpolation Copyright : (c) Matthew Peddie 2015 @@ -40,6 +42,10 @@ import Foreign.Storable(peek) import Numeric.GSL.Internal import System.IO.Unsafe(unsafePerformIO) +-- FIXME +import qualified Data.Vector.Storable as S +import GHC.Base (IO(..), realWorld#) + data InterpolationMethod = Linear | Polynomial | CSpline @@ -59,6 +65,12 @@ methodToInt AkimaPeriodic = 5 dim :: Numeric t => Vector t -> Int dim = size +-- FIXME +appVector f x = unsafeInlinePerformIO (S.unsafeWith x (return . f)) + +unsafeInlinePerformIO (IO f) = case f realWorld# of + (# _, x #) -> x + applyCFun hsname cname fun mth xs ys x | dim xs /= dim ys = error $ "Error: Vectors of unequal sizes " ++ -- cgit v1.2.3