vector-space-0.10.3: Vector & affine spaces, linear maps, and derivatives

Data.Maclaurin

Contents

Description

Infinite derivative towers via linear maps, using the Maclaurin representation. See blog posts http://conal.net/blog/tag/derivatives/.

Synopsis

# Documentation

data a :> b Source #

Tower of derivatives.

Constructors

 D infixr 9 FieldspowVal :: b derivative :: a :-* (a :> b)

Instances

 (Num s, VectorSpace s, HasBasis s, HasTrie (Basis s), HasNormal ((:>) (Two s) (Three s))) => HasNormal (Three ((:>) (Two s) s)) Source # MethodsnormalVec :: Three (Two s :> s) -> Three (Two s :> s) Source # (Num s, VectorSpace s, HasBasis s, HasTrie (Basis s), (~) * (Basis s) ()) => HasNormal (Two ((:>) (One s) s)) Source # MethodsnormalVec :: Two (One s :> s) -> Two (One s :> s) Source # Eq b => Eq ((:>) a b) Source # Methods(==) :: (a :> b) -> (a :> b) -> Bool #(/=) :: (a :> b) -> (a :> b) -> Bool # (HasBasis a, (~) * s (Scalar a), HasTrie (Basis a), Floating s, VectorSpace s, (~) * (Scalar s) s) => Floating ((:>) a s) Source # Methodspi :: a :> s #exp :: (a :> s) -> a :> s #log :: (a :> s) -> a :> s #sqrt :: (a :> s) -> a :> s #(**) :: (a :> s) -> (a :> s) -> a :> s #logBase :: (a :> s) -> (a :> s) -> a :> s #sin :: (a :> s) -> a :> s #cos :: (a :> s) -> a :> s #tan :: (a :> s) -> a :> s #asin :: (a :> s) -> a :> s #acos :: (a :> s) -> a :> s #atan :: (a :> s) -> a :> s #sinh :: (a :> s) -> a :> s #cosh :: (a :> s) -> a :> s #tanh :: (a :> s) -> a :> s #asinh :: (a :> s) -> a :> s #acosh :: (a :> s) -> a :> s #atanh :: (a :> s) -> a :> s #log1p :: (a :> s) -> a :> s #expm1 :: (a :> s) -> a :> s #log1pexp :: (a :> s) -> a :> s #log1mexp :: (a :> s) -> a :> s # (HasBasis a, (~) * s (Scalar a), HasTrie (Basis a), Fractional s, VectorSpace s, (~) * (Scalar s) s) => Fractional ((:>) a s) Source # Methods(/) :: (a :> s) -> (a :> s) -> a :> s #recip :: (a :> s) -> a :> s #fromRational :: Rational -> a :> s # (HasBasis a, (~) * s (Scalar a), HasTrie (Basis a), Num s, VectorSpace s, (~) * (Scalar s) s) => Num ((:>) a s) Source # Methods(+) :: (a :> s) -> (a :> s) -> a :> s #(-) :: (a :> s) -> (a :> s) -> a :> s #(*) :: (a :> s) -> (a :> s) -> a :> s #negate :: (a :> s) -> a :> s #abs :: (a :> s) -> a :> s #signum :: (a :> s) -> a :> s #fromInteger :: Integer -> a :> s # (AdditiveGroup b, HasBasis a, HasTrie (Basis a), OrdB b, IfB b, Ord b) => Ord ((:>) a b) Source # Methodscompare :: (a :> b) -> (a :> b) -> Ordering #(<) :: (a :> b) -> (a :> b) -> Bool #(<=) :: (a :> b) -> (a :> b) -> Bool #(>) :: (a :> b) -> (a :> b) -> Bool #(>=) :: (a :> b) -> (a :> b) -> Bool #max :: (a :> b) -> (a :> b) -> a :> b #min :: (a :> b) -> (a :> b) -> a :> b # Show b => Show ((:>) a b) Source # MethodsshowsPrec :: Int -> (a :> b) -> ShowS #show :: (a :> b) -> String #showList :: [a :> b] -> ShowS # (AdditiveGroup v, HasBasis u, HasTrie (Basis u), IfB v) => IfB ((:>) u v) Source # MethodsifB :: (* ~ bool) (BooleanOf (u :> v)) => bool -> (u :> v) -> (u :> v) -> u :> v # (AdditiveGroup v, HasBasis u, HasTrie (Basis u), OrdB v) => OrdB ((:>) u v) Source # Methods(<*) :: (* ~ bool) (BooleanOf (u :> v)) => (u :> v) -> (u :> v) -> bool #(<=*) :: (* ~ bool) (BooleanOf (u :> v)) => (u :> v) -> (u :> v) -> bool #(>*) :: (* ~ bool) (BooleanOf (u :> v)) => (u :> v) -> (u :> v) -> bool #(>=*) :: (* ~ bool) (BooleanOf (u :> v)) => (u :> v) -> (u :> v) -> bool # (HasBasis a, HasTrie (Basis a), AdditiveGroup u) => AdditiveGroup ((:>) a u) Source # MethodszeroV :: a :> u Source #(^+^) :: (a :> u) -> (a :> u) -> a :> u Source #negateV :: (a :> u) -> a :> u Source #(^-^) :: (a :> u) -> (a :> u) -> a :> u Source # (InnerSpace u, (~) * s (Scalar u), AdditiveGroup s, HasBasis a, HasTrie (Basis a)) => InnerSpace ((:>) a u) Source # Methods(<.>) :: (a :> u) -> (a :> u) -> Scalar (a :> u) Source # (HasBasis a, HasTrie (Basis a), VectorSpace u, AdditiveGroup (Scalar u)) => VectorSpace ((:>) a u) Source # Associated Typestype Scalar ((:>) a u) :: * Source # Methods(*^) :: Scalar (a :> u) -> (a :> u) -> a :> u Source # (HasBasis a, HasTrie (Basis a), VectorSpace v, HasCross3 v) => HasCross3 ((:>) a v) Source # Methodscross3 :: (a :> v) -> (a :> v) -> a :> v Source # (HasBasis a, HasTrie (Basis a), VectorSpace v, HasCross2 v) => HasCross2 ((:>) a v) Source # Methodscross2 :: (a :> v) -> a :> v Source # (Num s, HasTrie (Basis (s, s)), HasBasis s, (~) * (Basis s) ()) => HasNormal ((:>) (Two s) (Three s)) Source # MethodsnormalVec :: (Two s :> Three s) -> Two s :> Three s Source # (HasBasis s, HasTrie (Basis s), (~) * (Basis s) ()) => HasNormal ((:>) (One s) (Two s)) Source # MethodsnormalVec :: (One s :> Two s) -> One s :> Two s Source # type BooleanOf ((:>) a b) Source # type BooleanOf ((:>) a b) = BooleanOf b type Scalar ((:>) a u) Source # type Scalar ((:>) a u) = (:>) a (Scalar u)

derivAtBasis :: (HasTrie (Basis a), HasBasis a, AdditiveGroup b) => (a :> b) -> Basis a -> a :> b Source #

Sample the derivative at a basis element. Optimized for partial application to save work for non-scalar derivatives.

type (:~>) a b = a -> a :> b Source #

Infinitely differentiable functions

pureD :: (AdditiveGroup b, HasBasis a, HasTrie (Basis a)) => b -> a :> b Source #

Constant derivative tower.

fmapD :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b) => (b -> c) -> (a :> b) -> a :> c Source #

Map a linear function over a derivative tower.

(<\$>>) :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b) => (b -> c) -> (a :> b) -> a :> c infixl 4 Source #

Map a linear function over a derivative tower.

liftD2 :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c) => (b -> c -> d) -> (a :> b) -> (a :> c) -> a :> d Source #

Apply a linear binary function over derivative towers.

liftD3 :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c, AdditiveGroup d) => (b -> c -> d -> e) -> (a :> b) -> (a :> c) -> (a :> d) -> a :> e Source #

Apply a linear ternary function over derivative towers.

idD :: (VectorSpace u, s ~ Scalar u, VectorSpace (u :> u), VectorSpace s, HasBasis u, HasTrie (Basis u)) => u :~> u Source #

Differentiable identity function. Sometimes called "the derivation variable" or similar, but it's not really a variable.

fstD :: (HasBasis a, HasTrie (Basis a), HasBasis b, HasTrie (Basis b), Scalar a ~ Scalar b) => (a, b) :~> a Source #

Differentiable version of fst

sndD :: (HasBasis a, HasTrie (Basis a), HasBasis b, HasTrie (Basis b), Scalar a ~ Scalar b) => (a, b) :~> b Source #

Differentiable version of snd

linearD :: (HasBasis u, HasTrie (Basis u), AdditiveGroup v) => (u -> v) -> u :~> v Source #

Every linear function has a constant derivative equal to the function itself (as a linear map).

distrib :: forall a b c u. (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c, AdditiveGroup u) => (b -> c -> u) -> (a :> b) -> (a :> c) -> a :> u Source #

Derivative tower for applying a binary function that distributes over addition, such as multiplication. A bit weaker assumption than bilinearity. Is bilinearity necessary for correctness here?

(>-<) :: (HasBasis a, HasTrie (Basis a), VectorSpace u, AdditiveGroup (Scalar u)) => (u -> u) -> ((a :> u) -> a :> Scalar u) -> (a :> u) -> a :> u infix 0 Source #