# HG changeset patch # User jwe # Date 879479972 0 # Node ID 528f4270e904b880c1f31b4d9f8ab9b1ee7f1db2 # Parent f8e971946a4f5699dee991d49bec8b9361d72b0d [project @ 1997-11-14 03:58:45 by jwe] diff --git a/liboctave/CMatrix.cc b/liboctave/CMatrix.cc --- 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); } } } diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +Thu Nov 13 21:57:16 1997 John W. Eaton + + * CMatrix.cc (sumsq): Compute equivalent of sum (x .* conj (x)) + Thu Oct 2 17:13:02 1997 Mumit Khan * CRowVector.cc (linspace): Removed attempt for implicit conversion diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +Thu Nov 13 16:20:40 1997 John W. Eaton + + * 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 * defun-int.h (DEFINE_FUN_INSTALLER_FUN): Set installed to true diff --git a/src/data.cc b/src/data.cc --- 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; diff --git a/src/parse.y b/src/parse.y --- 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 ());