Answering my own question, what I needed was:
testGrad2 :: (Fractional a, Num a) =>
(forall s . Mode s => [AD s a]) ->
(forall s . Mode s => [[AD s a]]) ->
[a] -> [a]
testGrad2 ys xss = grad (costFn ys xss)
On 23 Apr 2013, at 10:44, Dominic Steinitz wrote:
Can anyone tell me why I get a type error with testGrad2? What are my options?
Clearly I would like to be able find the gradient of my cost function for
different sets of observations.
Thanks, Dominic.
> {-# LANGUAGE NoMonomorphismRestriction #-}
>
> import Numeric.AD
>
> default()
>
> costF