MatrixOP, extension of SumRows

MatrixOP is cherished by me for it speed working on matrices, and I have a wish. First a little background. Based on cursor input, I have code that averages a range of columns or rows from matrices with around 1M points. As the user moves cursor A or B, the average of the cols and rows between the cursors is updated. This entails averaging over hundreds of cols or rows. To get a low latency of cursor movement and updating of the resulting 1D waves, this averaging needs to be fast, ideally around a ms, because other calculations also take place. (Actually, this whole concept only works because Igor updates the graphs so fast.)

Currently, I have two main options:
1) MatrixOP Wout = mat x Wsel, where Wsel is a column vector, with zeroes outside the region of interest. The matrix multiplication takes care of the summation and reduces the dimensionality. It is neat and works, but a bit too general and not necessarily the fastest, as a lot of unnecessary multiplication takes place outside the region of interest.
2) Duplicate the matrix, delete the range of rows or cols not used, and use MatrixOP Wout=SumRows(WmatChopped). The duplication/free and the deletepoints are unfortunate, as they take time.

Ideally, MatrixOP would have the extended command which allows for summation over a restricted range of rows/cols/layer, e.g. SumRows(Wmat,RowLower,RowUpper)
This feature would be highly welcome!



Let's start by looking at a better way to solve the current problem:
In IP6 the fastest way to get averages over rectangular image regions is actually with ImageStats (look at the /G flag).

Now for MatrixOP: your suggestion above is a good one. In fact, it has already been implemented for IP7. Here is the relevant documentation:

subRange(w , rs , re, cs, ce)
Returns a contiguous subset of the wave w specified by starting row rs and ending row re , starting column cs to ending column ce (inclusive). This is similar to Duplicate/R except scaling or dimension information are not supported in MatrixOP.

A.G.
WaveMetrics, Inc.
Thanks for the swift reply, I am very happy to have the Subrange command in MatrixOP in IP7. Unfortunately Subrange in MatrixOP doesn’t work in IP6. When is this fantastic IP7 coming?

Imagestats/G takes statistics in a ROI of a matrix, but it doesn’t seem to return a 1D wave with the averages per row (or column).
I can't make any comment that combines "IP7" and units of time :)

ImageStats can be invoked with /M=1 so you do not get all the high order statistics that you do not need. The /G flag is appropriate if you have a single region of interest. Otherwise, you can define arrays of ROI's and use /BRXY flag. I'm not sure which is faster for N rows/cols.

A.G.