[Haskell-cafe] Data.Vector.Unboxed
Ryan Ingram
ryani.spam at gmail.com
Fri Nov 11 21:41:08 CET 2011
If the internal vectors are fixed size, you can easily write a wrapper
around Vector Int that converts (Int,Int) indices into indices in the
sub-vector.
If the internal vectors have dynamic size, you can't declare an Unbox
instance, because pointers can't be unboxed; unboxed types are opaque to
the garbage collector.
At a low level, Vector Int is
Vector Word# Word# ByteArray#
where Word# are machine words and ByteArray# is like 'const char *' that is
understood by the ghc garbage collector.
On Wed, Nov 9, 2011 at 1:56 AM, kaffeepause73 <kaffeepause73 at yahoo.de>wrote:
> Hello,
>
> quick question about unboxed Vectors :
>
> Is it possible to create an unboxed vector of unboxed vector ? :
>
> > import qualified Data.Vector.Unboxed as V
> > type UnboxedNestedVextor = V.Vector (V.Vector Int)
>
> Alternatively I would have to use:
>
> > import qualified Data.Vector.Unboxed as V
> > import qualified Data.Vector as VB
>
> type UnboxedNestedVextor = VB.Vector (V.Vector Int)
>
> Is there a rule of thumb how much quicker Unboxed Vectors are ?
>
> Cheers Phil
>
>
> --
> View this message in context:
> http://haskell.1045720.n5.nabble.com/Data-Vector-Unboxed-tp4977289p4977289.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111111/359dd29e/attachment.htm>
More information about the Haskell-Cafe
mailing list