1

I've been exploring the Data.Yarr Array library, as a possible replacement for some code I have in Repa. It seems fully featured, and the benchmarks - if correct suggest a performance improvement may be had.

I'm interested in the correct use of the slices function.

Say I had a 2D ForeignPtr backed matrix of Complex Floats, in row-major format

matrix2D :: UArray F L DIM2 (Complex Float)

How would I go about extracting a vector of slices of columns, and / or rows?

A motivating example? Lets say I wish to permute the columns, multiply each element wise with another set of slices, then perform a 1D FFT on each slice.

This seems a very common thing to want to do (in my world of signal processing). What is the idiomatic way of doing this?

Edited: to reduce scope of question.

OllieB
  • 1,431
  • 9
  • 14
  • I've never used yarr but at a glance the interface seems very similair to repa. As far as repa goes, it has an extremely general mechanism for taking slices of arrays. "I never did find a nice way of doing this in Repa either." - then you should show your 'not nice' code and state why you believe it isn't nice, or at the very least why the 'slice' functionality which exists in either of these two libraries is not satisfactory. As it stands, this is much too broad. – user2407038 Feb 14 '17 at 14:32
  • The slice functionality in these libraries may be satisfactory. As it stands, it is my understanding of their capabilities which is lacking - I believe I have stated that, but I'll review my question and try and narrow its scope. – OllieB Feb 14 '17 at 15:15

1 Answers1

1

I maintain yarr but sadly I only have intermittent access to the Internet for the next few weeks. I did write this comparison of yarr and repa some time ago: https://idontgetoutmuch.wordpress.com/2013/08/06/planetary-simulation-with-excursions-in-symplectic-manifolds-6/. I am surprised that you can't do slices with yarr without type coercion. I will try and take a look over the next few days.

idontgetoutmuch
  • 1,621
  • 11
  • 17
  • I'd be very interested to see an example of how you'd apply a column wise operator to a 2D array (or more generally, a nD operator on a mD array, where n < m) – OllieB Feb 17 '17 at 22:16