Mercurial > hg > octave-lyh
view scripts/linear-algebra/trace.m @ 22:2cd2476fb32d
[project @ 1993-08-10 20:28:05 by jwe]
Add init functions for balancing classes.
author | jwe |
---|---|
date | Tue, 10 Aug 1993 20:28:05 +0000 |
parents | b4df021f796c |
children | 16a24e76d6e0 |
line wrap: on
line source
function y = trace (x) # usage: trace (x) # # Returns the trace (the sum of the diagonal elements) of x. if (nargin != 1) error ("usage: trace (x)"); endif y = sum (diag (x)); endfunction