[Haskell-cafe] matrix computations based on the GSL

Henning Thielemann lemming at henning-thielemann.de
Thu Jun 30 04:39:02 EDT 2005

Let me a bit elaborate on what I wrote yesterday.

On Wed, 29 Jun 2005, Henning Thielemann wrote:

> I think matrices and derivatives are very different issues. I have often
> seen that the first derivative is considered as vector, and the second
> derivative is considered as matrix. In this spirit it is used like
>   x^T * (D2 f)(x) * x

It should be h^T * D2 f x * h (if at all the transposition notation is
used) if the curvature of f at x is meant.

>  but this is only abuse of the common multiplication definitions. A good
> interpretation and notation should seamless extend to higher derivatives.
> But the interpretation above does not work in higher dimensions.
> I like the following type for derivation.
>  derive :: ((i -> a) -> b) -> ((i -> a) -> (i -> b))
>   Here i is the index type, (i -> a) is the vector type, b is the type the
> vector function maps to. Its derivative has the same type of argument, but
> the result is a vector with indices of type i. You see that it is easy to
> repeat the application of 'derive', just replace b by say i->b. The second
> derivative yields vectors of type (i -> i -> b). This can be interpreted
> as matrix because it has two indices. But this is certainly not a matrix
> which represents a linear mapping as usual, but it is a matrix
> representing a bilinear form. The only thing we need is a multiplication
> to reduce one level of indices.
>  mul :: (i -> c) -> (i -> b) -> b
>   Though, what we still need is a general (overloaded?) definition of the
> scaling of b by c and a sum of b.

That is b must be a vector space with respect to c.

'derive' in this form is a bundled partial derivative, but it can be
identified with the total derivative. That is
 derive f x i   is the partial derivative of f at x with respect to the i-th component
 derive f x     is the total derivative of f at x.

More information about the Haskell-Cafe mailing list