[Haskell-cafe] hmatrix

Anatoly Yakovenko aeyakovenko at gmail.com
Sat May 31 23:59:55 EDT 2008


http://perception.inf.um.es/~aruiz/darcs/hmatrix/doc/html/Data-Packed-Vector.html
provided by hmatrix

On Sat, May 31, 2008 at 3:20 PM, Thomas Hartman <tphyahoo at gmail.com> wrote:
> what package do you install/import to get at Vector?
>
> 2008/5/31 Thomas Hartman <tphyahoo at gmail.com>:
>> what package do you install/import to get at Vector?
>>
>> 2008/5/31 Anatoly Yakovenko <aeyakovenko at gmail.com>:
>>> What is the most efficient way to update a position in a matrix or a
>>> vector?  I came up with this:
>>>
>>> updateVector :: Vector Double -> Int -> Double -> Vector Double
>>> updateVector vec pos val = vec `add` v2
>>>   where
>>>      v2 = fromList $ (replicate (pos) 0.0) ++ ((val - (vec @>
>>> pos)):(replicate ((dim vec)- pos - 1) 0.0))
>>>
>>> but this seems pretty inefficient to me.
>>>
>>> thanks,
>>> Anatoly
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe at haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>
>


More information about the Haskell-Cafe mailing list