The trace of matrix (2 dimensional array) is implemented with

tr=: +/@:((<0 1)&|:)

(BTW:   The "(<0 1)&|:"   always mystifies me.)

Can someone point me to an efficient and terse verb that generalises the trace 
to arbitrary dimensions?
A verb that works on 1  and higher than 2 dimensional arrays.

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

Reply via email to