Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-11 Thread Ryan Ingram
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

Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-10 Thread Yves Parès
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@gmail.com On 9 November 2011 22:33, kaffeepause73 kaffeepaus...@yahoo.de

Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-10 Thread Daniel Peebles
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 limestr...@gmail.com wrote: Does Repa always use unboxed Vectors? But a Repa array can store any element, so how does it handles types which

[Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread kaffeepause73
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

Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread Ivan Lazar Miljenovic
On 9 November 2011 20:56, kaffeepause73 kaffeepaus...@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) Only if you

Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread Tom Nielsen
Hi, I don't know about Unboxed, but you can define a newtype wrapper around Data.Vector.Storable that includes the size as a type-level natural. i.e. data Z data S n newtype Vec n a = Vec (Vector a) Then you can define a storable instance for Storable a = Vec n a, and thus you can define a

Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread Bas van Dijk
On 9 November 2011 10:56, kaffeepause73 kaffeepaus...@yahoo.de wrote: Is it possible to create an unboxed vector of unboxed vector ? : Why do you want to do this? If you want multi-dimensional unboxed arrays you could try out repa:

Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread kaffeepause73
Thanks for the replies. - Looks like there's not a straight forward way and I'm not yet on a level and don't have the time to make fancy wrappers or instances. Repa is indeed very Interesting, but I have changing vector length in the second dimension and later on only want to generate Data on

Re: [Haskell-cafe] Data.Vector.Unboxed

2011-11-09 Thread Bas van Dijk
On 9 November 2011 22:33, kaffeepause73 kaffeepaus...@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 use Matrices, I will use loads of space for no reason. Even if it is possible