# HG changeset patch # User jwe # Date 1099517023 0 # Node ID 4689ee5e88ec1bc4713097cc6848a033c46d9989 # Parent 34a904ac130de742fb65d43cbf11a06ce84b1cc1 [project @ 2004-11-03 21:23:42 by jwe] diff -r 34a904ac130d -r 4689ee5e88ec liboctave/CMatrix.cc --- a/liboctave/CMatrix.cc Tue Nov 02 03:08:10 2004 +0000 +++ b/liboctave/CMatrix.cc Wed Nov 03 21:23:43 2004 +0000 @@ -1025,19 +1025,20 @@ else if (calc_cond) { // Now calculate the condition number for non-singular matrix. + int zgecon_info = 0; char job = '1'; Array rz (2 * nc); double *prz = rz.fortran_vec (); F77_XFCN (zgecon, ZGECON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, tmp_data, nr, anorm, - rcond, pz, prz, info + rcond, pz, prz, zgecon_info F77_CHAR_ARG_LEN (1))); if (f77_exception_encountered) (*current_liboctave_error_handler) ("unrecoverable error in zgecon"); - if (info != 0) + if (zgecon_info != 0) info = -1; } @@ -1045,14 +1046,16 @@ retval = *this; // Restore contents. else { + int zgetri_info = 0; + F77_XFCN (zgetri, ZGETRI, (nc, tmp_data, nr, pipvt, - pz, lwork, info)); + pz, lwork, zgetri_info)); if (f77_exception_encountered) (*current_liboctave_error_handler) ("unrecoverable error in zgetri"); - if (info != 0) + if (zgetri_info != 0) info = -1; } } diff -r 34a904ac130d -r 4689ee5e88ec liboctave/ChangeLog --- a/liboctave/ChangeLog Tue Nov 02 03:08:10 2004 +0000 +++ b/liboctave/ChangeLog Wed Nov 03 21:23:43 2004 +0000 @@ -1,3 +1,8 @@ +2004-11-03 John W. Eaton + + * dMatrix.cc (Matrix::inverse): Return info == -1 for any failure. + * CMatrix.cc (ComplexMatrix::inverse): Likewise. + 2004-10-19 John W. Eaton * Array.cc (assignN): Avoid resizing if assignment will fail. diff -r 34a904ac130d -r 4689ee5e88ec liboctave/dMatrix.cc --- a/liboctave/dMatrix.cc Tue Nov 02 03:08:10 2004 +0000 +++ b/liboctave/dMatrix.cc Wed Nov 03 21:23:43 2004 +0000 @@ -692,20 +692,22 @@ info = -1; else if (calc_cond) { + int dgecon_info = 0; + // Now calculate the condition number for non-singular matrix. char job = '1'; Array iz (nc); int *piz = iz.fortran_vec (); F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, tmp_data, nr, anorm, - rcond, pz, piz, info + rcond, pz, piz, dgecon_info F77_CHAR_ARG_LEN (1))); if (f77_exception_encountered) (*current_liboctave_error_handler) ("unrecoverable error in dgecon"); - if (info != 0) + if (dgecon_info != 0) info = -1; } @@ -713,14 +715,16 @@ retval = *this; // Restore matrix contents. else { + int dgetri_info = 0; + F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt, - pz, lwork, info)); + pz, lwork, dgetri_info)); if (f77_exception_encountered) (*current_liboctave_error_handler) ("unrecoverable error in dgetri"); - if (info != 0) + if (dgetri_info != 0) info = -1; } } diff -r 34a904ac130d -r 4689ee5e88ec src/data.cc --- a/src/data.cc Tue Nov 02 03:08:10 2004 +0000 +++ b/src/data.cc Wed Nov 03 21:23:43 2004 +0000 @@ -406,6 +406,10 @@ Cumulative product of elements along dimension @var{dim}. If\n\ @var{dim} is omitted, it defaults to 1 (column-wise cumulative\n\ products).\n\ +\n\ +As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ +return the cumulative product of the elements as a vector with the\n\ +same orientation as @var{x}.\n\ @end deftypefn") { DATA_REDUCTION (cumprod); @@ -416,6 +420,10 @@ @deftypefn {Built-in Function} {} cumsum (@var{x}, @var{dim})\n\ Cumulative sum of elements along dimension @var{dim}. If @var{dim}\n\ is omitted, it defaults to 1 (column-wise cumulative sums).\n\ +\n\ +As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ +return the cumulative sum of the elements as a vector with the\n\ +same orientation as @var{x}.\n\ @end deftypefn") { DATA_REDUCTION (cumsum); @@ -663,6 +671,9 @@ @deftypefn {Built-in Function} {} prod (@var{x}, @var{dim})\n\ Product of elements along dimension @var{dim}. If @var{dim} is\n\ omitted, it defaults to 1 (column-wise products).\n\ +\n\ +As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ +return the product of the elements.\n\ @end deftypefn") { DATA_REDUCTION (prod); @@ -1058,6 +1069,9 @@ @deftypefn {Built-in Function} {} sum (@var{x}, @var{dim})\n\ Sum of elements along dimension @var{dim}. If @var{dim} is\n\ omitted, it defaults to 1 (column-wise sum).\n\ +\n\ +As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ +return the sum of the elements.\n\ @end deftypefn") { DATA_REDUCTION (sum); @@ -1069,7 +1083,10 @@ Sum of squares of elements along dimension @var{dim}. If @var{dim}\n\ is omitted, it defaults to 1 (column-wise sum of squares).\n\ \n\ -This function is equivalent to computing\n\ +As a special case, if @var{x} is a vector and @var{dim} is omitted,\n\ +return the sum of squares of the elements.\n\ +\n\ +This function is conceptually equivalent to computing\n\ @example\n\ sum (x .* conj (x), dim)\n\ @end example\n\