changeset 3095:528f4270e904

[project @ 1997-11-14 03:58:45 by jwe]
author jwe
date Fri, 14 Nov 1997 03:59:32 +0000
parents f8e971946a4f
children ff8b4d6371b3
files liboctave/CMatrix.cc liboctave/ChangeLog src/ChangeLog src/data.cc src/parse.y
diffstat 5 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/CMatrix.cc
+++ b/liboctave/CMatrix.cc
@@ -2366,7 +2366,7 @@
 	  for (int j = 0; j < nc; j++)
 	    {
 	      Complex d = elem (0, j);
-	      retval.elem (0, 0) += d * d;
+	      retval.elem (0, 0) += d * conj (d);
 	    }
 	}
       else if (nc == 1)
@@ -2376,7 +2376,7 @@
 	  for (int i = 0; i < nr; i++)
 	    {
 	      Complex d = elem (i, 0);
-	      retval.elem (0, 0) += d * d;
+	      retval.elem (0, 0) += d * conj (d);
 	    }
 	}
       else
@@ -2388,7 +2388,7 @@
 	      for (int i = 0; i < nr; i++)
 		{
 		  Complex d = elem (i, j);
-		  retval.elem (0, j) += d * d;
+		  retval.elem (0, j) += d * conj (d);
 		}
 	    }
 	}
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,7 @@
+Thu Nov 13 21:57:16 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* CMatrix.cc (sumsq): Compute equivalent of sum (x .* conj (x))
+
 Thu Oct  2 17:13:02 1997  Mumit Khan  <khan@dhaka.xraylith.wisc.edu>
 
 	* CRowVector.cc (linspace): Removed attempt for implicit conversion 
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+Thu Nov 13 16:20:40 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* data.cc (sumsq): Fix doc string.
+
+	* parse.y (Fsource): Call parse_fcn_file, not parse_and_execute.
+
 Tue Oct  7 16:51:01 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* defun-int.h (DEFINE_FUN_INSTALLER_FUN): Set installed to true
--- a/src/data.cc
+++ b/src/data.cc
@@ -688,7 +688,13 @@
 }
 
 DEFUN (sumsq, args, ,
-  "sumsq (X): sum of squares of elements")
+  "sumsq (X): sum of squares of elements.\n\
+\n\
+This function is equivalent to computing\n\
+\n\
+  sum (X .* conj (X))\n\
+\n\
+but it uses less memory and avoids calling conj if X is real.")
 {
   octave_value_list retval;
 
--- a/src/parse.y
+++ b/src/parse.y
@@ -2873,7 +2873,7 @@
 	{
 	  file = file_ops::tilde_expand (file);
 
-	  parse_and_execute (file, false, "source");
+	  parse_fcn_file (true, file);
 
 	  if (error_state)
 	    error ("source: error sourcing file `%s'", file.c_str ());