From d0eb68801e7c8de0996f6799db5ea691588467fa Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Fri, 23 Dec 2011 14:21:36 +0100 Subject: ok also with ghc-7.0 --- lib/Data/Packed/Internal/Vector.hs | 18 +++++++++++++++++- lib/Numeric/ContainerBoot.hs | 20 ++------------------ lib/Numeric/GSL/Polynomials.hs | 2 ++ 3 files changed, 21 insertions(+), 19 deletions(-) (limited to 'lib') diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index f48c4b2..e85ba6e 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs @@ -23,6 +23,7 @@ module Data.Packed.Internal.Vector ( createVector, vec, asComplex, asReal, float2DoubleV, double2FloatV, stepF, stepD, condF, condD, + conjugateQ, conjugateC, fwriteVector, freadVector, fprintfVector, fscanfVector, cloneVector, unsafeToForeignPtr, @@ -344,7 +345,22 @@ condD x y l e g = unsafePerformIO $ do foreign import ccall "condF" c_condF :: CInt -> PF -> CInt -> PF -> CInt -> PF -> TFFF foreign import ccall "condD" c_condD :: CInt -> PD -> CInt -> PD -> CInt -> PD -> TVVV ----------------------------------------------------------------- +-------------------------------------------------------------------------------- + +conjugateAux fun x = unsafePerformIO $ do + v <- createVector (dim x) + app2 fun vec x vec v "conjugateAux" + return v + +conjugateQ :: Vector (Complex Float) -> Vector (Complex Float) +conjugateQ = conjugateAux c_conjugateQ +foreign import ccall "conjugateQ" c_conjugateQ :: TQVQV + +conjugateC :: Vector (Complex Double) -> Vector (Complex Double) +conjugateC = conjugateAux c_conjugateC +foreign import ccall "conjugateC" c_conjugateC :: TCVCV + +-------------------------------------------------------------------------------- cloneVector :: Storable t => Vector t -> IO (Vector t) cloneVector v = do diff --git a/lib/Numeric/ContainerBoot.hs b/lib/Numeric/ContainerBoot.hs index d913435..6ce4760 100644 --- a/lib/Numeric/ContainerBoot.hs +++ b/lib/Numeric/ContainerBoot.hs @@ -3,7 +3,9 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UndecidableInstances #-} +#ifndef NOPOLYKINDS {-# LANGUAGE PolyKinds #-} +#endif ----------------------------------------------------------------------------- -- | @@ -46,14 +48,11 @@ import Data.Packed.ST as ST import Numeric.Conversion import Data.Packed.Internal import Numeric.GSL.Vector -import Foreign.C.Types(CInt(..)) import Data.Complex import Control.Monad(ap) import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ) -import System.IO.Unsafe - ------------------------------------------------------------------- type family IndexOf c @@ -510,21 +509,6 @@ type instance ElementOf (Matrix a) = a ------------------------------------------------------------ -conjugateAux fun x = unsafePerformIO $ do - v <- createVector (dim x) - app2 fun vec x vec v "conjugateAux" - return v - -conjugateQ :: Vector (Complex Float) -> Vector (Complex Float) -conjugateQ = conjugateAux c_conjugateQ -foreign import ccall "conjugateQ" c_conjugateQ :: TQVQV - -conjugateC :: Vector (Complex Double) -> Vector (Complex Double) -conjugateC = conjugateAux c_conjugateC -foreign import ccall "conjugateC" c_conjugateC :: TCVCV - ------------------------------------------------------ - class Build f where build' :: BoundsOf f -> f -> ContainerOf f diff --git a/lib/Numeric/GSL/Polynomials.hs b/lib/Numeric/GSL/Polynomials.hs index 9d1cf8c..c0318d7 100644 --- a/lib/Numeric/GSL/Polynomials.hs +++ b/lib/Numeric/GSL/Polynomials.hs @@ -19,7 +19,9 @@ module Numeric.GSL.Polynomials ( polySolve ) where +#ifndef ABSTRACTCINT import Foreign.C.Types(CInt(..)) +#endif import Data.Packed.Internal import Data.Complex import System.IO.Unsafe (unsafePerformIO) -- cgit v1.2.3