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.Representable

Description

First order dense forward mode using Representable 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 Repr f a Source #

Instances

Instances details
(Representable f, Num a) => Jacobian (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Associated Types

type D (Repr f a) Source #

Methods

unary :: (Scalar (Repr f a) -> Scalar (Repr f a)) -> D (Repr f a) -> Repr f a -> Repr f a Source #

lift1 :: (Scalar (Repr f a) -> Scalar (Repr f a)) -> (D (Repr f a) -> D (Repr f a)) -> Repr f a -> Repr f a Source #

lift1_ :: (Scalar (Repr f a) -> Scalar (Repr f a)) -> (D (Repr f a) -> D (Repr f a) -> D (Repr f a)) -> Repr f a -> Repr f a Source #

binary :: (Scalar (Repr f a) -> Scalar (Repr f a) -> Scalar (Repr f a)) -> D (Repr f a) -> D (Repr f a) -> Repr f a -> Repr f a -> Repr f a Source #

lift2 :: (Scalar (Repr f a) -> Scalar (Repr f a) -> Scalar (Repr f a)) -> (D (Repr f a) -> D (Repr f a) -> (D (Repr f a), D (Repr f a))) -> Repr f a -> Repr f a -> Repr f a Source #

lift2_ :: (Scalar (Repr f a) -> Scalar (Repr f a) -> Scalar (Repr f a)) -> (D (Repr f a) -> D (Repr f a) -> D (Repr f a) -> (D (Repr f a), D (Repr f a))) -> Repr f a -> Repr f a -> Repr f a Source #

(Representable f, Num a) => Mode (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Associated Types

type Scalar (Repr f a) Source #

Methods

isKnownConstant :: Repr f a -> Bool Source #

asKnownConstant :: Repr f a -> Maybe (Scalar (Repr f a)) Source #

isKnownZero :: Repr f a -> Bool Source #

auto :: Scalar (Repr f a) -> Repr f a Source #

(*^) :: Scalar (Repr f a) -> Repr f a -> Repr f a Source #

(^*) :: Repr f a -> Scalar (Repr f a) -> Repr f a Source #

(^/) :: Repr f a -> Scalar (Repr f a) -> Repr f a Source #

zero :: Repr f a Source #

(Representable f, Num a, Bounded a) => Bounded (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

minBound :: Repr f a #

maxBound :: Repr f a #

(Representable f, Num a, Enum a) => Enum (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

succ :: Repr f a -> Repr f a #

pred :: Repr f a -> Repr f a #

toEnum :: Int -> Repr f a #

fromEnum :: Repr f a -> Int #

enumFrom :: Repr f a -> [Repr f a] #

enumFromThen :: Repr f a -> Repr f a -> [Repr f a] #

enumFromTo :: Repr f a -> Repr f a -> [Repr f a] #

enumFromThenTo :: Repr f a -> Repr f a -> Repr f a -> [Repr f a] #

(Representable f, Floating a) => Floating (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

pi :: Repr f a #

exp :: Repr f a -> Repr f a #

log :: Repr f a -> Repr f a #

sqrt :: Repr f a -> Repr f a #

(**) :: Repr f a -> Repr f a -> Repr f a #

logBase :: Repr f a -> Repr f a -> Repr f a #

sin :: Repr f a -> Repr f a #

cos :: Repr f a -> Repr f a #

tan :: Repr f a -> Repr f a #

asin :: Repr f a -> Repr f a #

acos :: Repr f a -> Repr f a #

atan :: Repr f a -> Repr f a #

sinh :: Repr f a -> Repr f a #

cosh :: Repr f a -> Repr f a #

tanh :: Repr f a -> Repr f a #

asinh :: Repr f a -> Repr f a #

acosh :: Repr f a -> Repr f a #

atanh :: Repr f a -> Repr f a #

log1p :: Repr f a -> Repr f a #

expm1 :: Repr f a -> Repr f a #

log1pexp :: Repr f a -> Repr f a #

log1mexp :: Repr f a -> Repr f a #

(Representable f, RealFloat a) => RealFloat (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

floatRadix :: Repr f a -> Integer #

floatDigits :: Repr f a -> Int #

floatRange :: Repr f a -> (Int, Int) #

decodeFloat :: Repr f a -> (Integer, Int) #

encodeFloat :: Integer -> Int -> Repr f a #

exponent :: Repr f a -> Int #

significand :: Repr f a -> Repr f a #

scaleFloat :: Int -> Repr f a -> Repr f a #

isNaN :: Repr f a -> Bool #

isInfinite :: Repr f a -> Bool #

isDenormalized :: Repr f a -> Bool #

isNegativeZero :: Repr f a -> Bool #

isIEEE :: Repr f a -> Bool #

atan2 :: Repr f a -> Repr f a -> Repr f a #

(Representable f, Num a) => Num (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

(+) :: Repr f a -> Repr f a -> Repr f a #

(-) :: Repr f a -> Repr f a -> Repr f a #

(*) :: Repr f a -> Repr f a -> Repr f a #

negate :: Repr f a -> Repr f a #

abs :: Repr f a -> Repr f a #

signum :: Repr f a -> Repr f a #

fromInteger :: Integer -> Repr f a #

(Representable f, Fractional a) => Fractional (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

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

recip :: Repr f a -> Repr f a #

fromRational :: Rational -> Repr f a #

(Representable f, Real a) => Real (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

toRational :: Repr f a -> Rational #

(Representable f, RealFrac a) => RealFrac (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

properFraction :: Integral b => Repr f a -> (b, Repr f a) #

truncate :: Integral b => Repr f a -> b #

round :: Integral b => Repr f a -> b #

ceiling :: Integral b => Repr f a -> b #

floor :: Integral b => Repr f a -> b #

Show a => Show (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

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

show :: Repr f a -> String #

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

(Representable f, Erf a) => Erf (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

erf :: Repr f a -> Repr f a #

erfc :: Repr f a -> Repr f a #

erfcx :: Repr f a -> Repr f a #

normcdf :: Repr f a -> Repr f a #

(Representable f, InvErf a) => InvErf (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

inverf :: Repr f a -> Repr f a #

inverfc :: Repr f a -> Repr f a #

invnormcdf :: Repr f a -> Repr f a #

(Representable f, Num a, Eq a) => Eq (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

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

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

(Representable f, Num a, Ord a) => Ord (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

Methods

compare :: Repr f a -> Repr f a -> Ordering #

(<) :: Repr f a -> Repr f a -> Bool #

(<=) :: Repr f a -> Repr f a -> Bool #

(>) :: Repr f a -> Repr f a -> Bool #

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

max :: Repr f a -> Repr f a -> Repr f a #

min :: Repr f a -> Repr f a -> Repr f a #

type D (Repr f a) Source # 
Instance details

Defined in Numeric.AD.Internal.Dense.Representable

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

Defined in Numeric.AD.Internal.Dense.Representable

type Scalar (Repr f a) = a

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

Embed a constant

Dense Gradients

grad :: (Representable f, Eq (Rep f), Num a) => (forall s. f (AD s (Repr f a)) -> AD s (Repr 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 (\(V3 x y z) -> x*y+z) (V3 1 2 3)
V3 2 1 1

grad' :: (Representable f, Eq (Rep f), Num a) => (forall s. f (AD s (Repr f a)) -> AD s (Repr f a)) -> f a -> (a, f a) Source #

gradWith :: (Representable f, Eq (Rep f), Num a) => (a -> a -> b) -> (forall s. f (AD s (Repr f a)) -> AD s (Repr f a)) -> f a -> f b Source #

gradWith' :: (Representable f, Eq (Rep f), Num a) => (a -> a -> b) -> (forall s. f (AD s (Repr f a)) -> AD s (Repr f a)) -> f a -> (a, f b) Source #

Dense Jacobians (synonyms)

jacobian :: (Representable f, Eq (Rep f), Functor g, Num a) => (forall s. f (AD s (Repr f a)) -> g (AD s (Repr f a))) -> f a -> g (f a) Source #

jacobian' :: (Representable f, Eq (Rep f), Functor g, Num a) => (forall s. f (AD s (Repr f a)) -> g (AD s (Repr f a))) -> f a -> g (a, f a) Source #

jacobianWith :: (Representable f, Eq (Rep f), Functor g, Num a) => (a -> a -> b) -> (forall s. f (AD s (Repr f a)) -> g (AD s (Repr f a))) -> f a -> g (f b) Source #

jacobianWith' :: (Representable f, Eq (Rep f), Functor g, Num a) => (a -> a -> b) -> (forall s. f (AD s (Repr f a)) -> g (AD s (Repr f a))) -> f a -> g (a, f b) Source #