[Haskell-cafe] fast Array operations: foldl, drop
dons at galois.com
Fri Nov 30 22:56:59 EST 2007
> On Fri, 30 Nov 2007, Ketil Malde wrote:
> > Bryan O'Sullivan <bos at serpentine.com> writes:
> > > For higher dimensions, there are enough options in terms of
> > > traversal direction and what exactly e.g. a fold should fold over
> > > (single elements? lower-dimensional slices?) that a sensible API
> > > doesn't exactly leap out.
> > How about a 'reduce' instead of 'foldl1'? I think that if you require
> > a commutative operator, the order doesn't matter (except for
> > efficiency and possible rounding issues, I guess).
> For what I have in mind the order of execution matters.
> I also think now that slices for higher dimensional arrays are useful,
> anyway. If you choose a subrange of indices in the most significant
> dimension this would be possible without copying. It would be also
> possible to 'reshape' (in MatLab terms) an array without copying, as long
> as the number elements remain the same. So you could first transform an
> array of arbitrary dimension to a two-dimensional one, say
I forgot to mention this early, but possibly you could use the ndp array
library. There are some people using its UArr type for (non parallel)
strict arrays, that support map/fold/zip et al.
This blog post recently,
shows at least one non-developer is using it :)
Roman, what do you think -- are the unlifted, non-parallel arrays usably `beta'?
More information about the Haskell-Cafe