limestrael at gmail.com
Thu Nov 10 23:03:13 CET 2011
Does Repa always use unboxed Vectors?
But a Repa array can store any element, so how does it handles types which
haven't an unboxed equivalent? Or is the unboxing done automatically?
2011/11/10 Bas van Dijk <v.dijk.bas at gmail.com>
> On 9 November 2011 22:33, kaffeepause73 <kaffeepause73 at yahoo.de> wrote:
> > Repa is indeed very Interesting, but I have changing vector length in the
> > second dimension and later on only want to generate Data on demand. If I
> > Matrices, I will use loads of space for no reason.
> Even if it is possible to create an unboxed vector of unboxed vectors,
> if the inner unboxed vectors have variable lengths as you require,
> indexing will become O(n) instead of O(1) because you need to traverse
> the inner unboxed vectors and check their length to find the desired
> index. I'm not sure that's what you want.
> > Seems like sticking to Boxed Vector for now is best Choice for me.
> Yes your second alternative: a boxed vector of unboxed vectors seems
> to do what you want.
> > isn't data.vector also providing multidimensional arrays?
> I don't think so. All indexing functions get a single Int argument. Of
> course it's easy to build a layer on top that adds more dimensions.
> > So is Repa just another Version of Data.Vector or is it building another
> level on top.
> The latter, repa provides a layer on top of vector.
> Note that you can also convert Vectors to repa Arrays using:
> fromVector :: Shape sh => sh -> Vector a -> Array sh a
> I believe its O(1).
> > And when to use best which of the two ?
> I guess when your vectors are multi-dimensional and you want to
> benefit from parallelism you should use repa instead of vector.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe