[Haskell-cafe] parallel matrix multiply (dph, par/pseq)

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Sun Jan 17 18:35:00 EST 2010


Hello.

How can I multiply matrices (of Doubles)
with dph (-0.4.0)?  (ghc-6.12.1)  -  I was trying

type Vector = [:Double:]
type Matrix = [:Vector:]

times :: Matrix -> Matrix -> Matrix
times a b =
      mapP
      ( \ row -> mapP ( \ col -> sumP ( zipWithP (*) row col  ) )
                      ( transposeP b )
      ) a

but there is no such thing as transposeP.

When I try any kind of index manipulations,
the compiler invariably tells me
that it does not want to build  [: :] - lists of indices
(e.g., there is no enumFromToP)
(I guess because I'm using Data.Array.Parallel.Prelude.Double)

Puzzled - J.W.


PS: what's the recommended way to multiply matrices
(better modelled as   Array (Int,Int) Double   or  [[Double]] ?)
with the  par/pseq  approach (if this is recommended at all)?

As I said earlier, I just want to have some nice and easy benchmarks
for demonstration in a lecture (to be run on 2, 4, or 8 cores).
Of course if they work, I'd use them in real life as well...



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100117/31e81b8c/signature.bin


More information about the Haskell-Cafe mailing list