If you go this direction, it might also help to transpose the matrix, so
you're adding new timeslice differences as rows (for efficiency). Better
yet, pre-allocate the matrix to hold the results and insert rows (in order
to move the memory allocation overhead up front to a single operation).
On 5/29/08, Rob Hodgkinson <[EMAIL PROTECTED]> wrote:
>
> 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).
> ...
>
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm