trace does not behave as advertised on arrays of rank > 2

Jan. 29, 2000
2:38 a.m.
For arrays of rank 2, trace does what you expect, but for arrays of larger rank, it appears to simply sum along each of the two given axes. A simple experiment follows:
That is, trace(B) is the vector C, given by C[i]=sum(B[j,i,i]: j=0,...). A bit more experimentation reveals that trace ignores its fourth argument, consistent with the above result:
Evidently, trace is going to need a rewrite. It might perhaps also benefit from further optional arguments in groups of three, e.g., trace(A, p, 0, 3, q, 1, 2)[k,l,...] = A[i+p,j+q,j,i,k,l,...] with summing over repeated indices (i, j) ala Einstein. - Harald
9157
Age (days ago)
9157
Last active (days ago)
0 comments
1 participants
participants (1)
-
Harald Hanche-Olsen