Mercurial > hg > octave-nkf
changeset 5061:4689ee5e88ec
[project @ 2004-11-03 21:23:42 by jwe]
author | jwe |
---|---|
date | Wed, 03 Nov 2004 21:23:43 +0000 |
parents | 34a904ac130d |
children | 4114f428d682 |
files | liboctave/CMatrix.cc liboctave/ChangeLog liboctave/dMatrix.cc src/data.cc |
diffstat | 4 files changed, 38 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -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<double> 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; } }
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2004-11-03 John W. Eaton <jwe@octave.org> + + * dMatrix.cc (Matrix::inverse): Return info == -1 for any failure. + * CMatrix.cc (ComplexMatrix::inverse): Likewise. + 2004-10-19 John W. Eaton <jwe@octave.org> * Array.cc (assignN): Avoid resizing if assignment will fail.
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -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<int> 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; } }
--- a/src/data.cc +++ b/src/data.cc @@ -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\