changeset 2799:d77a29e4387f

[project @ 1997-03-08 08:35:56 by jwe]
author jwe
date Sat, 08 Mar 1997 08:41:00 +0000
parents d477bceb9e2a
children 9aeba8e006a4
files PROJECTS doc/interpreter/control.texi doc/interpreter/func.texi doc/interpreter/install.texi src/ChangeLog src/gripes.cc src/gripes.h src/load-save.cc src/load-save.h src/pt-plot.cc
diffstat 10 files changed, 200 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/PROJECTS
+++ b/PROJECTS
@@ -81,10 +81,6 @@
     user-supplied function for Matlab compatibility.  Don't place an
     upper limit on the number of arguments.
 
-  * If possible, make economy QR factorization actually take advantage
-    of the form of the result instead of just dropping columns.
-    Lapack doesn't appear to do this yet.
-
   * Check matrices for symmetry before computing eigenvalues, etc.,
     and then use the routines for symmetric matrices for improved
     performance.
@@ -99,11 +95,15 @@
     compatibility with Matlab (but only if Matlab 5 still does things
     this way). For example:  [1, 2] * [] ==> [].
 
+  * Should any ([]) return [] or 0?  What about all ([])?
+
   * Improve design of ODE, DAE, classes.
 
   * Make it possible to specify a time which dassl and lsode should
     not integrate past.
 
+  * Add interface to daspk (new version of dassl).
+
   * Extend meaning of .* to include v .* M or M .* v (where v is a
     column vector with the same number of rows as M) to scale rows of
     M by elements of v.  Similarly, if w is a row vector with as many
@@ -118,15 +118,21 @@
     Should probably work for any vectors, not just if x is a column
     vector and y is a row vector.
 
-  * On systems that support matherr(), make it possible for users to
-    enable the printing of warning messages.
-
   * Make it possible to solve b = L \ x efficiently, either by
     providing an explicit function call, or by automatically
     determining that L is triangular.  If it is done automatically,
     provide some means for determining whether Octave has actually
     detected that the matrix is triangular.
 
+  * The polyfit function uses the economy QR factorization, but even
+    that can take a lot of time for large datasets.  Consider an
+    option to compute the result with inv (A' * A) * A' * y or some
+    other faster method.d  Possibly just switch to this method if the
+    dataset is larger than some value.
+
+  * Consider making the behavior of the / and \ operators for
+    non-square systems compatible with Matlab.
+
 --------
 Graphics:
 --------
@@ -156,6 +162,9 @@
 
   * If possible, pass binary data to gnuplot to speed things up.
 
+  * If using gnuplot, consider setting a smaller default for the
+    `zero' value (e.g., set zero sqrt (realmin) or something).
+
 -------
 Strings:
 -------
@@ -214,6 +223,20 @@
 
   * Make load and save look for <file>.mat if only given <file>.
 
+    Potential sticky points:
+
+      - For load, if both foo and foo.mat exist, should it prefer foo
+        or foo.mat?  Should the preference depend on the arguments to
+        load?  I think it should only prefer .mat files if the
+        -mat-binary option is supplied, or if the file foo.mat exists
+        but the file foo does not.
+
+      - For save, should it prefer to create foo or foo.mat?  Should
+        the preference depend on the arguments to save?  Should the
+        default_save_format imply a default preference?  I think it
+        should only create .mat files if it is writing Matlab
+        compatible files.
+
   * Move some pr-output stuff to liboctave.
 
   * Make the cutoff point for changing to packed storage a
@@ -424,7 +447,7 @@
   * Eliminate force_numeric and make_numeric functions.
 
   * Is Matrix::fortran_vec() really necessary?
-
+b
   * print_usage() should set error_state in most cases?
 
   * Make statements like this
@@ -446,6 +469,9 @@
 
   * Clean up eye, eval, feval, keyboard, input, ones, zeros.
 
+  * Turn off printing when evaluating expressions in an eval()
+    statement, for compatibility with Matlab.
+
   * It would be nice to have an interactive debugger.
 
   * Make whos report total memory used by variables (and functions?).
@@ -454,6 +480,9 @@
     function that gives all the basic information, then write who and
     whos as M-files.
 
+  * On systems that support matherr(), make it possible for users to
+    enable the printing of warning messages.
+
 -------
 History:
 -------
@@ -533,8 +562,6 @@
   * Should info/terminal.c include definitions for PC, BC, UP, and
     ospeed on all systems?
 
-  * Clean up help stuff.
-
   * Demo files.
 
   * As the number of m-files with octave grows perhaps a 'Contents.m'
--- a/doc/interpreter/control.texi
+++ b/doc/interpreter/control.texi
@@ -374,9 +374,21 @@
 @end ifinfo
 whichever is appropriate.
 
-Uses Schur decomposition method as in Kitagawa, International Journal of
-Control (1977); column-by-column solution method as suggested in
-Hammarling, IMA Journal of Numerical Analysis, (1982).
+Uses Schur decomposition method as in Kitagawa 
+@iftex
+@tex
+@cite{An Algorithm for Solving the Matrix Equation $X = F X F^\prime + S$},
+@end tex
+@end iftex
+@ifinfo
+@cite{An Algorithm for Solving the Matrix Equation @var{X} =
+@var{F}@var{X}@var{F}' + @var{S}},
+@end ifinfo
+International Journal of Control, Volume 25, Number 5, pages 745--753
+(1977); column-by-column solution method as suggested in
+Hammerling, @cite{Numerical Solution of the Stable, Non-Negative
+Definite Lyapunov Equation}, IMA Journal of Numerical Analysis, Volume
+2, pages 303--323 (1982).
 @end deftypefn
 
 @deftypefn {Function File} {} is_controllable (@var{a}, @var{b}, @var{tol})
--- a/doc/interpreter/func.texi
+++ b/doc/interpreter/func.texi
@@ -126,6 +126,11 @@
 before the end of the function body in order for the function to return
 a value.
 
+Variables used in the body of a function are local to the
+function.  Variables named in @var{arg-list} and @var{ret-var} are also
+local to the function.  @xref{Global Variables}, for information about
+how to access global variables inside a function.
+
 For example, here is a function that computes the average of the
 elements of a vector:
 
--- a/doc/interpreter/install.texi
+++ b/doc/interpreter/install.texi
@@ -52,6 +52,13 @@
 @item --with-g77
 Use @code{g77} to compile Fortran code.
 
+@item --enable-shared
+Create shared libraries.  If you are planning to use
+@code{--enable-lite-kernelel} or the dynamic loading features, you will
+probably want to use this option.  It will make your @file{.oct} files
+much smaller.  You may also want to build a shared version of
+@code{libg++}, if your system doesn't already have one.
+
 @item --enable-dl
 Use @code{dlopen} and friends to make Octave capable of dynamically
 linking externally compiled functions.  This only works on systems that
@@ -181,13 +188,30 @@
 @end itemize
 
 @menu
+* Notes::                       
 * Installation Problems::       
 * Binary Distributions::        
 @end menu
 
-@node Installation Problems, Binary Distributions, Installation, Installation
+@node Notes, Installation Problems, Installation, Installation
+@appendixsec Notes
+
+@itemize @bullet
+@item
+You must use the version of GNU Info distributed with Octave, because it
+includes some changes to allow Octave to search the indices of the info
+files.  If you would like, you should be able to replace other copies of
+the Info browser that you have with the one distributed with Octave.
+Patches relative to a recent release of the GNU Info browser are
+included in the file @file{INFO.PATCH} in the Octave source
+distribution.  This modification has been submitted to the GNU Info
+maintainer, and should appear in some future release.  Once that
+happens, the GNU Info browser will no longer be distributed with Octave.
+@end itemize
+
+@node Installation Problems, Binary Distributions, Notes, Installation
 @appendixsec Installation Problems
-	
+
 This section contains a list of problems (and some apparent problems
 that don't really mean anything is wrong) that may show up during
 installation of Octave.
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
+Sat Mar  8 02:35:13 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* load-save.cc (save_ascii_data, save_three_d): Where appropriate,
+	use bool instead of int.
+	(save_binary_data, save_mat_binary_data, save_ascii_data):
+	Print warning instead of error for wrong type arg.
+
+	* gripes.cc (gripe_wrong_type_arg): New arg, is_error.
+
+	* pt-plot.cc (save_in_tmp_file): Call save_ascii_data with bool
+	arg, not int.
+
 Fri Mar  7 00:56:16 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* dassl.cc (show_dassl_option): For values that are determined
--- a/src/gripes.cc
+++ b/src/gripes.cc
@@ -60,7 +60,7 @@
 }
 
 void
-gripe_empty_arg (const char *name, int is_error)
+gripe_empty_arg (const char *name, bool is_error)
 {
   if (is_error)
     error ("%s: empty matrix is invalid as an argument", name);
@@ -123,16 +123,24 @@
 }
 
 void
-gripe_wrong_type_arg (const char *name, const string& s)
+gripe_wrong_type_arg (const char *name, const string& s, bool is_error)
 {
-  error ("%s: wrong type argument `%s'", name, s.c_str ());
+  if (is_error)
+    error ("%s: wrong type argument `%s'", name, s.c_str ());
+  else
+    warning ("%s: wrong type argument `%s'", name, s.c_str ());
 }
 
 void
-gripe_wrong_type_arg (const char *name, const octave_value& tc)
+gripe_wrong_type_arg (const char *name, const octave_value& tc,
+		      bool is_error)
 {
   string type = tc.type_name ();
-  error ("%s: wrong type argument `%s'", name, type.c_str ());
+
+  if (is_error)
+    error ("%s: wrong type argument `%s'", name, type.c_str ());
+  else
+    warning ("%s: wrong type argument `%s'", name, type.c_str ());
 }
 
 void
--- a/src/gripes.h
+++ b/src/gripes.h
@@ -27,27 +27,71 @@
 
 class octave_value;
 
-extern void gripe_not_supported (const char *);
-extern void gripe_string_invalid (void);
-extern void gripe_range_invalid (void);
-extern void gripe_nonconformant (void);
-extern void gripe_nonconformant (int r1, int c1, int r2, int c2);
-extern void gripe_empty_arg (const char *name, int is_error);
-extern void gripe_square_matrix_required (const char *name);
-extern void gripe_user_supplied_eval (const char *name);
-extern void gripe_user_returned_invalid (const char *name);
-extern void gripe_invalid_conversion (const string& from, const string& to);
-extern void gripe_invalid_value_specified (const char *name);
-extern void gripe_2_or_3_dim_plot (void);
-extern void gripe_unrecognized_float_fmt (void);
-extern void gripe_unrecognized_data_fmt (const char *warn_for);
-extern void gripe_data_conversion (const char *from, const char *to);
-extern void gripe_wrong_type_arg (const char *name, const string& s);
-extern void gripe_wrong_type_arg (const char *name, const octave_value& tc);
-extern void gripe_wrong_type_arg_for_unary_op (const octave_value& op);
-extern void gripe_wrong_type_arg_for_binary_op (const octave_value& op);
-extern void gripe_implicit_conversion (const char *from, const char *to);
-extern void gripe_divide_by_zero (void);
+
+extern void
+gripe_not_supported (const char *);
+
+extern void
+gripe_string_invalid (void);
+
+extern void
+gripe_range_invalid (void);
+
+extern void
+gripe_nonconformant (void);
+
+extern void
+gripe_nonconformant (int r1, int c1, int r2, int c2);
+
+extern void
+gripe_empty_arg (const char *name, bool is_error);
+
+extern void
+gripe_square_matrix_required (const char *name);
+
+extern void
+gripe_user_supplied_eval (const char *name);
+
+extern void
+gripe_user_returned_invalid (const char *name);
+
+extern void
+gripe_invalid_conversion (const string& from, const string& to);
+
+extern void
+gripe_invalid_value_specified (const char *name);
+
+extern void
+gripe_2_or_3_dim_plot (void);
+
+extern void
+gripe_unrecognized_float_fmt (void);
+
+extern void
+gripe_unrecognized_data_fmt (const char *warn_for);
+
+extern void
+gripe_data_conversion (const char *from, const char *to);
+
+extern void
+gripe_wrong_type_arg (const char *name, const string& s,
+		      bool is_error = true);
+
+extern void
+gripe_wrong_type_arg (const char *name, const octave_value& tc,
+		      bool is_error = true);
+
+extern void
+gripe_wrong_type_arg_for_unary_op (const octave_value& op);
+
+extern void
+gripe_wrong_type_arg_for_binary_op (const octave_value& op);
+
+extern void
+gripe_implicit_conversion (const char *from, const char *to);
+
+extern void
+gripe_divide_by_zero (void);
 
 #endif
 
--- a/src/load-save.cc
+++ b/src/load-save.cc
@@ -1770,13 +1770,11 @@
 // string DOC, and global flag MARK_AS_GLOBAL on stream OS in the
 // binary format described above for read_binary_data.
 
-static int
+static bool
 save_binary_data (ostream& os, const octave_value& tc,
 		  const string& name, const string& doc,
 		  int mark_as_global, int save_as_floats) 
 {
-  int fail = 0;
-
   FOUR_BYTE_INT name_len = name.length ();
 
   os.write (&name_len, 4);
@@ -1901,23 +1899,18 @@
       os.write (&inc, 8);
     }
   else
-    {
-      gripe_wrong_type_arg ("save", tc);
-      fail = 1;
-    }
-
-  return (os && ! fail);
+    gripe_wrong_type_arg ("save", tc, false);
+
+  return os;
 }
 
 // Save the data from TC along with the corresponding NAME on stream OS 
 // in the MatLab binary format.
 
-static int
+static bool
 save_mat_binary_data (ostream& os, const octave_value& tc,
 		      const string& name) 
 {
-  int fail = 0;
-
   FOUR_BYTE_INT mopt = 0;
 
   mopt += tc.is_string () ? 1 : 0;
@@ -1993,16 +1986,13 @@
 	}
     }
   else
-    {
-      gripe_wrong_type_arg ("save", tc);
-      fail = 1;
-    }
-
-  return (os && ! fail);
+    gripe_wrong_type_arg ("save", tc, false);
+
+  return os;
 }
 
 static void
-ascii_save_type (ostream& os, char *type, int mark_as_global)
+ascii_save_type (ostream& os, char *type, bool mark_as_global)
 {
   if (mark_as_global)
     os << "# type: global ";
@@ -2097,12 +2087,12 @@
 
 // XXX FIXME XXX -- should probably write the help string here too.
 
-int
+bool
 save_ascii_data (ostream& os, const octave_value& tc,
-		 const string& name, int strip_nan_and_inf,
-		 int mark_as_global, int precision) 
+		 const string& name, bool strip_nan_and_inf,
+		 bool mark_as_global, int precision) 
 {
-  int success = 1;
+  bool success = true;
 
   if (! precision)
     precision = Vsave_precision;
@@ -2123,7 +2113,7 @@
 	  if (xisnan (d))
 	    {
 	      error ("only value to plot is NaN");
-	      success = 0;
+	      success = false;
 	    }
 	  else
 	    {
@@ -2156,7 +2146,7 @@
 	  if (xisnan (c))
 	    {
 	      error ("only value to plot is NaN");
-	      success = 0;
+	      success = false;
 	    }
 	  else
 	    {
@@ -2212,10 +2202,7 @@
 	 << tmp.inc () << "\n";
     }
   else
-    {
-      gripe_wrong_type_arg ("save", tc);
-      success = 0;
-    }
+    gripe_wrong_type_arg ("save", tc, false);
 
   os.precision (old_precision);
 
@@ -2246,7 +2233,7 @@
   switch (fmt)
     {
     case LS_ASCII:
-      save_ascii_data (os, tc, name, 0, global);
+      save_ascii_data (os, tc, name, false, global);
       break;
 
     case LS_BINARY:
@@ -2507,8 +2494,8 @@
 // making a 3-dimensional plot with gnuplot.  If PARAMETRIC is
 // nonzero, assume a parametric 3-dimensional plot will be generated.
 
-int
-save_three_d (ostream& os, const octave_value& tc, int parametric)
+bool
+save_three_d (ostream& os, const octave_value& tc, bool parametric)
 {
   int fail = 0;
 
--- a/src/load-save.h
+++ b/src/load-save.h
@@ -29,13 +29,14 @@
 
 #include <string>
 
-extern int save_ascii_data (ostream& os, const octave_value& t,
-			    const string& name = string (),
-			    int strip_nan_and_inf = 0,
-			    int mark_as_global = 0, int precision = 0);
+extern bool save_ascii_data (ostream& os, const octave_value& t,
+			     const string& name = string (),
+			     bool strip_nan_and_inf = false,
+			     bool mark_as_global = false,
+			     int precision = 0);
 
-extern int save_three_d (ostream& os, const octave_value& t,
-			 int parametric = 0);
+extern bool save_three_d (ostream& os, const octave_value& t,
+			  bool parametric = false);
 
 extern void save_user_variables (void);
 
--- a/src/pt-plot.cc
+++ b/src/pt-plot.cc
@@ -861,7 +861,7 @@
 	  switch (ndim)
 	    {
 	    case 2:
-	      save_ascii_data (file, t, name, 1);
+	      save_ascii_data (file, t, name, true);
 	      break;
 
 	    case 3: