Wed Jan 13 08:37:20 CET 2010

Beautiful differentiation

I'm trying to understand this[1] magnificent paper by Conal Elliott.
Click trough for a video presentation from ICFP 2009.

The basic idea is that by using an abstract, recursive definition of
the chain rule and some clever function overloading, it is possible to
implement AD using very general high level code.

The code that can be found here[2] doesn't seem to have the most
general version of the chain rule (multiplication replaced by
composition with linear map).  Or do I miss something?

From Dif.hs:

-- The chain rule
infix 0 >-<
(>-<) :: (Num a) => (a -> a) -> (Dif a -> Dif a) -> Dif a -> Dif a
f >-< d = \ p@(D u u') -> D (f u) (d p * u')

[1] http://conal.net/papers/beautiful-differentiation/
[2] http://conal.net/blog/posts/beautiful-differentiation/