summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data/Packed/Internal')
-rw-r--r--lib/Data/Packed/Internal/Common.hs4
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs22
-rw-r--r--lib/Data/Packed/Internal/Vector.hs24
3 files changed, 25 insertions, 25 deletions
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs
index a8c3c3e..49f17b0 100644
--- a/lib/Data/Packed/Internal/Common.hs
+++ b/lib/Data/Packed/Internal/Common.hs
@@ -140,7 +140,7 @@ errorCode n = "code "++show n
140 140
141 141
142-- | clear the fpu 142-- | clear the fpu
143foreign import ccall "asm_finit" finit :: IO () 143foreign import ccall unsafe "asm_finit" finit :: IO ()
144 144
145-- | check the error code 145-- | check the error code
146check :: String -> IO CInt -> IO () 146check :: String -> IO CInt -> IO ()
@@ -158,7 +158,7 @@ check msg f = do
158 return () 158 return ()
159 159
160-- | description of GSL error codes 160-- | description of GSL error codes
161foreign import ccall "gsl_strerror" gsl_strerror :: CInt -> IO (Ptr CChar) 161foreign import ccall unsafe "gsl_strerror" gsl_strerror :: CInt -> IO (Ptr CChar)
162 162
163-- | Error capture and conversion to Maybe 163-- | Error capture and conversion to Maybe
164mbCatch :: IO x -> IO (Maybe x) 164mbCatch :: IO x -> IO (Maybe x)
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index 257e4fc..b8ed18d 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -331,11 +331,11 @@ transdataP c1 d c2 =
331 sz = sizeOf (d @> 0) 331 sz = sizeOf (d @> 0)
332 noneed = r1 == 1 || c1 == 1 332 noneed = r1 == 1 || c1 == 1
333 333
334foreign import ccall "transF" ctransF :: TFMFM 334foreign import ccall unsafe "transF" ctransF :: TFMFM
335foreign import ccall "transR" ctransR :: TMM 335foreign import ccall unsafe "transR" ctransR :: TMM
336foreign import ccall "transQ" ctransQ :: TQMQM 336foreign import ccall unsafe "transQ" ctransQ :: TQMQM
337foreign import ccall "transC" ctransC :: TCMCM 337foreign import ccall unsafe "transC" ctransC :: TCMCM
338foreign import ccall "transP" ctransP :: CInt -> CInt -> Ptr () -> CInt -> CInt -> CInt -> Ptr () -> CInt -> IO CInt 338foreign import ccall unsafe "transP" ctransP :: CInt -> CInt -> Ptr () -> CInt -> CInt -> CInt -> Ptr () -> CInt -> IO CInt
339 339
340---------------------------------------------------------------------- 340----------------------------------------------------------------------
341 341
@@ -358,19 +358,19 @@ constantAux fun x n = unsafePerformIO $ do
358 358
359constantF :: Float -> Int -> Vector Float 359constantF :: Float -> Int -> Vector Float
360constantF = constantAux cconstantF 360constantF = constantAux cconstantF
361foreign import ccall "constantF" cconstantF :: Ptr Float -> TF 361foreign import ccall unsafe "constantF" cconstantF :: Ptr Float -> TF
362 362
363constantR :: Double -> Int -> Vector Double 363constantR :: Double -> Int -> Vector Double
364constantR = constantAux cconstantR 364constantR = constantAux cconstantR
365foreign import ccall "constantR" cconstantR :: Ptr Double -> TV 365foreign import ccall unsafe "constantR" cconstantR :: Ptr Double -> TV
366 366
367constantQ :: Complex Float -> Int -> Vector (Complex Float) 367constantQ :: Complex Float -> Int -> Vector (Complex Float)
368constantQ = constantAux cconstantQ 368constantQ = constantAux cconstantQ
369foreign import ccall "constantQ" cconstantQ :: Ptr (Complex Float) -> TQV 369foreign import ccall unsafe "constantQ" cconstantQ :: Ptr (Complex Float) -> TQV
370 370
371constantC :: Complex Double -> Int -> Vector (Complex Double) 371constantC :: Complex Double -> Int -> Vector (Complex Double)
372constantC = constantAux cconstantC 372constantC = constantAux cconstantC
373foreign import ccall "constantC" cconstantC :: Ptr (Complex Double) -> TCV 373foreign import ccall unsafe "constantC" cconstantC :: Ptr (Complex Double) -> TCV
374 374
375constantP :: Storable a => a -> Int -> Vector a 375constantP :: Storable a => a -> Int -> Vector a
376constantP a n = unsafePerformIO $ do 376constantP a n = unsafePerformIO $ do
@@ -381,7 +381,7 @@ constantP a n = unsafePerformIO $ do
381 poke k a 381 poke k a
382 cconstantP (castPtr k) (fi n) (castPtr p) (fi sz) // check "constantP" 382 cconstantP (castPtr k) (fi n) (castPtr p) (fi sz) // check "constantP"
383 return v 383 return v
384foreign import ccall "constantP" cconstantP :: Ptr () -> CInt -> Ptr () -> CInt -> IO CInt 384foreign import ccall unsafe "constantP" cconstantP :: Ptr () -> CInt -> Ptr () -> CInt -> IO CInt
385 385
386---------------------------------------------------------------------- 386----------------------------------------------------------------------
387 387
@@ -427,7 +427,7 @@ saveMatrix filename fmt m = do
427 free charname 427 free charname
428 free charfmt 428 free charfmt
429 429
430foreign import ccall "matrix_fprintf" matrix_fprintf :: Ptr CChar -> Ptr CChar -> CInt -> TM 430foreign import ccall unsafe "matrix_fprintf" matrix_fprintf :: Ptr CChar -> Ptr CChar -> CInt -> TM
431 431
432---------------------------------------------------------------------- 432----------------------------------------------------------------------
433 433
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs
index 936479d..d3b80ff 100644
--- a/lib/Data/Packed/Internal/Vector.hs
+++ b/lib/Data/Packed/Internal/Vector.hs
@@ -308,8 +308,8 @@ double2FloatV v = unsafePerformIO $ do
308 return r 308 return r
309 309
310 310
311foreign import ccall "float2double" c_float2double:: TFV 311foreign import ccall unsafe "float2double" c_float2double:: TFV
312foreign import ccall "double2float" c_double2float:: TVF 312foreign import ccall unsafe "double2float" c_double2float:: TVF
313 313
314--------------------------------------------------------------- 314---------------------------------------------------------------
315 315
@@ -325,8 +325,8 @@ stepD v = unsafePerformIO $ do
325 app2 c_stepD vec v vec r "stepD" 325 app2 c_stepD vec v vec r "stepD"
326 return r 326 return r
327 327
328foreign import ccall "stepF" c_stepF :: TFF 328foreign import ccall unsafe "stepF" c_stepF :: TFF
329foreign import ccall "stepD" c_stepD :: TVV 329foreign import ccall unsafe "stepD" c_stepD :: TVV
330 330
331--------------------------------------------------------------- 331---------------------------------------------------------------
332 332
@@ -342,8 +342,8 @@ condD x y l e g = unsafePerformIO $ do
342 app6 c_condD vec x vec y vec l vec e vec g vec r "condD" 342 app6 c_condD vec x vec y vec l vec e vec g vec r "condD"
343 return r 343 return r
344 344
345foreign import ccall "condF" c_condF :: CInt -> PF -> CInt -> PF -> CInt -> PF -> TFFF 345foreign import ccall unsafe "condF" c_condF :: CInt -> PF -> CInt -> PF -> CInt -> PF -> TFFF
346foreign import ccall "condD" c_condD :: CInt -> PD -> CInt -> PD -> CInt -> PD -> TVVV 346foreign import ccall unsafe "condD" c_condD :: CInt -> PD -> CInt -> PD -> CInt -> PD -> TVVV
347 347
348-------------------------------------------------------------------------------- 348--------------------------------------------------------------------------------
349 349
@@ -354,11 +354,11 @@ conjugateAux fun x = unsafePerformIO $ do
354 354
355conjugateQ :: Vector (Complex Float) -> Vector (Complex Float) 355conjugateQ :: Vector (Complex Float) -> Vector (Complex Float)
356conjugateQ = conjugateAux c_conjugateQ 356conjugateQ = conjugateAux c_conjugateQ
357foreign import ccall "conjugateQ" c_conjugateQ :: TQVQV 357foreign import ccall unsafe "conjugateQ" c_conjugateQ :: TQVQV
358 358
359conjugateC :: Vector (Complex Double) -> Vector (Complex Double) 359conjugateC :: Vector (Complex Double) -> Vector (Complex Double)
360conjugateC = conjugateAux c_conjugateC 360conjugateC = conjugateAux c_conjugateC
361foreign import ccall "conjugateC" c_conjugateC :: TCVCV 361foreign import ccall unsafe "conjugateC" c_conjugateC :: TCVCV
362 362
363-------------------------------------------------------------------------------- 363--------------------------------------------------------------------------------
364 364
@@ -547,7 +547,7 @@ fscanfVector filename n = do
547 free charname 547 free charname
548 return res 548 return res
549 549
550foreign import ccall "vector_fscanf" gsl_vector_fscanf:: Ptr CChar -> TV 550foreign import ccall unsafe "vector_fscanf" gsl_vector_fscanf:: Ptr CChar -> TV
551 551
552-- | Saves the elements of a vector, with a given format (%f, %e, %g), to an ASCII file. 552-- | Saves the elements of a vector, with a given format (%f, %e, %g), to an ASCII file.
553fprintfVector :: FilePath -> String -> Vector Double -> IO () 553fprintfVector :: FilePath -> String -> Vector Double -> IO ()
@@ -558,7 +558,7 @@ fprintfVector filename fmt v = do
558 free charname 558 free charname
559 free charfmt 559 free charfmt
560 560
561foreign import ccall "vector_fprintf" gsl_vector_fprintf :: Ptr CChar -> Ptr CChar -> TV 561foreign import ccall unsafe "vector_fprintf" gsl_vector_fprintf :: Ptr CChar -> Ptr CChar -> TV
562 562
563-- | Loads a vector from a binary file (the number of elements must be known in advance). 563-- | Loads a vector from a binary file (the number of elements must be known in advance).
564freadVector :: FilePath -> Int -> IO (Vector Double) 564freadVector :: FilePath -> Int -> IO (Vector Double)
@@ -569,7 +569,7 @@ freadVector filename n = do
569 free charname 569 free charname
570 return res 570 return res
571 571
572foreign import ccall "vector_fread" gsl_vector_fread:: Ptr CChar -> TV 572foreign import ccall unsafe "vector_fread" gsl_vector_fread:: Ptr CChar -> TV
573 573
574-- | Saves the elements of a vector to a binary file. 574-- | Saves the elements of a vector to a binary file.
575fwriteVector :: FilePath -> Vector Double -> IO () 575fwriteVector :: FilePath -> Vector Double -> IO ()
@@ -578,5 +578,5 @@ fwriteVector filename v = do
578 app1 (gsl_vector_fwrite charname) vec v "gsl_vector_fwrite" 578 app1 (gsl_vector_fwrite charname) vec v "gsl_vector_fwrite"
579 free charname 579 free charname
580 580
581foreign import ccall "vector_fwrite" gsl_vector_fwrite :: Ptr CChar -> TV 581foreign import ccall unsafe "vector_fwrite" gsl_vector_fwrite :: Ptr CChar -> TV
582 582