ad-4.3.5: Automatic Differentiation

Copyright (c) Edward Kmett 2010-2015 BSD3 ekmett@gmail.com experimental GHC only None Haskell2010

Numeric.AD.Internal.Dense

Description

Dense Forward AD. Useful when the result involves the majority of the input elements. Do not use for hessian and beyond, since they only contain a small number of unique nth derivatives -- (n + k - 1) choose k for functions of k inputs rather than the k^n that would be generated by using Dense, not to mention the redundant intermediate derivatives that would be calculated over and over during that process!

Assumes all instances of f have the same number of elements.

NB: We don't need the full power of Traversable here, we could get by with a notion of zippable that can plug in 0's for the missing entries. This might allow for gradients where f has exponentials like ((->) a)

# Documentation

data Dense f a Source #

Constructors

 Lift !a Dense !a (f a) Zero

Instances

 (Traversable f, Num a, Bounded a) => Bounded (Dense f a) # MethodsminBound :: Dense f a #maxBound :: Dense f a # (Traversable f, Num a, Enum a) => Enum (Dense f a) # Methodssucc :: Dense f a -> Dense f a #pred :: Dense f a -> Dense f a #toEnum :: Int -> Dense f a #fromEnum :: Dense f a -> Int #enumFrom :: Dense f a -> [Dense f a] #enumFromThen :: Dense f a -> Dense f a -> [Dense f a] #enumFromTo :: Dense f a -> Dense f a -> [Dense f a] #enumFromThenTo :: Dense f a -> Dense f a -> Dense f a -> [Dense f a] # (Traversable f, Num a, Eq a) => Eq (Dense f a) # Methods(==) :: Dense f a -> Dense f a -> Bool #(/=) :: Dense f a -> Dense f a -> Bool # (Traversable f, Floating a) => Floating (Dense f a) # Methodspi :: Dense f a #exp :: Dense f a -> Dense f a #log :: Dense f a -> Dense f a #sqrt :: Dense f a -> Dense f a #(**) :: Dense f a -> Dense f a -> Dense f a #logBase :: Dense f a -> Dense f a -> Dense f a #sin :: Dense f a -> Dense f a #cos :: Dense f a -> Dense f a #tan :: Dense f a -> Dense f a #asin :: Dense f a -> Dense f a #acos :: Dense f a -> Dense f a #atan :: Dense f a -> Dense f a #sinh :: Dense f a -> Dense f a #cosh :: Dense f a -> Dense f a #tanh :: Dense f a -> Dense f a #asinh :: Dense f a -> Dense f a #acosh :: Dense f a -> Dense f a #atanh :: Dense f a -> Dense f a #log1p :: Dense f a -> Dense f a #expm1 :: Dense f a -> Dense f a #log1pexp :: Dense f a -> Dense f a #log1mexp :: Dense f a -> Dense f a # (Traversable f, Fractional a) => Fractional (Dense f a) # Methods(/) :: Dense f a -> Dense f a -> Dense f a #recip :: Dense f a -> Dense f a #fromRational :: Rational -> Dense f a # (Traversable f, Num a) => Num (Dense f a) # Methods(+) :: Dense f a -> Dense f a -> Dense f a #(-) :: Dense f a -> Dense f a -> Dense f a #(*) :: Dense f a -> Dense f a -> Dense f a #negate :: Dense f a -> Dense f a #abs :: Dense f a -> Dense f a #signum :: Dense f a -> Dense f a #fromInteger :: Integer -> Dense f a # (Traversable f, Num a, Ord a) => Ord (Dense f a) # Methodscompare :: Dense f a -> Dense f a -> Ordering #(<) :: Dense f a -> Dense f a -> Bool #(<=) :: Dense f a -> Dense f a -> Bool #(>) :: Dense f a -> Dense f a -> Bool #(>=) :: Dense f a -> Dense f a -> Bool #max :: Dense f a -> Dense f a -> Dense f a #min :: Dense f a -> Dense f a -> Dense f a # (Traversable f, Real a) => Real (Dense f a) # MethodstoRational :: Dense f a -> Rational # (Traversable f, RealFloat a) => RealFloat (Dense f a) # MethodsfloatRadix :: Dense f a -> Integer #floatDigits :: Dense f a -> Int #floatRange :: Dense f a -> (Int, Int) #decodeFloat :: Dense f a -> (Integer, Int) #encodeFloat :: Integer -> Int -> Dense f a #exponent :: Dense f a -> Int #significand :: Dense f a -> Dense f a #scaleFloat :: Int -> Dense f a -> Dense f a #isNaN :: Dense f a -> Bool #isInfinite :: Dense f a -> Bool #isDenormalized :: Dense f a -> Bool #isNegativeZero :: Dense f a -> Bool #isIEEE :: Dense f a -> Bool #atan2 :: Dense f a -> Dense f a -> Dense f a # (Traversable f, RealFrac a) => RealFrac (Dense f a) # MethodsproperFraction :: Integral b => Dense f a -> (b, Dense f a) #truncate :: Integral b => Dense f a -> b #round :: Integral b => Dense f a -> b #ceiling :: Integral b => Dense f a -> b #floor :: Integral b => Dense f a -> b # Show a => Show (Dense f a) Source # MethodsshowsPrec :: Int -> Dense f a -> ShowS #show :: Dense f a -> String #showList :: [Dense f a] -> ShowS # (Traversable f, Erf a) => Erf (Dense f a) # Methodserf :: Dense f a -> Dense f a #erfc :: Dense f a -> Dense f a #erfcx :: Dense f a -> Dense f a #normcdf :: Dense f a -> Dense f a # (Traversable f, InvErf a) => InvErf (Dense f a) # Methodsinverf :: Dense f a -> Dense f a #inverfc :: Dense f a -> Dense f a #invnormcdf :: Dense f a -> Dense f a # (Num a, Traversable f) => Mode (Dense f a) Source # Associated Typestype Scalar (Dense f a) :: * Source # MethodsisKnownConstant :: Dense f a -> Bool Source #isKnownZero :: Dense f a -> Bool Source #auto :: Scalar (Dense f a) -> Dense f a Source #(*^) :: Scalar (Dense f a) -> Dense f a -> Dense f a Source #(^*) :: Dense f a -> Scalar (Dense f a) -> Dense f a Source #(^/) :: Dense f a -> Scalar (Dense f a) -> Dense f a Source #zero :: Dense f a Source # (Traversable f, Num a) => Jacobian (Dense f a) Source # Associated Typestype D (Dense f a) :: * Source # Methodsunary :: (Scalar (Dense f a) -> Scalar (Dense f a)) -> D (Dense f a) -> Dense f a -> Dense f a Source #lift1 :: (Scalar (Dense f a) -> Scalar (Dense f a)) -> (D (Dense f a) -> D (Dense f a)) -> Dense f a -> Dense f a Source #lift1_ :: (Scalar (Dense f a) -> Scalar (Dense f a)) -> (D (Dense f a) -> D (Dense f a) -> D (Dense f a)) -> Dense f a -> Dense f a Source #binary :: (Scalar (Dense f a) -> Scalar (Dense f a) -> Scalar (Dense f a)) -> D (Dense f a) -> D (Dense f a) -> Dense f a -> Dense f a -> Dense f a Source #lift2 :: (Scalar (Dense f a) -> Scalar (Dense f a) -> Scalar (Dense f a)) -> (D (Dense f a) -> D (Dense f a) -> (D (Dense f a), D (Dense f a))) -> Dense f a -> Dense f a -> Dense f a Source #lift2_ :: (Scalar (Dense f a) -> Scalar (Dense f a) -> Scalar (Dense f a)) -> (D (Dense f a) -> D (Dense f a) -> D (Dense f a) -> (D (Dense f a), D (Dense f a))) -> Dense f a -> Dense f a -> Dense f a Source # type Scalar (Dense f a) Source # type Scalar (Dense f a) = a type D (Dense f a) Source # type D (Dense f a) = Id a

ds :: f a -> Dense f a -> f a Source #

ds' :: Num a => f a -> Dense f a -> (a, f a) Source #

vars :: (Traversable f, Num a) => f a -> f (Dense f a) Source #

apply :: (Traversable f, Num a) => (f (Dense f a) -> b) -> f a -> b Source #