On Mon, 20 Dec 2010, gutti wrote:

In Matlab the following line of code:
V3 = V1.*(V2>0)

What you certainly need is a zipWith function on matrices that lets you write

  Matrix.zipWith (\a1 a2 -> if a2>0 then a1 else 0) v1 v2

I can't see such a function in Matrix, but in Vector (zipVectorWith) that can be lifted to Matrices by (Matrix.liftMatrix2). Maybe there is some magic type class that already handles this - if there wouldn't be the Element constraint, it would be the Applicative type class and the liftA2 function.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to