trace function
(Shortest import: from brian2 import trace)
- brian2.units.unitsafefunctions.trace(a, offset=0, axis1=0, axis2=1, dtype=None, out=None)
Return the sum along diagonals of the array.
If
a
is 2-D, the sum along its diagonal with the given offset is returned, i.e., the sum of elementsa[i,i+offset]
for all i.If
a
has more than two dimensions, then the axes specified by axis1 and axis2 are used to determine the 2-D sub-arrays whose traces are returned. The shape of the resulting array is the same as that ofa
withaxis1
andaxis2
removed.