[Haskell-cafe] parallel matrix multiply (dph, par/pseq)
Rafael Gustavo da Cunha Pereira Pinto
RafaelGCPP.Linux at gmail.com
Mon Jan 18 05:35:42 EST 2010
I never used DPH, but for Matrices, I always tend to use Array (Int,Int)
Double, as it accesses its elements in O(1). Arrays also can be unboxed
(UArray), which are much faster, or monadic and mutable (MArray), which are
more flexible.
I don't know if it is possible to use Arrays with DPH...
On Sun, Jan 17, 2010 at 21:35, Johannes Waldmann <
waldmann at imn.htwk-leipzig.de> wrote:
> 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...
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
--
Rafael Gustavo da Cunha Pereira Pinto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100118/5fae7e51/attachment.html
More information about the Haskell-Cafe
mailing list