Yes, it does. You can only use members of the Elt class in repa arrays, and
Elt has Unbox as a superclass.

On Thu, Nov 10, 2011 at 5:03 PM, Yves Parès <[email protected]> wrote:

> 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 <[email protected]>
>
>> On 9 November 2011 22:33, kaffeepause73 <[email protected]> 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 use
>> > 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.
>>
>> Cheers,
>>
>> Bas
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to