Data.Vector with stride

For low-level performance, especially when dealing with images, pixel buffers, camera devices etc, arrays can have a "stride" to align rows to word boundaries. http://en.wikipedia.org/wiki/Stride_of_an_array Data.Vector does not support strides (as mentioned in http://u.arboreus.com/2011/03/how-to-choose-haskell-array-library.html), but it would be nice to have them, especially for Storable vectors and interfacing with C imaging libraries. Is there a particular reason / difficulty that would go against an implementation of a Data.Vector.Storable.Stride and the corresponding generic vector instances?

A quick and dirty way do have strides with Data.Vector.Storable might be to use a newtype around a type, and have its sizeOf be the stride. On Monday, December 16, 2013 1:13:50 PM, Niklas Hambüchen wrote:
For low-level performance, especially when dealing with images, pixel buffers, camera devices etc, arrays can have a "stride" to align rows to word boundaries.
http://en.wikipedia.org/wiki/Stride_of_an_array
Data.Vector does not support strides (as mentioned in http://u.arboreus.com/2011/03/how-to-choose-haskell-array-library.html), but it would be nice to have them, especially for Storable vectors and interfacing with C imaging libraries.
Is there a particular reason / difficulty that would go against an implementation of a Data.Vector.Storable.Stride and the corresponding generic vector instances? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hey niklas, I'll releasing an abstraction layer on top of vector soon
that'll have support for striding, and I definitely agree that such info is
key for easy interop
On Sun, Dec 15, 2013 at 9:42 PM, Mike Ledger
A quick and dirty way do have strides with Data.Vector.Storable might be to use a newtype around a type, and have its sizeOf be the stride.
On Monday, December 16, 2013 1:13:50 PM, Niklas Hambüchen wrote:
For low-level performance, especially when dealing with images, pixel buffers, camera devices etc, arrays can have a "stride" to align rows to word boundaries.
http://en.wikipedia.org/wiki/Stride_of_an_array
Data.Vector does not support strides (as mentioned in http://u.arboreus.com/2011/03/how-to-choose-haskell-array-library.html), but it would be nice to have them, especially for Storable vectors and interfacing with C imaging libraries.
Is there a particular reason / difficulty that would go against an implementation of a Data.Vector.Storable.Stride and the corresponding generic vector instances? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (3)
-
Carter Schonwald
-
Mike Ledger
-
Niklas Hambüchen