Mercurial > hg > octave-lyh
comparison scripts/linear-algebra/trace.m @ 7411:83a8781b529d
[project @ 2008-01-22 21:52:25 by jwe]
author | jwe |
---|---|
date | Tue, 22 Jan 2008 21:52:26 +0000 |
parents | a1dbe9d80eee |
children | 2da391ef7f55 |
comparison
equal
deleted
inserted
replaced
7410:8a3b2ccc4e11 | 7411:83a8781b529d |
---|---|
36 else | 36 else |
37 y = sum (diag (x)); | 37 y = sum (diag (x)); |
38 endif | 38 endif |
39 | 39 |
40 endfunction | 40 endfunction |
41 | |
42 %!assert(trace ([1, 2; 3, 4]) == 5); | |
43 | |
44 %!assert(trace ([1, 2; 3, 4; 5, 6]) == 5); | |
45 | |
46 %!assert(trace ([1, 3, 5; 2, 4, 6]) == 5); | |
47 | |
48 %!error trace (); | |
49 | |
50 %!error trace (1, 2); | |
51 |