diff options
Diffstat (limited to 'lib/Data')
-rw-r--r-- | lib/Data/Packed/Internal/Common.hs | 4 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 22 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 24 |
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 |
143 | foreign import ccall "asm_finit" finit :: IO () | 143 | foreign import ccall unsafe "asm_finit" finit :: IO () |
144 | 144 | ||
145 | -- | check the error code | 145 | -- | check the error code |
146 | check :: String -> IO CInt -> IO () | 146 | check :: 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 |
161 | foreign import ccall "gsl_strerror" gsl_strerror :: CInt -> IO (Ptr CChar) | 161 | foreign 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 |
164 | mbCatch :: IO x -> IO (Maybe x) | 164 | mbCatch :: 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 | ||
334 | foreign import ccall "transF" ctransF :: TFMFM | 334 | foreign import ccall unsafe "transF" ctransF :: TFMFM |
335 | foreign import ccall "transR" ctransR :: TMM | 335 | foreign import ccall unsafe "transR" ctransR :: TMM |
336 | foreign import ccall "transQ" ctransQ :: TQMQM | 336 | foreign import ccall unsafe "transQ" ctransQ :: TQMQM |
337 | foreign import ccall "transC" ctransC :: TCMCM | 337 | foreign import ccall unsafe "transC" ctransC :: TCMCM |
338 | foreign import ccall "transP" ctransP :: CInt -> CInt -> Ptr () -> CInt -> CInt -> CInt -> Ptr () -> CInt -> IO CInt | 338 | foreign 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 | ||
359 | constantF :: Float -> Int -> Vector Float | 359 | constantF :: Float -> Int -> Vector Float |
360 | constantF = constantAux cconstantF | 360 | constantF = constantAux cconstantF |
361 | foreign import ccall "constantF" cconstantF :: Ptr Float -> TF | 361 | foreign import ccall unsafe "constantF" cconstantF :: Ptr Float -> TF |
362 | 362 | ||
363 | constantR :: Double -> Int -> Vector Double | 363 | constantR :: Double -> Int -> Vector Double |
364 | constantR = constantAux cconstantR | 364 | constantR = constantAux cconstantR |
365 | foreign import ccall "constantR" cconstantR :: Ptr Double -> TV | 365 | foreign import ccall unsafe "constantR" cconstantR :: Ptr Double -> TV |
366 | 366 | ||
367 | constantQ :: Complex Float -> Int -> Vector (Complex Float) | 367 | constantQ :: Complex Float -> Int -> Vector (Complex Float) |
368 | constantQ = constantAux cconstantQ | 368 | constantQ = constantAux cconstantQ |
369 | foreign import ccall "constantQ" cconstantQ :: Ptr (Complex Float) -> TQV | 369 | foreign import ccall unsafe "constantQ" cconstantQ :: Ptr (Complex Float) -> TQV |
370 | 370 | ||
371 | constantC :: Complex Double -> Int -> Vector (Complex Double) | 371 | constantC :: Complex Double -> Int -> Vector (Complex Double) |
372 | constantC = constantAux cconstantC | 372 | constantC = constantAux cconstantC |
373 | foreign import ccall "constantC" cconstantC :: Ptr (Complex Double) -> TCV | 373 | foreign import ccall unsafe "constantC" cconstantC :: Ptr (Complex Double) -> TCV |
374 | 374 | ||
375 | constantP :: Storable a => a -> Int -> Vector a | 375 | constantP :: Storable a => a -> Int -> Vector a |
376 | constantP a n = unsafePerformIO $ do | 376 | constantP 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 |
384 | foreign import ccall "constantP" cconstantP :: Ptr () -> CInt -> Ptr () -> CInt -> IO CInt | 384 | foreign 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 | ||
430 | foreign import ccall "matrix_fprintf" matrix_fprintf :: Ptr CChar -> Ptr CChar -> CInt -> TM | 430 | foreign 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 | ||
311 | foreign import ccall "float2double" c_float2double:: TFV | 311 | foreign import ccall unsafe "float2double" c_float2double:: TFV |
312 | foreign import ccall "double2float" c_double2float:: TVF | 312 | foreign 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 | ||
328 | foreign import ccall "stepF" c_stepF :: TFF | 328 | foreign import ccall unsafe "stepF" c_stepF :: TFF |
329 | foreign import ccall "stepD" c_stepD :: TVV | 329 | foreign 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 | ||
345 | foreign import ccall "condF" c_condF :: CInt -> PF -> CInt -> PF -> CInt -> PF -> TFFF | 345 | foreign import ccall unsafe "condF" c_condF :: CInt -> PF -> CInt -> PF -> CInt -> PF -> TFFF |
346 | foreign import ccall "condD" c_condD :: CInt -> PD -> CInt -> PD -> CInt -> PD -> TVVV | 346 | foreign 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 | ||
355 | conjugateQ :: Vector (Complex Float) -> Vector (Complex Float) | 355 | conjugateQ :: Vector (Complex Float) -> Vector (Complex Float) |
356 | conjugateQ = conjugateAux c_conjugateQ | 356 | conjugateQ = conjugateAux c_conjugateQ |
357 | foreign import ccall "conjugateQ" c_conjugateQ :: TQVQV | 357 | foreign import ccall unsafe "conjugateQ" c_conjugateQ :: TQVQV |
358 | 358 | ||
359 | conjugateC :: Vector (Complex Double) -> Vector (Complex Double) | 359 | conjugateC :: Vector (Complex Double) -> Vector (Complex Double) |
360 | conjugateC = conjugateAux c_conjugateC | 360 | conjugateC = conjugateAux c_conjugateC |
361 | foreign import ccall "conjugateC" c_conjugateC :: TCVCV | 361 | foreign 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 | ||
550 | foreign import ccall "vector_fscanf" gsl_vector_fscanf:: Ptr CChar -> TV | 550 | foreign 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. |
553 | fprintfVector :: FilePath -> String -> Vector Double -> IO () | 553 | fprintfVector :: 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 | ||
561 | foreign import ccall "vector_fprintf" gsl_vector_fprintf :: Ptr CChar -> Ptr CChar -> TV | 561 | foreign 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). |
564 | freadVector :: FilePath -> Int -> IO (Vector Double) | 564 | freadVector :: 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 | ||
572 | foreign import ccall "vector_fread" gsl_vector_fread:: Ptr CChar -> TV | 572 | foreign 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. |
575 | fwriteVector :: FilePath -> Vector Double -> IO () | 575 | fwriteVector :: 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 | ||
581 | foreign import ccall "vector_fwrite" gsl_vector_fwrite :: Ptr CChar -> TV | 581 | foreign import ccall unsafe "vector_fwrite" gsl_vector_fwrite :: Ptr CChar -> TV |
582 | 582 | ||