Further to R.E.Boss, I should also have suggested:
(}: - }.) instead of what I wrote (_1&{. - 1&{.)

But thinking further, the responses you have received so far recalculate the
entire array of differences upon each new column (ie time slice). This
becomes inefficient as the array grows (eg if 70,000 values in each column
and hundreds of time slices then the code recalculates the matrix of
differences again each time slice...)

If your matrix grows by 1 column (and therefore 70,000 numbers) on each time
slice, then it is likely more efficient to calculate and append only the new
differences on each time slice.  If you don¹t need the whole array of values
over all time slices, then just keep the last column of values (to be used
to work out the diffs for the next time slice).

If you have even 100 time slices you will be managing 7,000,000 elements of
data.  To avoid this you could ³pre-make² diffs (perhaps 70000 200$0 if you
know there will be no more than 200 time slices), then just assign in each
new column of diffs (this avoids the growing catenate ... Eg where you have
a 70,000x50 array, and then you catenate a new column to create a (new)
70,000x51 array, which uses a lot of space).

I didn¹t code this as the approach may not be what you want.  If you want to
follow this further please ask.

Rob Hodgkinson


On 29/05/08 1:51 PM, "PackRat" <[EMAIL PROTECTED]> wrote:

... 
> Although I'm showing merely a 6x4 array, the "real" data has over
> 70,000 rows (increasing in number each time period), and the number of
> columns obviously increases by one as each time period passes.
> 
> Ultimately, by again reversing the column order in the resulting array,
> I'd have an array showing a starting value and the succeeding value
> changes during the time period represented by each column.
> 
> Is there an existing verb, function, or phrase that already does what
> I'm seeking?  (I can see where what I'm asking is quite similar to many
> things in the business world, although in that case the columns might
> have both positive and negative values; that's why I'm thinking that
> code for such a technique might already exist.)  If not, is using
> (slower) explicit loops (for rows and for columns within rows) the only
> practical way to accomplish this?


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to