diff options
author | Alberto Ruiz <aruiz@um.es> | 2015-06-19 13:55:39 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2015-06-19 13:55:39 +0200 |
commit | db50bc11dafa6834a4367427156306674063ed6b (patch) | |
tree | 721e9d0235168be1d0ebb2bd1dd254a66251f274 /packages/gsl/src/Numeric/GSL/Vector.hs | |
parent | 7f9c7b5adf8f05653d15f19358f41c1916e8db70 (diff) |
removed the annoying appN adapter for the foreign functions.
replaced by several overloaded app variants in the style of
the module Internal.Foreign contributed by Mike Ledger.
Diffstat (limited to 'packages/gsl/src/Numeric/GSL/Vector.hs')
-rw-r--r-- | packages/gsl/src/Numeric/GSL/Vector.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/gsl/src/Numeric/GSL/Vector.hs b/packages/gsl/src/Numeric/GSL/Vector.hs index 0cd99eb..fb982c5 100644 --- a/packages/gsl/src/Numeric/GSL/Vector.hs +++ b/packages/gsl/src/Numeric/GSL/Vector.hs | |||
@@ -34,7 +34,7 @@ randomVector :: Int -- ^ seed | |||
34 | -> Vector Double | 34 | -> Vector Double |
35 | randomVector seed dist n = unsafePerformIO $ do | 35 | randomVector seed dist n = unsafePerformIO $ do |
36 | r <- createVector n | 36 | r <- createVector n |
37 | app1 (c_random_vector_GSL (fi seed) ((fi.fromEnum) dist)) vec r "randomVectorGSL" | 37 | c_random_vector_GSL (fi seed) ((fi.fromEnum) dist) # r #|"randomVectorGSL" |
38 | return r | 38 | return r |
39 | 39 | ||
40 | foreign import ccall unsafe "random_vector_GSL" c_random_vector_GSL :: CInt -> CInt -> TV | 40 | foreign import ccall unsafe "random_vector_GSL" c_random_vector_GSL :: CInt -> CInt -> TV |
@@ -50,7 +50,7 @@ saveMatrix filename fmt m = do | |||
50 | charname <- newCString filename | 50 | charname <- newCString filename |
51 | charfmt <- newCString fmt | 51 | charfmt <- newCString fmt |
52 | let o = if orderOf m == RowMajor then 1 else 0 | 52 | let o = if orderOf m == RowMajor then 1 else 0 |
53 | app1 (matrix_fprintf charname charfmt o) mat m "matrix_fprintf" | 53 | matrix_fprintf charname charfmt o # m #|"matrix_fprintf" |
54 | free charname | 54 | free charname |
55 | free charfmt | 55 | free charfmt |
56 | 56 | ||
@@ -63,7 +63,7 @@ fscanfVector :: FilePath -> Int -> IO (Vector Double) | |||
63 | fscanfVector filename n = do | 63 | fscanfVector filename n = do |
64 | charname <- newCString filename | 64 | charname <- newCString filename |
65 | res <- createVector n | 65 | res <- createVector n |
66 | app1 (gsl_vector_fscanf charname) vec res "gsl_vector_fscanf" | 66 | gsl_vector_fscanf charname # res #|"gsl_vector_fscanf" |
67 | free charname | 67 | free charname |
68 | return res | 68 | return res |
69 | 69 | ||
@@ -74,7 +74,7 @@ fprintfVector :: FilePath -> String -> Vector Double -> IO () | |||
74 | fprintfVector filename fmt v = do | 74 | fprintfVector filename fmt v = do |
75 | charname <- newCString filename | 75 | charname <- newCString filename |
76 | charfmt <- newCString fmt | 76 | charfmt <- newCString fmt |
77 | app1 (gsl_vector_fprintf charname charfmt) vec v "gsl_vector_fprintf" | 77 | gsl_vector_fprintf charname charfmt # v #|"gsl_vector_fprintf" |
78 | free charname | 78 | free charname |
79 | free charfmt | 79 | free charfmt |
80 | 80 | ||
@@ -85,7 +85,7 @@ freadVector :: FilePath -> Int -> IO (Vector Double) | |||
85 | freadVector filename n = do | 85 | freadVector filename n = do |
86 | charname <- newCString filename | 86 | charname <- newCString filename |
87 | res <- createVector n | 87 | res <- createVector n |
88 | app1 (gsl_vector_fread charname) vec res "gsl_vector_fread" | 88 | gsl_vector_fread charname # res #|"gsl_vector_fread" |
89 | free charname | 89 | free charname |
90 | return res | 90 | return res |
91 | 91 | ||
@@ -95,7 +95,7 @@ foreign import ccall unsafe "vector_fread" gsl_vector_fread:: Ptr CChar -> TV | |||
95 | fwriteVector :: FilePath -> Vector Double -> IO () | 95 | fwriteVector :: FilePath -> Vector Double -> IO () |
96 | fwriteVector filename v = do | 96 | fwriteVector filename v = do |
97 | charname <- newCString filename | 97 | charname <- newCString filename |
98 | app1 (gsl_vector_fwrite charname) vec v "gsl_vector_fwrite" | 98 | gsl_vector_fwrite charname # v #|"gsl_vector_fwrite" |
99 | free charname | 99 | free charname |
100 | 100 | ||
101 | foreign import ccall unsafe "vector_fwrite" gsl_vector_fwrite :: Ptr CChar -> TV | 101 | foreign import ccall unsafe "vector_fwrite" gsl_vector_fwrite :: Ptr CChar -> TV |