Mercurial > octave-nkf
changeset 10023:73fc43e01f4c
allow issquare on arbitrary data
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 25 Dec 2009 22:20:33 +0100 |
parents | a14dc255427f |
children | 184060864627 |
files | scripts/ChangeLog scripts/general/issquare.m scripts/linear-algebra/ishermitian.m scripts/linear-algebra/issymmetric.m |
diffstat | 4 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog Fri Dec 25 21:26:16 2009 +0100 +++ b/scripts/ChangeLog Fri Dec 25 22:20:33 2009 +0100 @@ -1,3 +1,9 @@ +2009-12-25 Jaroslav Hajek <highegg@gmail.com> + + * general/issquare.m: Do not check type. + * linear-algebra/issymmetric.m: Strengthen test. + * linear-algebra/ishermitian.m: Strengthen test. + 2009-12-25 Jaroslav Hajek <highegg@gmail.com> * strings/strfind.m: Remove.
--- a/scripts/general/issquare.m Fri Dec 25 21:26:16 2009 +0100 +++ b/scripts/general/issquare.m Fri Dec 25 22:20:33 2009 +0100 @@ -30,7 +30,7 @@ function retval = issquare (x) if (nargin == 1) - if (ismatrix (x) && ndims (x) == 2) + if (ndims (x) == 2) [r, c] = size (x); retval = r == c; else @@ -51,16 +51,16 @@ %!assert(issquare ([1, 2; 3, 4])); %!test -%! assert(!(issquare ("t"))); +%! assert(issquare ("t")); %!assert(!(issquare ("test"))); %!test -%! assert(!(issquare (["test"; "ing"; "1"; "2"]))); +%! assert(issquare (["test"; "ing"; "1"; "2"])); %!test %! s.a = 1; -%! assert(!(issquare (s))); +%! assert(issquare (s)); %!assert(!(issquare ([1, 2; 3, 4; 5, 6])));
--- a/scripts/linear-algebra/ishermitian.m Fri Dec 25 21:26:16 2009 +0100 +++ b/scripts/linear-algebra/ishermitian.m Fri Dec 25 22:20:33 2009 +0100 @@ -38,7 +38,7 @@ print_usage (); endif - retval = issquare (x); + retval = isnumeric (x) && issquare (x); if (retval) if (tol == 0) retval = all ((x == x')(:));
--- a/scripts/linear-algebra/issymmetric.m Fri Dec 25 21:26:16 2009 +0100 +++ b/scripts/linear-algebra/issymmetric.m Fri Dec 25 22:20:33 2009 +0100 @@ -39,7 +39,7 @@ print_usage (); endif - retval = issquare (x); + retval = isnumeric (x) && issquare (x); if (retval) if (tol == 0) retval = all ((x == x.')(:));