{-# LINE 1 "src/Data/Number/Flint/Bernoulli/FFI.hsc" #-}
module Data.Number.Flint.Bernoulli.FFI (
BernoulliRev (..)
, CBernoulliRev (..)
, newBernoulliRev
, withBernoulliRev
, withNewBernoulliRev
, bernoulli_rev_init
, bernoulli_rev_next
, bernoulli_rev_clear
, bernoulli_fmpq_vec_no_cache
, bernoulli_cache_compute
, bernoulli_bound_2exp_si
, bernoulli_mod_p_harvey
, _bernoulli_fmpq_ui_zeta
, _bernoulli_fmpq_ui_multi_mod
, _bernoulli_fmpq_ui
, bernoulli_fmpq_ui
) where
import Foreign.Ptr
import Foreign.ForeignPtr
import Foreign.C.Types
import Foreign.Storable
import Data.Number.Flint.Flint
import Data.Number.Flint.Fmpz
import Data.Number.Flint.Fmpq
import Data.Number.Flint.Arb.Types
import Data.Number.Flint.Acb.Types
data BernoulliRev = BernoulliRev {-# UNPACK #-} !(ForeignPtr CBernoulliRev)
type CBernoulliRev = CFlint BernoulliRev
instance Storable CBernoulliRev where
sizeOf :: CBernoulliRev -> Int
sizeOf CBernoulliRev
_ = (Int
144)
{-# LINE 54 "src/Data/Number/Flint/Bernoulli/FFI.hsc" #-}
alignment _ = 8
{-# LINE 55 "src/Data/Number/Flint/Bernoulli/FFI.hsc" #-}
peek = error "CBernoulliRev.peek: not implemented."
poke :: Ptr CBernoulliRev -> CBernoulliRev -> IO ()
poke = forall a. HasCallStack => [Char] -> a
error [Char]
"CBernoulliRev.poke: not implemented."
newBernoulliRev :: CULong -> IO BernoulliRev
newBernoulliRev CULong
n = do
ForeignPtr CBernoulliRev
x <- forall a. Storable a => IO (ForeignPtr a)
mallocForeignPtr
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr CBernoulliRev
x forall a b. (a -> b) -> a -> b
$ \Ptr CBernoulliRev
x -> do
Ptr CBernoulliRev -> CULong -> IO ()
bernoulli_rev_init Ptr CBernoulliRev
x CULong
n
forall a. FinalizerPtr a -> ForeignPtr a -> IO ()
addForeignPtrFinalizer FunPtr (Ptr CBernoulliRev -> IO ())
p_bernoulli_rev_clear ForeignPtr CBernoulliRev
x
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ ForeignPtr CBernoulliRev -> BernoulliRev
BernoulliRev ForeignPtr CBernoulliRev
x
withBernoulliRev :: BernoulliRev -> (Ptr CBernoulliRev -> IO a) -> IO (BernoulliRev, a)
withBernoulliRev (BernoulliRev ForeignPtr CBernoulliRev
x) Ptr CBernoulliRev -> IO a
f = do
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr CBernoulliRev
x forall a b. (a -> b) -> a -> b
$ \Ptr CBernoulliRev
xp -> (ForeignPtr CBernoulliRev -> BernoulliRev
BernoulliRev ForeignPtr CBernoulliRev
x,) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr CBernoulliRev -> IO a
f Ptr CBernoulliRev
xp
withNewBernoulliRev :: CULong -> (Ptr CBernoulliRev -> IO a) -> IO (BernoulliRev, a)
withNewBernoulliRev CULong
n Ptr CBernoulliRev -> IO a
f = do
BernoulliRev
x <- CULong -> IO BernoulliRev
newBernoulliRev CULong
n
forall {a}.
BernoulliRev -> (Ptr CBernoulliRev -> IO a) -> IO (BernoulliRev, a)
withBernoulliRev BernoulliRev
x Ptr CBernoulliRev -> IO a
f
foreign import ccall "bernoulli.h bernoulli_rev_init"
bernoulli_rev_init :: Ptr CBernoulliRev -> CULong -> IO ()
foreign import ccall "bernoulli.h bernoulli_rev_next"
bernoulli_rev_next :: Ptr CFmpz -> Ptr CFmpz -> Ptr CBernoulliRev -> IO ()
foreign import ccall "bernoulli.h bernoulli_rev_clear"
bernoulli_rev_clear :: Ptr CBernoulliRev -> IO ()
foreign import ccall "bernoulli.h &bernoulli_rev_clear"
p_bernoulli_rev_clear :: FunPtr (Ptr CBernoulliRev -> IO ())
foreign import ccall "bernoulli.h bernoulli_fmpq_vec_no_cache"
bernoulli_fmpq_vec_no_cache :: Ptr CFmpq -> CULong -> CLong -> IO ()
foreign import ccall "bernoulli.h bernoulli_cache_compute"
bernoulli_cache_compute :: CLong -> IO ()
foreign import ccall "bernoulli.h bernoulli_bound_2exp_si"
bernoulli_bound_2exp_si :: CULong -> IO CLong
foreign import ccall "bernoulli.h bernoulli_mod_p_harvey"
bernoulli_mod_p_harvey :: CULong -> CULong -> IO CULong
foreign import ccall "bernoulli.h _bernoulli_fmpq_ui_zeta"
_bernoulli_fmpq_ui_zeta :: Ptr CFmpz -> Ptr CFmpz -> CULong -> IO ()
foreign import ccall "bernoulli.h _bernoulli_fmpq_ui_multi_mod"
_bernoulli_fmpq_ui_multi_mod :: Ptr CFmpz -> Ptr CFmpz -> CULong
-> CDouble -> IO ()
foreign import ccall "bernoulli.h _bernoulli_fmpq_ui"
_bernoulli_fmpq_ui :: Ptr CFmpz -> Ptr CFmpz -> CULong -> IO ()
foreign import ccall "bernoulli.h bernoulli_fmpq_ui"
bernoulli_fmpq_ui :: Ptr CFmpq -> CULong -> IO ()