diff options
Diffstat (limited to 'packages/special/lib/Numeric/GSL/Special/Internal.hsc')
-rw-r--r-- | packages/special/lib/Numeric/GSL/Special/Internal.hsc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/special/lib/Numeric/GSL/Special/Internal.hsc b/packages/special/lib/Numeric/GSL/Special/Internal.hsc index 68ec2f2..d1a9c57 100644 --- a/packages/special/lib/Numeric/GSL/Special/Internal.hsc +++ b/packages/special/lib/Numeric/GSL/Special/Internal.hsc | |||
@@ -20,6 +20,7 @@ Support for Special functions. | |||
20 | 20 | ||
21 | module Numeric.GSL.Special.Internal ( | 21 | module Numeric.GSL.Special.Internal ( |
22 | createSFR, | 22 | createSFR, |
23 | create2SFR, | ||
23 | createSFR_E10, | 24 | createSFR_E10, |
24 | Precision(..), | 25 | Precision(..), |
25 | Gsl_mode_t, | 26 | Gsl_mode_t, |
@@ -79,7 +80,7 @@ instance Storable Gsl_sf_result_e10 where | |||
79 | 80 | ||
80 | 81 | ||
81 | ---------------------------------------------------------------- | 82 | ---------------------------------------------------------------- |
82 | -- | access to a sf_result | 83 | -- | access to one sf_result |
83 | createSFR :: String -> (Ptr a -> IO CInt) -> (Double, Double) | 84 | createSFR :: String -> (Ptr a -> IO CInt) -> (Double, Double) |
84 | createSFR s f = unsafePerformIO $ do | 85 | createSFR s f = unsafePerformIO $ do |
85 | p <- malloc :: IO (Ptr Gsl_sf_result) | 86 | p <- malloc :: IO (Ptr Gsl_sf_result) |
@@ -88,6 +89,18 @@ createSFR s f = unsafePerformIO $ do | |||
88 | free p | 89 | free p |
89 | return (val,err) | 90 | return (val,err) |
90 | 91 | ||
92 | ---------------------------------------------------------------- | ||
93 | -- | access to two sf_result | ||
94 | create2SFR :: String -> (Ptr a -> Ptr a -> IO CInt) -> ((Double, Double),(Double, Double)) | ||
95 | create2SFR s f = unsafePerformIO $ do | ||
96 | p1 <- malloc :: IO (Ptr Gsl_sf_result) | ||
97 | p2 <- malloc :: IO (Ptr Gsl_sf_result) | ||
98 | f (castPtr p1) (castPtr p2) // check s | ||
99 | SF val1 err1 <- peek p1 | ||
100 | SF val2 err2 <- peek p2 | ||
101 | free p1 | ||
102 | free p2 | ||
103 | return ((val1,err1),(val2,err2)) | ||
91 | 104 | ||
92 | --------------------------------------------------------------------- | 105 | --------------------------------------------------------------------- |
93 | -- the sf_result_e10 contains two doubles and the exponent | 106 | -- the sf_result_e10 contains two doubles and the exponent |