ad-4.5.6: Automatic Differentiation
Copyright(c) Edward Kmett 2010-2021
LicenseBSD3
Maintainerekmett@gmail.com
Stabilityexperimental
PortabilityGHC only
Safe HaskellSafe-Inferred
LanguageHaskell2010

Numeric.AD.Mode.Dense

Description

First order dense forward mode using Traversable functors

Synopsis

Documentation

data AD s a Source #

Instances

Instances details
Mode a => Mode (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Associated Types

type Scalar (AD s a) Source #

Methods

isKnownConstant :: AD s a -> Bool Source #

asKnownConstant :: AD s a -> Maybe (Scalar (AD s a)) Source #

isKnownZero :: AD s a -> Bool Source #

auto :: Scalar (AD s a) -> AD s a Source #

(*^) :: Scalar (AD s a) -> AD s a -> AD s a Source #

(^*) :: AD s a -> Scalar (AD s a) -> AD s a Source #

(^/) :: AD s a -> Scalar (AD s a) -> AD s a Source #

zero :: AD s a Source #

Bounded a => Bounded (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

minBound :: AD s a #

maxBound :: AD s a #

Enum a => Enum (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

succ :: AD s a -> AD s a #

pred :: AD s a -> AD s a #

toEnum :: Int -> AD s a #

fromEnum :: AD s a -> Int #

enumFrom :: AD s a -> [AD s a] #

enumFromThen :: AD s a -> AD s a -> [AD s a] #

enumFromTo :: AD s a -> AD s a -> [AD s a] #

enumFromThenTo :: AD s a -> AD s a -> AD s a -> [AD s a] #

Floating a => Floating (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

pi :: AD s a #

exp :: AD s a -> AD s a #

log :: AD s a -> AD s a #

sqrt :: AD s a -> AD s a #

(**) :: AD s a -> AD s a -> AD s a #

logBase :: AD s a -> AD s a -> AD s a #

sin :: AD s a -> AD s a #

cos :: AD s a -> AD s a #

tan :: AD s a -> AD s a #

asin :: AD s a -> AD s a #

acos :: AD s a -> AD s a #

atan :: AD s a -> AD s a #

sinh :: AD s a -> AD s a #

cosh :: AD s a -> AD s a #

tanh :: AD s a -> AD s a #

asinh :: AD s a -> AD s a #

acosh :: AD s a -> AD s a #

atanh :: AD s a -> AD s a #

log1p :: AD s a -> AD s a #

expm1 :: AD s a -> AD s a #

log1pexp :: AD s a -> AD s a #

log1mexp :: AD s a -> AD s a #

RealFloat a => RealFloat (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

floatRadix :: AD s a -> Integer #

floatDigits :: AD s a -> Int #

floatRange :: AD s a -> (Int, Int) #

decodeFloat :: AD s a -> (Integer, Int) #

encodeFloat :: Integer -> Int -> AD s a #

exponent :: AD s a -> Int #

significand :: AD s a -> AD s a #

scaleFloat :: Int -> AD s a -> AD s a #

isNaN :: AD s a -> Bool #

isInfinite :: AD s a -> Bool #

isDenormalized :: AD s a -> Bool #

isNegativeZero :: AD s a -> Bool #

isIEEE :: AD s a -> Bool #

atan2 :: AD s a -> AD s a -> AD s a #

Num a => Num (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

(+) :: AD s a -> AD s a -> AD s a #

(-) :: AD s a -> AD s a -> AD s a #

(*) :: AD s a -> AD s a -> AD s a #

negate :: AD s a -> AD s a #

abs :: AD s a -> AD s a #

signum :: AD s a -> AD s a #

fromInteger :: Integer -> AD s a #

Read a => Read (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

readsPrec :: Int -> ReadS (AD s a) #

readList :: ReadS [AD s a] #

readPrec :: ReadPrec (AD s a) #

readListPrec :: ReadPrec [AD s a] #

Fractional a => Fractional (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

(/) :: AD s a -> AD s a -> AD s a #

recip :: AD s a -> AD s a #

fromRational :: Rational -> AD s a #

Real a => Real (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

toRational :: AD s a -> Rational #

RealFrac a => RealFrac (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

properFraction :: Integral b => AD s a -> (b, AD s a) #

truncate :: Integral b => AD s a -> b #

round :: Integral b => AD s a -> b #

ceiling :: Integral b => AD s a -> b #

floor :: Integral b => AD s a -> b #

Show a => Show (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

showsPrec :: Int -> AD s a -> ShowS #

show :: AD s a -> String #

showList :: [AD s a] -> ShowS #

Erf a => Erf (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

erf :: AD s a -> AD s a #

erfc :: AD s a -> AD s a #

erfcx :: AD s a -> AD s a #

normcdf :: AD s a -> AD s a #

InvErf a => InvErf (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

inverf :: AD s a -> AD s a #

inverfc :: AD s a -> AD s a #

invnormcdf :: AD s a -> AD s a #

Eq a => Eq (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

(==) :: AD s a -> AD s a -> Bool #

(/=) :: AD s a -> AD s a -> Bool #

Ord a => Ord (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

Methods

compare :: AD s a -> AD s a -> Ordering #

(<) :: AD s a -> AD s a -> Bool #

(<=) :: AD s a -> AD s a -> Bool #

(>) :: AD s a -> AD s a -> Bool #

(>=) :: AD s a -> AD s a -> Bool #

max :: AD s a -> AD s a -> AD s a #

min :: AD s a -> AD s a -> AD s a #

type Scalar (AD s a) Source # 
Instance details

Defined in Numeric.AD.Internal.Type

type Scalar (AD s a) = Scalar a

data Dense f a Source #

Instances

Instances details
(Traversable f, Num a) => Jacobian (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Associated Types

type D (Dense f a) Source #

Methods

unary :: (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 #

(Num a, Traversable f) => Mode (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Associated Types

type Scalar (Dense f a) Source #

Methods

isKnownConstant :: Dense f a -> Bool Source #

asKnownConstant :: Dense f a -> Maybe (Scalar (Dense f a)) 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, Bounded a) => Bounded (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

minBound :: Dense f a #

maxBound :: Dense f a #

(Traversable f, Num a, Enum a) => Enum (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

succ :: 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, Floating a) => Floating (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

pi :: 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, RealFloat a) => RealFloat (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

floatRadix :: 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, Num a) => Num (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

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, Fractional a) => Fractional (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

(/) :: Dense f a -> Dense f a -> Dense f a #

recip :: Dense f a -> Dense f a #

fromRational :: Rational -> Dense f a #

(Traversable f, Real a) => Real (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

toRational :: Dense f a -> Rational #

(Traversable f, RealFrac a) => RealFrac (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

properFraction :: 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 # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

showsPrec :: Int -> Dense f a -> ShowS #

show :: Dense f a -> String #

showList :: [Dense f a] -> ShowS #

(Traversable f, Erf a) => Erf (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

erf :: 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) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

inverf :: Dense f a -> Dense f a #

inverfc :: Dense f a -> Dense f a #

invnormcdf :: Dense f a -> Dense f a #

(Traversable f, Num a, Eq a) => Eq (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

(==) :: Dense f a -> Dense f a -> Bool #

(/=) :: Dense f a -> Dense f a -> Bool #

(Traversable f, Num a, Ord a) => Ord (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

Methods

compare :: 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 #

type D (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

type D (Dense f a) = Id a
type Scalar (Dense f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense

type Scalar (Dense f a) = a

auto :: Mode t => Scalar t -> t Source #

Embed a constant

Dense Gradients

grad :: (Traversable f, Num a) => (forall s. f (AD s (Dense f a)) -> AD s (Dense f a)) -> f a -> f a Source #

The grad function calculates the gradient of a non-scalar-to-scalar function with dense-mode AD in a single pass.

>>> grad (\[x,y,z] -> x*y+z) [1,2,3]
[2,1,1]

grad' :: (Traversable f, Num a) => (forall s. f (AD s (Dense f a)) -> AD s (Dense f a)) -> f a -> (a, f a) Source #

gradWith :: (Traversable f, Num a) => (a -> a -> b) -> (forall s. f (AD s (Dense f a)) -> AD s (Dense f a)) -> f a -> f b Source #

gradWith' :: (Traversable f, Num a) => (a -> a -> b) -> (forall s. f (AD s (Dense f a)) -> AD s (Dense f a)) -> f a -> (a, f b) Source #

Dense Jacobians (synonyms)

jacobian :: (Traversable f, Functor g, Num a) => (forall s. f (AD s (Dense f a)) -> g (AD s (Dense f a))) -> f a -> g (f a) Source #

jacobian' :: (Traversable f, Functor g, Num a) => (forall s. f (AD s (Dense f a)) -> g (AD s (Dense f a))) -> f a -> g (a, f a) Source #

jacobianWith :: (Traversable f, Functor g, Num a) => (a -> a -> b) -> (forall s. f (AD s (Dense f a)) -> g (AD s (Dense f a))) -> f a -> g (f b) Source #

jacobianWith' :: (Traversable f, Functor g, Num a) => (a -> a -> b) -> (forall s. f (AD s (Dense f a)) -> g (AD s (Dense f a))) -> f a -> g (a, f b) Source #