[Haskell-cafe] Haskell and arrays

Morten Olsen lysgaard morten at lysgaard.no
Fri May 4 22:40:28 CEST 2012

I'm a bit confused on what the standard is when it comes to arrays and 
performance in Haskell.

Say I have a function that takes an n dimensional array. The array only 
contains some primitive type.
The function mutates the array in an deterministic but chaotic pattern. 
The new value of an element might depend on other values in the array, 
and the order of update might depend on what values are found.

How would I implement this in an efficient fashion in Haskell. Is the 
array package the way to go? Would vector with some custom indexing 
scheme work well?
The array package provides n dimensional indexing, vector doesn't. Does 
vector perform better than array? Is it realistic to approach the 
performance of a naive c implementation? What steps would need to be 
taken in order to achieve that?

I know there are many question here, but I don't expect perfect answers 
to them. I just need to bootstrap my map of numerics in Haskell.

PS: An example of the above function could be Gaussian elimination of a 

Morten Olsen Lysgaard
NTNU-IT - Orakeltjenesten
NTNU - Physics and Mathematics

More information about the Haskell-Cafe mailing list