changeset 2408:e22aae3ccfad

[project @ 1996-10-15 16:37:52 by jwe]
author jwe
date Tue, 15 Oct 1996 16:39:38 +0000
parents 4f55dc039a7e
children 47e5f57fb4bd
files liboctave/CMatrix.cc liboctave/CMatrix.h liboctave/ChangeLog src/pr-output.cc src/symtab.cc
diffstat 5 files changed, 33 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/CMatrix.cc	Mon Oct 14 19:48:51 1996 +0000
+++ b/liboctave/CMatrix.cc	Tue Oct 15 16:39:38 1996 +0000
@@ -2956,6 +2956,22 @@
   return false;
 }
 
+// Return true if no elements have imaginary components.
+
+bool
+ComplexMatrix::all_elements_are_real (void) const
+{
+  int nr = rows ();
+  int nc = cols ();
+
+  for (int j = 0; j < nc; j++)
+    for (int i = 0; i < nr; i++)
+      if (imag (elem (i, j)) != 0.0)
+	return false;
+
+  return true;
+}
+
 // Return nonzero if any element of CM has a non-integer real or
 // imaginary part.  Also extract the largest and smallest (real or
 // imaginary) values and return them in MAX_VAL and MIN_VAL. 
--- a/liboctave/CMatrix.h	Mon Oct 14 19:48:51 1996 +0000
+++ b/liboctave/CMatrix.h	Tue Oct 15 16:39:38 1996 +0000
@@ -321,6 +321,7 @@
   void map (c_c_Mapper f);
 
   bool any_element_is_inf_or_nan (void) const;
+  bool all_elements_are_real (void) const;
   bool all_integers (double& max_val, double& min_val) const;
   bool too_large_for_float (void) const;
 
--- a/liboctave/ChangeLog	Mon Oct 14 19:48:51 1996 +0000
+++ b/liboctave/ChangeLog	Tue Oct 15 16:39:38 1996 +0000
@@ -1,3 +1,7 @@
+Tue Oct 15 11:34:48 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* CMatrix.cc (ComplexMatrix::all_elements_are_real): new function.
+
 Sun Oct 13 11:19:00 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* sun-utils.h: Conditionally declare MAIN__ too.  Declare MAIN_
--- a/src/pr-output.cc	Mon Oct 14 19:48:51 1996 +0000
+++ b/src/pr-output.cc	Tue Oct 15 16:39:38 1996 +0000
@@ -1101,9 +1101,12 @@
   int nr = m.rows ();
   int nc = m.columns ();
 
+#if 0
   if (nr == 1 && nc == 1 && ! pr_as_read_syntax)
     octave_print_internal (os, m (0, 0), pr_as_read_syntax);
-  else if (nr == 0 || nc == 0)
+  else
+#endif
+  if (nr == 0 || nc == 0)
     print_empty_matrix (os, nr, nc, pr_as_read_syntax);
   else if (plus_format && ! pr_as_read_syntax)
     {
@@ -1255,9 +1258,12 @@
   int nr = cm.rows ();
   int nc = cm.columns ();
 
+#if 0
   if (nr == 1 && nc == 1 && ! pr_as_read_syntax)
     octave_print_internal (os, cm (0, 0), pr_as_read_syntax);
-  else if (nr == 0 || nc == 0)
+  else
+#endif
+ if (nr == 0 || nc == 0)
     print_empty_matrix (os, nr, nc, pr_as_read_syntax);
   else if (plus_format && ! pr_as_read_syntax)
     {
--- a/src/symtab.cc	Mon Oct 14 19:48:51 1996 +0000
+++ b/src/symtab.cc	Tue Oct 15 16:39:38 1996 +0000
@@ -144,7 +144,11 @@
 void
 symbol_def::define (tree_constant *t)
 {
+  if (t)
+    t->maybe_mutate ();
+
   definition = t;
+
   if (! is_builtin_variable ())
     type = USER_VARIABLE;
 }