changeset 3178:09a3064a3a17

[project @ 1998-06-23 03:46:42 by jwe]
author jwe
date Tue, 23 Jun 1998 03:47:31 +0000
parents d81db29f8b2b
children f657159c8152
files ChangeLog configure.in doc/liboctave/array.texi doc/liboctave/factor.texi doc/liboctave/liboctave.texi doc/liboctave/matvec.texi libcruft/ChangeLog libcruft/specfun/rybesl.f liboctave/ChangeLog liboctave/DASSL.cc liboctave/EIG.cc liboctave/LSODE.cc liboctave/MArray2.cc scripts/ChangeLog scripts/plot/__plt__.m src/ChangeLog src/ov-usr-fcn.cc src/parse.y src/variables.cc src/variables.h src/xpow.cc
diffstat 21 files changed, 159 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 18 20:24:40 1998  Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
+
+	* configure.in (RLD_FLAG): Set correctly for Linux on all
+	architectures.  From 
+
 Thu May 28 10:17:45 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* configure.in: When checking for glob stuff, make sure that the
--- a/configure.in
+++ b/configure.in
@@ -21,7 +21,7 @@
 ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 ### 02111-1307, USA. 
 
-AC_REVISION($Revision: 1.306 $)
+AC_REVISION($Revision: 1.307 $)
 AC_PREREQ(2.9)
 AC_INIT(src/octave.cc)
 AC_CONFIG_HEADER(config.h)
@@ -550,9 +550,7 @@
     SONAME_FLAGS='-Xlinker -soname -Xlinker $@'
     RLD_FLAG='-Xlinker -rpath -Xlinker $(octlibdir)'
   ;;
-changequote(,)dnl
-  i[3456789]86-*-linux*)
-changequote([,])dnl
+  *-*-linux*)
     SONAME_FLAGS='-Xlinker -soname -Xlinker $@'
     RLD_FLAG='-Xlinker -rpath -Xlinker $(octlibdir)'
   ;;
--- a/doc/liboctave/array.texi
+++ b/doc/liboctave/array.texi
@@ -1,4 +1,4 @@
-@node Arrays, Matrix and Vector @var{Operations}, Introduction, Top
+@node Arrays, Matrix and Vector Operations, Introduction, Top
 @chapter Arrays
 @cindex arrays
 
--- a/doc/liboctave/factor.texi
+++ b/doc/liboctave/factor.texi
@@ -1,4 +1,4 @@
-@node Matrix Factorizations, Ranges, Matrix and Vector @var{Operations}, Top
+@node Matrix Factorizations, Ranges, Matrix and Vector Operations, Top
 @chapter Matrix Factorizations
 @cindex matrix factorizations
 @cindex factorizations
--- a/doc/liboctave/liboctave.texi
+++ b/doc/liboctave/liboctave.texi
@@ -28,7 +28,7 @@
 @c This file doesn't include a chapter, so it must not be included
 @c if you want to run the Emacs function texinfo-multiple-files-update.
 
-@include conf.texi
+@c @include conf.texi
 
 @settitle Octave C++ Classes
 
@@ -98,7 +98,7 @@
 * Copying::                     
 * Introduction::                
 * Arrays::                      
-* Matrix and Vector @var{Operations}::  
+* Matrix and Vector Operations::  
 * Matrix Factorizations::       
 * Ranges::                      
 * Nonlinear Functions::         
--- a/doc/liboctave/matvec.texi
+++ b/doc/liboctave/matvec.texi
@@ -107,7 +107,7 @@
 
 @c ------------------------------------------------------------------------
 
-@node Matrix and Vector @var{Operations}, Matrix Factorizations, Arrays, Top
+@node Matrix and Vector Operations, Matrix Factorizations, Arrays, Top
 @chapter Matrix and Vector Operations
 @cindex matrix manipulations
 @cindex vector manipulations
--- a/libcruft/ChangeLog
+++ b/libcruft/ChangeLog
@@ -1,3 +1,7 @@
+Tue Jun  2 09:57:52 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* specfun/rybesl.f (rybesl): Don't access by(2) unless nb .gt. 1.
+
 Mon May 11 12:33:42 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* fftpack/passb3.f, fftpack/passb5.f, fftpack/passf3.f,
--- a/libcruft/specfun/rybesl.f
+++ b/libcruft/specfun/rybesl.f
@@ -406,10 +406,10 @@
 C  Now have first one or two Y's
 C----------------------------------------------------------------------
             BY(1) = YA
-            BY(2) = YA1
-            IF (YA1 .EQ. ZERO) THEN
-                  NCALC = 1
-               ELSE
+            NCALC = 1
+            IF (NB .GT. 1) THEN
+              BY(2) = YA1
+              IF (YA1 .NE. ZERO) THEN
                   AYE = ONE + ALPHA
                   TWOBYX = TWO/EX
                   NCALC = 2
@@ -425,6 +425,7 @@
                      AYE = AYE + ONE
                      NCALC = NCALC + 1
   400             CONTINUE
+              END IF
             END IF
   450       DO 460 I = NCALC+1, NB
                BY(I) = ZERO
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,19 @@
+Mon Jun 22 17:04:27 1998  Tomislav Goles <tom@ait-tech.com>
+
+	* EIG.cc (EIG::init): Move invariant code outside loop.
+
+Thu Jun 18 11:08:23 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* MArray2.cc (MARRAY_A2A2_OP): If operands are empty, make result
+	have the same size as the operands.
+	
+Thu May 28 10:41:04 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* DASSL.cc (DASSL::do_integrate): If an exception occurs in the
+	call to ddassl, set integration_error to 1 before calling the
+	error handler and returning.
+	* LSODE.cc (LSODE::do_integrate): Likewise.
+
 Wed May 27 13:46:30 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Array2-idx.h (assign): Allow A([],[]) = scalar and, if
--- a/liboctave/DASSL.cc
+++ b/liboctave/DASSL.cc
@@ -276,7 +276,10 @@
 			     piwork, liw, dummy, idummy, ddassl_j));
 
   if (f77_exception_encountered)
-    (*current_liboctave_error_handler) ("unrecoverable error in dassl");
+    {
+      integration_error = 1;
+      (*current_liboctave_error_handler) ("unrecoverable error in dassl");
+    }
   else
     {
       switch (idid)
--- a/liboctave/EIG.cc
+++ b/liboctave/EIG.cc
@@ -125,10 +125,11 @@
 		      return -1;
 		    }
 
+		  lambda.elem(j) = Complex (wr.elem(j), wi.elem(j));
+		  lambda.elem(j+1) = Complex (wr.elem(j+1), wi.elem(j+1));
+
 		  for (int i = 0; i < n; i++)
 		    {
-		      lambda.elem(j) = Complex (wr.elem(j), wi.elem(j));
-		      lambda.elem(j+1) = Complex (wr.elem(j+1), wi.elem(j+1));
 		      double real_part = vr.elem (i, j);
 		      double imag_part = vr.elem (i, j+1);
 		      v.elem (i, j) = Complex (real_part, imag_part);
--- a/liboctave/LSODE.cc
+++ b/liboctave/LSODE.cc
@@ -252,7 +252,10 @@
 			   piwork, liw, lsode_j, method_flag));
 
   if (f77_exception_encountered)
-    (*current_liboctave_error_handler) ("unrecoverable error in lsode");
+    {
+      integration_error = 1;
+      (*current_liboctave_error_handler) ("unrecoverable error in lsode");
+    }
   else
     {
       switch (istate)
--- a/liboctave/MArray2.cc
+++ b/liboctave/MArray2.cc
@@ -146,7 +146,7 @@
 	return MArray2<T> (); \
       } \
     if (r == 0 || c == 0) \
-      return MArray2<T> (); \
+      return MArray2<T> (r, c); \
     int l = a.length (); \
     DO_VV_OP (OP); \
     return MArray2<T> (result, r, c); \
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@
+Thu Jun 18 16:32:15 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* plot/__plt__.m: Don't call usleep.
+
 Mon May 18 11:42:36 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* linear-algebra/dot.m: New function.
--- a/scripts/plot/__plt__.m
+++ b/scripts/plot/__plt__.m
@@ -72,13 +72,6 @@
 	  x_set = 1;
 	endif
 
-	## Something fishy is going on.  I don't think this should be
-	## necessary, but without it, sometimes not all the lines from a
-	## given plot command appear on the screen.  Even with it, the
-	## delay might not be long enough for some systems...
-
-	usleep (1e5);
-
       endwhile
 
       ## Handle last plot.
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,22 @@
+Mon Jun 22 22:13:38 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* variables.cc (is_valid_function): Provide version that takes
+	function name as string.
+
+	* parse.y (binary_expr): Fix thinko that resulted in incorrect
+	evaluation of -x^y.  Thanks to Richard Allan Holcombe
+	<raholcom@unity.ncsu.edu>.
+	(feval): Don't attempt to copy nonexistent arg names.
+
+Mon Jun 22 21:35:50 1998  Richard Allan Holcombe <raholcom@unity.ncsu.edu>
+
+	* xpow.cc (xpow): Improve efficiency for matrix^(scalar int) case.
+
+Thu Jun  4 12:42:46 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* ov-usr-fcn.cc (octave_user_function::octave_all_va_args): 
+	If num_args_passed < num_named_args, create zero length list.
+
 Thu May 14 16:23:15 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* DLD-FUNCTIONS/getrusage.cc: Include sys/types.h too.
--- a/src/ov-usr-fcn.cc
+++ b/src/ov-usr-fcn.cc
@@ -171,11 +171,16 @@
 {
   octave_value_list retval;
 
-  retval.resize (num_args_passed - num_named_args);
+  int n = num_args_passed - num_named_args;
 
-  int k = 0;
-  for (int i = num_named_args; i < num_args_passed; i++)
-    retval(k++) = args_passed(i);
+  if (n > 0)
+    {
+      retval.resize (n);
+
+      int k = 0;
+      for (int i = num_named_args; i < num_args_passed; i++)
+	retval(k++) = args_passed(i);
+    }
 
   return retval;
 }
--- a/src/parse.y
+++ b/src/parse.y
@@ -31,6 +31,7 @@
 #include <config.h>
 #endif
 
+#include <cassert>
 #include <cstdio>
 
 #ifdef YYBYACC
@@ -620,6 +621,8 @@
 
 prefix_expr	: postfix_expr
 		  { $$ = $1; }
+		| binary_expr
+		  { $$ = $1; }
 		| PLUS_PLUS prefix_expr %prec UNARY
 		  { $$ = make_prefix_op (PLUS_PLUS, $2, $1); }
 		| MINUS_MINUS prefix_expr %prec UNARY
@@ -632,31 +635,29 @@
 		  { $$ = make_prefix_op ('-', $2, $1); }
 		;
 
-binary_expr	: prefix_expr
-		  { $$ = $1; }
-		| binary_expr POW binary_expr
+binary_expr	: prefix_expr POW prefix_expr
 		  { $$ = make_binary_op (POW, $1, $2, $3); }
-		| binary_expr EPOW binary_expr
+		| prefix_expr EPOW prefix_expr
 		  { $$ = make_binary_op (EPOW, $1, $2, $3); }
-		| binary_expr '+' binary_expr
+		| prefix_expr '+' prefix_expr
 		  { $$ = make_binary_op ('+', $1, $2, $3); }
-		| binary_expr '-' binary_expr
+		| prefix_expr '-' prefix_expr
 		  { $$ = make_binary_op ('-', $1, $2, $3); }
-		| binary_expr '*' binary_expr
+		| prefix_expr '*' prefix_expr
 		  { $$ = make_binary_op ('*', $1, $2, $3); }
-		| binary_expr '/' binary_expr
+		| prefix_expr '/' prefix_expr
 		  { $$ = make_binary_op ('/', $1, $2, $3); }
-		| binary_expr EPLUS binary_expr
+		| prefix_expr EPLUS prefix_expr
 		  { $$ = make_binary_op ('+', $1, $2, $3); }
-		| binary_expr EMINUS binary_expr
+		| prefix_expr EMINUS prefix_expr
 		  { $$ = make_binary_op ('-', $1, $2, $3); }
-		| binary_expr EMUL binary_expr
+		| prefix_expr EMUL prefix_expr
 		  { $$ = make_binary_op (EMUL, $1, $2, $3); }
-		| binary_expr EDIV binary_expr
+		| prefix_expr EDIV prefix_expr
 		  { $$ = make_binary_op (EDIV, $1, $2, $3); }
-		| binary_expr LEFTDIV binary_expr
+		| prefix_expr LEFTDIV prefix_expr
 		  { $$ = make_binary_op (LEFTDIV, $1, $2, $3); }
-		| binary_expr ELEFTDIV binary_expr
+		| prefix_expr ELEFTDIV prefix_expr
 		  { $$ = make_binary_op (ELEFTDIV, $1, $2, $3); }
 		;
 
@@ -664,9 +665,9 @@
 		  { $$ = finish_colon_expression ($1); }
 		;
 
-colon_expr1	: binary_expr
+colon_expr1	: prefix_expr
 		  { $$ = new tree_colon_expression ($1); }
-		| colon_expr1 ':' binary_expr
+		| colon_expr1 ':' prefix_expr
 		  {
 		    if (! ($$ = $1->append ($3)))
 		      ABORT_PARSE;
@@ -2984,22 +2985,27 @@
 
       if (! error_state)
 	{
-	  string_vector arg_names = args.name_tags ();
-
 	  int tmp_nargin = args.length () - 1;
 
 	  octave_value_list tmp_args (tmp_nargin, octave_value ());
 
-	  string_vector tmp_arg_names (tmp_nargin);
-
 	  for (int i = 0; i < tmp_nargin; i++)
+	    tmp_args(i) = args(i+1);
+
+	  string_vector arg_names = args.name_tags ();
+
+	  if (! arg_names.empty ())
 	    {
-	      tmp_args(i) = args(i+1);
-	      tmp_arg_names(i) = arg_names(i+1);
+	      assert (arg_names.length () == tmp_nargin + 1);
+
+	      string_vector tmp_arg_names (tmp_nargin);
+
+	      for (int i = 0; i < tmp_nargin; i++)
+		tmp_arg_names(i) = arg_names(i+1);
+
+	      tmp_args.stash_name_tags (tmp_arg_names);
 	    }
 
-	  tmp_args.stash_name_tags (tmp_arg_names);
-
 	  retval = feval (name, tmp_args, nargout);
 	}
     }
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -134,23 +134,10 @@
 // Is this octave_value a valid function?
 
 octave_function *
-is_valid_function (const octave_value& arg, const string& warn_for, bool warn)
+is_valid_function (const string& fcn_name, const string& warn_for, bool warn)
 {
   octave_function *ans = 0;
 
-  string fcn_name;
-
-  if (arg.is_string ())
-    fcn_name = arg.string_value ();
-
-  if (fcn_name.empty () || error_state)
-    {
-      if (warn)
-	error ("%s: expecting function name as argument",
-	       warn_for.c_str ());
-      return ans;
-    }
-
   symbol_record *sr = 0;
 
   if (! fcn_name.empty ())
@@ -174,6 +161,24 @@
 }
 
 octave_function *
+is_valid_function (const octave_value& arg, const string& warn_for, bool warn)
+{
+  octave_function *ans = 0;
+
+  string fcn_name;
+
+  if (arg.is_string ())
+    fcn_name = arg.string_value ();
+
+  if (! error_state)
+    ans = is_valid_function (fcn_name, warn_for, warn);
+  else if (warn)
+    error ("%s: expecting function name as argument", warn_for.c_str ());
+
+  return ans;
+}
+
+octave_function *
 extract_function (const octave_value& arg, const string& warn_for,
 		  const string& fname, const string& header,
 		  const string& trailer)
--- a/src/variables.h
+++ b/src/variables.h
@@ -53,6 +53,9 @@
 is_valid_function (const octave_value&, const string&, bool warn = false); 
 
 extern octave_function *
+is_valid_function (const string&, const string&, bool warn = false); 
+
+extern octave_function *
 extract_function (const octave_value& arg, const string& warn_for,
 		  const string& fname, const string& header,
 		  const string& trailer);
--- a/src/xpow.cc
+++ b/src/xpow.cc
@@ -194,8 +194,19 @@
 		atmp = a;
 
 	      Matrix result (atmp);
-	      for (int i = 1; i < btmp; i++)
-		result = result * atmp;
+
+	      btmp--;
+
+	      while (btmp > 0)
+		{
+		  if (btmp & 1)
+		    result = result * atmp;
+
+		  btmp >>= 1;
+
+		  if (btmp > 0)
+		    atmp = atmp * atmp;
+		}
 
 	      retval = result;
 	    }
@@ -379,8 +390,19 @@
 		atmp = a;
 
 	      ComplexMatrix result (atmp);
-	      for (int i = 1; i < btmp; i++)
-		result = result * atmp;
+
+	      btmp--;
+
+	      while (btmp > 0)
+		{
+		  if (btmp & 1)
+		    result = result * atmp;
+
+		  btmp >>= 1;
+
+		  if (btmp > 0)
+		    atmp = atmp * atmp;
+		}
 
 	      retval = result;
 	    }