summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2008-01-21 21:40:07 +0000
committerAlberto Ruiz <aruiz@um.es>2008-01-21 21:40:07 +0000
commit17749900a9146ddf6cd8ebf59dc35e56d6bff413 (patch)
treed352b7b155ebf650cd41a134aeb39450e54163b2 /lib/Data/Packed/Internal
parent4fb0006a2227d3d5293a53b88ef67ce6ebd73440 (diff)
IO CInt results
Diffstat (limited to 'lib/Data/Packed/Internal')
-rw-r--r--lib/Data/Packed/Internal/Common.hs14
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs4
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs
index 7305d8c..72a7e26 100644
--- a/lib/Data/Packed/Internal/Common.hs
+++ b/lib/Data/Packed/Internal/Common.hs
@@ -73,7 +73,7 @@ app4 f w1 o1 w2 o2 w3 o3 w4 o4 s = ww4 w1 o1 w2 o2 w3 o3 w4 o4 $
73 73
74-- GSL error codes are <= 1024 74-- GSL error codes are <= 1024
75-- | error codes for the auxiliary functions required by the wrappers 75-- | error codes for the auxiliary functions required by the wrappers
76errorCode :: Int -> String 76errorCode :: CInt -> String
77errorCode 2000 = "bad size" 77errorCode 2000 = "bad size"
78errorCode 2001 = "bad function code" 78errorCode 2001 = "bad function code"
79errorCode 2002 = "memory problem" 79errorCode 2002 = "memory problem"
@@ -85,7 +85,7 @@ errorCode 2007 = "not yet supported in this OS"
85errorCode n = "code "++show n 85errorCode n = "code "++show n
86 86
87-- | check the error code 87-- | check the error code
88check :: String -> IO Int -> IO () 88check :: String -> IO CInt -> IO ()
89check msg f = do 89check msg f = do
90 err <- f 90 err <- f
91 when (err/=0) $ if err > 1024 91 when (err/=0) $ if err > 1024
@@ -97,7 +97,7 @@ check msg f = do
97 return () 97 return ()
98 98
99-- | description of GSL error codes 99-- | description of GSL error codes
100foreign import ccall "auxi.h gsl_strerror" gsl_strerror :: Int -> IO (Ptr CChar) 100foreign import ccall "auxi.h gsl_strerror" gsl_strerror :: CInt -> IO (Ptr CChar)
101 101
102 102
103{- | conversion of Haskell functions into function pointers that can be used in the C side 103{- | conversion of Haskell functions into function pointers that can be used in the C side
@@ -112,10 +112,10 @@ foreign import ccall "wrapper" mkfun:: (Double -> Ptr() -> Double) -> IO( FunPtr
112------------------------------------------------ 112------------------------------------------------
113type PD = Ptr Double -- 113type PD = Ptr Double --
114type PC = Ptr (Complex Double) -- 114type PC = Ptr (Complex Double) --
115type TV = Int -> PD -> IO Int -- 115type TV = Int -> PD -> IO CInt --
116type TVV = Int -> PD -> TV -- 116type TVV = Int -> PD -> TV --
117type TVVV = Int -> PD -> TVV -- 117type TVVV = Int -> PD -> TVV --
118type TM = Int -> Int -> PD -> IO Int -- 118type TM = Int -> Int -> PD -> IO CInt --
119type TMM = Int -> Int -> PD -> TM -- 119type TMM = Int -> Int -> PD -> TM --
120type TMMM = Int -> Int -> PD -> TMM -- 120type TMMM = Int -> Int -> PD -> TMM --
121type TVM = Int -> PD -> TM -- 121type TVM = Int -> PD -> TM --
@@ -123,7 +123,7 @@ type TVVM = Int -> PD -> TVM --
123type TMV = Int -> Int -> PD -> TV -- 123type TMV = Int -> Int -> PD -> TV --
124type TMVM = Int -> Int -> PD -> TVM -- 124type TMVM = Int -> Int -> PD -> TVM --
125type TMMVM = Int -> Int -> PD -> TMVM -- 125type TMMVM = Int -> Int -> PD -> TMVM --
126type TCM = Int -> Int -> PC -> IO Int -- 126type TCM = Int -> Int -> PC -> IO CInt --
127type TCVCM = Int -> PC -> TCM -- 127type TCVCM = Int -> PC -> TCM --
128type TCMCVCM = Int -> Int -> PC -> TCVCM -- 128type TCMCVCM = Int -> Int -> PC -> TCVCM --
129type TMCMCVCM = Int -> Int -> PD -> TCMCVCM -- 129type TMCMCVCM = Int -> Int -> PD -> TCMCVCM --
@@ -133,7 +133,7 @@ type TVCM = Int -> PD -> TCM --
133type TCMVCM = Int -> Int -> PC -> TVCM -- 133type TCMVCM = Int -> Int -> PC -> TVCM --
134type TCMCMVCM = Int -> Int -> PC -> TCMVCM -- 134type TCMCMVCM = Int -> Int -> PC -> TCMVCM --
135type TCMCMCM = Int -> Int -> PC -> TCMCM -- 135type TCMCMCM = Int -> Int -> PC -> TCMCM --
136type TCV = Int -> PC -> IO Int -- 136type TCV = Int -> PC -> IO CInt --
137type TCVCV = Int -> PC -> TCV -- 137type TCVCV = Int -> PC -> TCV --
138type TCVCVCV = Int -> PC -> TCVCV -- 138type TCVCVCV = Int -> PC -> TCVCV --
139type TCMCV = Int -> Int -> PC -> TCV -- 139type TCMCV = Int -> Int -> PC -> TCV --
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index b0fea51..c20726b 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -281,14 +281,14 @@ foreign import ccall unsafe "auxi.h multiplyR"
281 cmultiplyR :: Int -> Int -> Int -> Ptr Double 281 cmultiplyR :: Int -> Int -> Int -> Ptr Double
282 -> Int -> Int -> Int -> Ptr Double 282 -> Int -> Int -> Int -> Ptr Double
283 -> Int -> Int -> Ptr Double 283 -> Int -> Int -> Ptr Double
284 -> IO Int 284 -> IO CInt
285 285
286multiplyC = multiplyAux cmultiplyC 286multiplyC = multiplyAux cmultiplyC
287foreign import ccall unsafe "auxi.h multiplyC" 287foreign import ccall unsafe "auxi.h multiplyC"
288 cmultiplyC :: Int -> Int -> Int -> Ptr (Complex Double) 288 cmultiplyC :: Int -> Int -> Int -> Ptr (Complex Double)
289 -> Int -> Int -> Int -> Ptr (Complex Double) 289 -> Int -> Int -> Int -> Ptr (Complex Double)
290 -> Int -> Int -> Ptr (Complex Double) 290 -> Int -> Int -> Ptr (Complex Double)
291 -> IO Int 291 -> IO CInt
292 292
293-- | matrix product 293-- | matrix product
294multiply :: (Element a) => Matrix a -> Matrix a -> Matrix a 294multiply :: (Element a) => Matrix a -> Matrix a -> Matrix a