Mercurial > hg > octave-nkf
changeset 9821:84199c9fc69c
fix bug in balance
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 17 Nov 2009 04:08:23 +0100 |
parents | a262b41eaa15 |
children | 64270d3ad469 |
files | liboctave/ChangeLog liboctave/base-aepbal.h src/ChangeLog src/DLD-FUNCTIONS/balance.cc |
diffstat | 4 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2009-11-17 Jaroslav Hajek <highegg@gmail.com> + + * base-aepbal.h (permuting_vector): Fix lower part swapping. + 2009-11-13 John W. Eaton <jwe@octave.org> * Makefile.am (liboctave_la_CPPFLAGS): Add @OCTAVE_DLL_DEFS@ to
--- a/liboctave/base-aepbal.h +++ b/liboctave/base-aepbal.h @@ -62,16 +62,12 @@ for (octave_idx_type i = n-1; i >= ihi; i--) { octave_idx_type j = scale(i) - 1; - octave_idx_type k = pv(j); - pv(j) = pv(i); - pv(i) = k; + std::swap (pv(i), pv(j)); } - for (octave_idx_type i = ilo-2; i >= 0; i--) + for (octave_idx_type i = 0; i < ilo-1; i++) { octave_idx_type j = scale(i) - 1; - octave_idx_type k = pv(j); - pv(j) = pv(i); - pv(i) = k; + std::swap (pv(i), pv(j)); } return pv;
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2009-11-17 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTIONS/balance.cc: Fix docs. + 2009-11-13 John W. Eaton <jwe@octave.org> * Makefile.am (liboctinterp_la_CPPFLAGS): Define.
--- a/src/DLD-FUNCTIONS/balance.cc +++ b/src/DLD-FUNCTIONS/balance.cc @@ -63,7 +63,7 @@ \n\ If two output values are requested, @code{balance} returns \n\ the diagonal @code{d} and the permutation @code{p} separately as vectors. \n\ -In this case, @code{dd = eye(n)(p,:) * diag (d)}, where @code{n} is the matrix \n\ +In this case, @code{dd = eye(n)(:,p) * diag (d)}, where @code{n} is the matrix \n\ size. \n\ \n\ If four output values are requested, compute @code{aa = cc*a*dd} and\n\