Mercurial > hg > octave-lyh
changeset 11619:f86f97948da6 release-3-0-x
[3-0-0-branch @ 2008-01-24 07:39:32 by jwe]
author | jwe |
---|---|
date | Thu, 24 Jan 2008 07:39:33 +0000 |
parents | 3257cccb9ed7 |
children | ad4f6a413291 |
files | liboctave/ChangeLog scripts/ChangeLog scripts/linear-algebra/trace.m |
diffstat | 3 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,4 +1,4 @@ -2008-01-22 Michael Goffioul <michael.goffioul@gmail.com> +2008-01-22 Michael Goffioul <michael.goffioul@gmail.com> * oct-time.cc (octave_base_tim::init): Validate pointer argument; this fixes the "localtime(-1)" crash under Windows.
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2008-01-24 Schloegl Alois <alois.schloegl@tugraz.at> + + * linear-algebra/trace.m: Require 2-d args. Handle vectors properly. + 2008-01-18 Ben Abbott <bpabbott@mac.com> * polynomial/residue.m: For each group of pole multiplicity, set
--- a/scripts/linear-algebra/trace.m +++ b/scripts/linear-algebra/trace.m @@ -30,8 +30,11 @@ print_usage (); endif - [nr, nc] = size (x); - if (nr == 1 || nc == 1) + if (ndims (x) > 2) + error ("trace: only valid on 2-D objects"); + elseif (isempty (x)) + y = 0; + elseif (any (size (x) == 1)) y = x(1); else y = sum (diag (x));