# HG changeset patch # User Jaroslav Hajek # Date 1261776033 -3600 # Node ID 73fc43e01f4cd7d7bab41f1fe2ce9246bc58f4a5 # Parent a14dc255427fa305979ab03408e97e9a8f266fac allow issquare on arbitrary data diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,9 @@ +2009-12-25 Jaroslav Hajek + + * general/issquare.m: Do not check type. + * linear-algebra/issymmetric.m: Strengthen test. + * linear-algebra/ishermitian.m: Strengthen test. + 2009-12-25 Jaroslav Hajek * strings/strfind.m: Remove. diff --git a/scripts/general/issquare.m b/scripts/general/issquare.m --- a/scripts/general/issquare.m +++ b/scripts/general/issquare.m @@ -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]))); diff --git a/scripts/linear-algebra/ishermitian.m b/scripts/linear-algebra/ishermitian.m --- a/scripts/linear-algebra/ishermitian.m +++ b/scripts/linear-algebra/ishermitian.m @@ -38,7 +38,7 @@ print_usage (); endif - retval = issquare (x); + retval = isnumeric (x) && issquare (x); if (retval) if (tol == 0) retval = all ((x == x')(:)); diff --git a/scripts/linear-algebra/issymmetric.m b/scripts/linear-algebra/issymmetric.m --- a/scripts/linear-algebra/issymmetric.m +++ b/scripts/linear-algebra/issymmetric.m @@ -39,7 +39,7 @@ print_usage (); endif - retval = issquare (x); + retval = isnumeric (x) && issquare (x); if (retval) if (tol == 0) retval = all ((x == x.')(:));