Re: [Haskell-cafe] vector recycling

2010-04-18 Thread Roman Leshchinskiy
On 18/04/2010, at 08:07, Ben wrote: On Fri, Apr 16, 2010 at 11:19 PM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: That said, it would be quite possible to provide something like the following: fold_inplace :: Vector v a = (v a - b - v a) - v a - [b] - v a as far as i understand

Re: [Haskell-cafe] vector recycling

2010-04-17 Thread Roman Leshchinskiy
On 17/04/2010, at 13:32, Ben wrote: module Main where import qualified Data.Vector.Generic as V import qualified Data.Vector.Unboxed as UV type Vec = UV.Vector Double axpy :: Double - Vec - Vec - Vec axpy a x y = V.zipWith (+) (V.map (* a) x) y sumVecs :: [(Double, Vec)] - Vec

Re: [Haskell-cafe] vector recycling

2010-04-17 Thread Ben
On Fri, Apr 16, 2010 at 11:19 PM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: That said, it would be quite possible to provide something like the following: fold_inplace :: Vector v a = (v a - b - v a) - v a - [b] - v a as far as i understand there would be two ways of writing such a

[Haskell-cafe] vector recycling

2010-04-16 Thread Ben
hello -- this is mostly a question for roman, or don, i guess. suppose i have a list of similarly-sized vectors, and i want to add them up (possibly with coefficients), to yield a result vector. something like module Main where import qualified Data.Vector.Generic as V import qualified

Re: [Haskell-cafe] vector recycling

2010-04-16 Thread Jason Dagit
On Fri, Apr 16, 2010 at 8:32 PM, Ben midfi...@gmail.com wrote: hello -- this is mostly a question for roman, or don, i guess. suppose i have a list of similarly-sized vectors, and i want to add them up (possibly with coefficients), to yield a result vector. something like module Main