summaryrefslogtreecommitdiff
path: root/packages/special/lib/Numeric/GSL/Special/Elljac.hs
blob: 555e3ffabd67edf436bafb8d27f9a6e37393da5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
------------------------------------------------------------
-- |
-- Module      :  Numeric.GSL.Special.Elljac
-- Copyright   :  (c) Alberto Ruiz 2006
-- License     :  GPL
-- Maintainer  :  Alberto Ruiz (aruiz at um dot es)
-- Stability   :  provisional
-- Portability :  uses ffi
--
-- Wrappers for selected functions described at:
--
-- <http://www.google.com/search?q=gsl_sf_elljac.h&as_sitesearch=www.gnu.org/software/gsl/manual&btnI=Lucky>
------------------------------------------------------------

module Numeric.GSL.Special.Elljac(
elljac_e
) where

import System.IO.Unsafe
import Foreign.Ptr
import Foreign.Storable
import Foreign.Marshal
import Foreign.C.Types

elljac_e :: Double -> Double -> (Double,Double,Double)
elljac_e u m = unsafePerformIO $ do
    psn <- malloc
    pcn <- malloc
    pdn <- malloc
    res <- gsl_sf_elljac_e u m psn pcn pdn
    sn <- peek psn
    cn <- peek pcn
    dn <- peek pdn
    free psn
    free pcn
    free pdn
    if res == 0 then return (sn,cn,dn)
                else error $ "error code "++show res++
                             " in elljac_e "++show u++" "++show m

foreign import ccall unsafe "gsl_sf_elljac_e" gsl_sf_elljac_e :: Double -> Double -> Ptr Double -> Ptr Double -> Ptr Double -> IO CInt