Ketil Malde | 16 May 15:27
Gravatar

Re: How to use arrays efficiently?

"Lauri Oksanen" <lassoken <at> gmail.com> writes:

> Thanks for help. I did some tests with UArray and it does the trick.
> The problem remaining is, how to implement UArray Int (Double, Double, Double)?

As (UArray Int Double, UArray Int Double, UArray Int Double).
Or as UArray Int Double, but with a specialized lookup function:

   mylookup array index = (array!3*index, array!3*index+1, array!3*index+2)

I guess it would be possible to have UArray Int (# Double, Double,
Double #) - packing all three Doubles unboxed into the array, but I've
no clue how to go about automating that.

-k
--

-- 
If I haven't seen further, it is by standing in the footprints of giants

Gmane