changeset 2726:ea5b2a3dbb26

[project @ 1997-02-23 06:15:22 by jwe]
author jwe
date Sun, 23 Feb 1997 06:17:21 +0000
parents 878e5fd30580
children c45ae08a68fb
files scripts/ChangeLog scripts/general/is_square.m scripts/general/is_symmetric.m test/octave.test/string/string.exp
diffstat 4 files changed, 103 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Sun Feb 23 06:10:54 1997 +0000
+++ b/scripts/ChangeLog	Sun Feb 23 06:17:21 1997 +0000
@@ -1,3 +1,8 @@
+Sun Feb 23 00:15:57 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* general/is_square.m: Handle empty matrices correctly.
+	* general/is_symmetric.m: Handle empty matrices and strings.
+
 Sat Feb 22 01:06:22 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* polynomial/conv.m: Check inputs with is_vector(), not is_matrix().
--- a/scripts/general/is_square.m	Sun Feb 23 06:10:54 1997 +0000
+++ b/scripts/general/is_square.m	Sun Feb 23 06:17:21 1997 +0000
@@ -32,7 +32,7 @@
 
   if (nargin == 1)
     [nr, nc] = size (x);
-    if (nr == nc)
+    if (nr == nc && nr > 0)
       retval = nr;
     else
       retval = 0;
--- a/scripts/general/is_symmetric.m	Sun Feb 23 06:10:54 1997 +0000
+++ b/scripts/general/is_symmetric.m	Sun Feb 23 06:17:21 1997 +0000
@@ -30,13 +30,19 @@
 
 function retval = is_symmetric (x,tol)
 
+  retval = 0;
+
   if (nargin == 1 || nargin == 2)
-    if ((retval = is_square (x)))
+    [nr, nc] = size (x);
+    if (nr == nc && nr > 0)
       if (nargin == 1)
 	tol = eps;
       endif
-      if (norm (x - x') / norm(x) > tol)
-        retval = 0;
+      if (isstr (x))
+	x = toascii (x);
+      endif
+      if (norm (x - x') / norm(x) <= tol)
+        retval = nr;
       endif
     endif
   else
--- a/test/octave.test/string/string.exp	Sun Feb 23 06:10:54 1997 +0000
+++ b/test/octave.test/string/string.exp	Sun Feb 23 06:17:21 1997 +0000
@@ -45,3 +45,91 @@
 set test str-esc-12
 set prog_output "ok"
 do_test str-esc-12.m
+
+set test string_fill_char-1
+set prog_output "ans = 1"
+do_test string_fill_char-1.m
+
+set test string_fill_char-2
+set prog_output "ans = 1"
+do_test string_fill_char-2.m
+
+set test isstr-1
+set prog_output "ans = 0"
+do_test isstr-1.m
+
+set test isstr-2
+set prog_output "ans = 0"
+do_test isstr-2.m
+
+set test isstr-3
+set prog_output "ans = 0"
+do_test isstr-3.m
+
+set test isstr-4
+set prog_output "ans = 0"
+do_test isstr-4.m
+
+set test isstr-5
+set prog_output "ans = 1"
+do_test isstr-5.m
+
+set test isstr-6
+set prog_output "ans = 1"
+do_test isstr-6.m
+
+set test isstr-7
+set prog_output "ans = 1"
+do_test isstr-7.m
+
+set test isstr-8
+set prog_output "ans = 1"
+do_test isstr-8.m
+
+set test isstr-9
+set prog_output "ans = 0"
+do_test isstr-9.m
+
+set test isstr-10
+set prog_output "\n... isstr:.*"
+do_test isstr-10.m
+
+set test isstr-11
+set prog_output "\n... isstr:.*"
+do_test isstr-11.m
+
+# blanks
+# int2str
+# num2str
+# setstr
+# strcat
+# str2mat
+# deblank
+# findstr
+# index
+# rindex
+# split
+# strcmp
+# strrep
+# substr
+# bin2dec
+# dec2bin
+# dec2hex
+# hex2dec
+# str2num
+# toascii
+# tolower
+# toupper
+# undo_string_escapes
+# isalnum
+# isalpha
+# isascii
+# iscntrl
+# isdigit
+# isgraph
+# islower
+# isprint
+# ispunct
+# isspace
+# isupper
+# isxdigit