Does Repa always use unboxed Vectors?<br>But a Repa array can store any element, so how does it handles types which haven&#39;t an unboxed equivalent? Or is the unboxing done automatically?<br><br><div class="gmail_quote">

2011/11/10 Bas van Dijk <span dir="ltr">&lt;<a href="mailto:v.dijk.bas@gmail.com">v.dijk.bas@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On 9 November 2011 22:33, kaffeepause73 &lt;<a href="mailto:kaffeepause73@yahoo.de">kaffeepause73@yahoo.de</a>&gt; wrote:<br>
&gt; Repa is indeed very Interesting, but I have changing vector length in the<br>
&gt; second dimension and later on only want to generate Data on demand. If I use<br>
&gt; Matrices, I will use loads of space for no reason.<br>
<br>
</div>Even if it is possible to create an unboxed vector of unboxed vectors,<br>
if the inner unboxed vectors have variable lengths as you require,<br>
indexing will become O(n) instead of O(1) because you need to traverse<br>
the inner unboxed vectors and check their length to find the desired<br>
index. I&#39;m not sure that&#39;s what you want.<br>
<div class="im"><br>
&gt; Seems like sticking to Boxed Vector for now is best Choice for me.<br>
<br>
</div>Yes your second alternative: a boxed vector of unboxed vectors seems<br>
to do what you want.<br>
<div class="im"><br>
&gt; isn&#39;t data.vector also providing multidimensional arrays?<br>
<br>
</div>I don&#39;t think so. All indexing functions get a single Int argument. Of<br>
course it&#39;s easy to build a layer on top that adds more dimensions.<br>
<div class="im"><br>
&gt; So is Repa just another Version of Data.Vector or is it building another level on top.<br>
<br>
</div>The latter, repa provides a layer on top of vector.<br>
<br>
Note that you can also convert Vectors to repa Arrays using:<br>
<br>
fromVector :: Shape sh =&gt; sh -&gt; Vector a -&gt; Array sh a<br>
<br>
I believe its O(1).<br>
<div class="im"><br>
&gt; And when to use best which of the two ?<br>
<br>
</div>I guess when your vectors are multi-dimensional and you want to<br>
benefit from parallelism you should use repa instead of vector.<br>
<br>
Cheers,<br>
<br>
Bas<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>