Re: [Haskell-cafe] Automated Differentiation of Matrices (hmatrix)

2013-04-10 Thread Edward Kmett
The problem is both Repa and Hmatrix, (and most of the Vector types) want to know something about the data type we're storing in their shapes, so they can smash it flat and unbox it, but for most AD modes that value isn't actually something you can smash flat like that. newtype Tower a = Tower [a]

Re: [Haskell-cafe] Automated Differentiation of Matrices (hmatrix)

2013-04-10 Thread Brandon Allbery
On Wed, Apr 10, 2013 at 12:39 PM, Dominic Steinitz wrote: > :1:6: > Could not deduce (repa-3.2.3.1:Data.Array.Repa.Eval.Elt.Elt > (ad-3.4:Numeric.AD.Internal.Types.AD s a)) > > DANGER WILL ROBINSON! It's showing package names+versions on the types; this usually means y

Re: [Haskell-cafe] Automated Differentiation of Matrices (hmatrix)

2013-04-10 Thread Dominic Steinitz
Hi Edward, I see now that the issues are deeper than performance. I took another package that supports matrix operations: repa. > data MyMatrix a = MyMatrix > { > myRows :: Int > , myCols :: Int > , myElts :: [a] > } deriving (Show, Functor, Foldable, Traversable) > > f (MyMatrix r

Re: [Haskell-cafe] Automated Differentiation of Matrices (hmatrix)

2013-04-10 Thread Dominic Steinitz
Hi Edward, Thanks for the response. For now I don't need the performance for now but it's good to know these developments are in the pipeline. I'm not wedded to hmatrix. I think I could use repa or yarr just as easily; I just haven't investigated. Dominic. On 9 Apr 2013, at 23:03, Edward Kmett

Re: [Haskell-cafe] Automated Differentiation of Matrices (hmatrix)

2013-04-09 Thread Edward Kmett
hmatrix and ad don't (currently) mix. The problem is that hmatrix uses a packed structure that can't hold any of the AD mode variants we have as an Element. =( I've been working with Alex Lang to explore in ad 4.0 ways that we can support monomorphic AD modes and still present largely the same AP

[Haskell-cafe] Automated Differentiation of Matrices (hmatrix)

2013-04-09 Thread Dominic Steinitz
Hi Cafe, Suppose I want to find the grad of a function then it's easy I just use http://hackage.haskell.org/package/ad-3.4: import Numeric.AD import Data.Foldable (Foldable) import Data.Traversable (Traversable) data MyMatrix a = MyMatrix (a, a) deriving (Show, Functor, Foldable, Traversable)