{-# LANGUAGE Rank2Types #-}
module Numeric.AD.Mode.Tower
( AD
, Tower
, auto
, taylor
, taylor0
, maclaurin
, maclaurin0
, diff
, diff'
, diffs
, diffs0
, diffsF
, diffs0F
, du
, du'
, dus
, dus0
, duF
, duF'
, dusF
, dus0F
) where
import qualified Numeric.AD.Rank1.Tower as Rank1
import Numeric.AD.Internal.Tower (Tower)
import Numeric.AD.Internal.Type (AD(..))
import Numeric.AD.Mode
diffs :: Num a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> [a]
diffs f = Rank1.diffs (runAD.f.AD)
{-# INLINE diffs #-}
diffs0 :: Num a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> [a]
diffs0 f = Rank1.diffs0 (runAD.f.AD)
{-# INLINE diffs0 #-}
diffsF :: (Functor f, Num a) => (forall s. AD s (Tower a) -> f (AD s (Tower a))) -> a -> f [a]
diffsF f = Rank1.diffsF (fmap runAD.f.AD)
{-# INLINE diffsF #-}
diffs0F :: (Functor f, Num a) => (forall s. AD s (Tower a) -> f (AD s (Tower a))) -> a -> f [a]
diffs0F f = Rank1.diffs0F (fmap runAD.f.AD)
{-# INLINE diffs0F #-}
taylor :: Fractional a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> a -> [a]
taylor f = Rank1.taylor (runAD.f.AD)
taylor0 :: Fractional a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> a -> [a]
taylor0 f = Rank1.taylor0 (runAD.f.AD)
{-# INLINE taylor0 #-}
maclaurin :: Fractional a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> [a]
maclaurin f = Rank1.maclaurin (runAD.f.AD)
{-# INLINE maclaurin #-}
maclaurin0 :: Fractional a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> [a]
maclaurin0 f = Rank1.maclaurin0 (runAD.f.AD)
{-# INLINE maclaurin0 #-}
diff :: Num a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> a
diff f = Rank1.diff (runAD.f.AD)
{-# INLINE diff #-}
diff' :: Num a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> (a, a)
diff' f = Rank1.diff' (runAD.f.AD)
{-# INLINE diff' #-}
du :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f (a, a) -> a
du f = Rank1.du (runAD.f. fmap AD)
{-# INLINE du #-}
du' :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f (a, a) -> (a, a)
du' f = Rank1.du' (runAD.f.fmap AD)
{-# INLINE du' #-}
duF :: (Functor f, Functor g, Num a) => (forall s. f (AD s (Tower a)) -> g (AD s (Tower a))) -> f (a, a) -> g a
duF f = Rank1.duF (fmap runAD.f.fmap AD)
{-# INLINE duF #-}
duF' :: (Functor f, Functor g, Num a) => (forall s. f (AD s (Tower a)) -> g (AD s (Tower a))) -> f (a, a) -> g (a, a)
duF' f = Rank1.duF' (fmap runAD.f.fmap AD)
{-# INLINE duF' #-}
dus :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f [a] -> [a]
dus f = Rank1.dus (runAD.f.fmap AD)
{-# INLINE dus #-}
dus0 :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f [a] -> [a]
dus0 f = Rank1.dus0 (runAD.f.fmap AD)
{-# INLINE dus0 #-}
dusF :: (Functor f, Functor g, Num a) => (forall s. f (AD s (Tower a)) -> g (AD s (Tower a))) -> f [a] -> g [a]
dusF f = Rank1.dusF (fmap runAD.f.fmap AD)
{-# INLINE dusF #-}
dus0F :: (Functor f, Functor g, Num a) => (forall s. f (AD s (Tower a)) -> g (AD s (Tower a))) -> f [a] -> g [a]
dus0F f = Rank1.dus0F (fmap runAD.f.fmap AD)
{-# INLINE dus0F #-}