Mercurial > octave
changeset 12108:d82388277620 release-3-2-x
fix bug in balance
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 25 Nov 2009 12:05:09 +0100 |
parents | 1fc9fd052f0c |
children | 10dcb8b64e4a |
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 Wed Nov 25 12:05:03 2009 +0100 +++ b/liboctave/ChangeLog Wed Nov 25 12:05:09 2009 +0100 @@ -1,3 +1,7 @@ +2009-11-17 Jaroslav Hajek <highegg@gmail.com> + + * base-aepbal.h (permuting_vector): Fix lower part swapping. + 2009-11-18 David Grundberg <davidg@cs.umu.se> * str-vec.cc (string_vector::list_in_columns): Avoid crash on
--- a/liboctave/base-aepbal.h Wed Nov 25 12:05:03 2009 +0100 +++ b/liboctave/base-aepbal.h Wed Nov 25 12:05:09 2009 +0100 @@ -64,16 +64,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 Wed Nov 25 12:05:03 2009 +0100 +++ b/src/ChangeLog Wed Nov 25 12:05:09 2009 +0100 @@ -1,3 +1,7 @@ +2009-11-17 Jaroslav Hajek <highegg@gmail.com> + + * DLD-FUNCTIONS/balance.cc: Fix docs. + 2009-11-03 David Grundberg <davidg@cs.umu.se> * ov-class.cc (make_idx_args): Call user-defined subsref/subsasgn
--- a/src/DLD-FUNCTIONS/balance.cc Wed Nov 25 12:05:03 2009 +0100 +++ b/src/DLD-FUNCTIONS/balance.cc Wed Nov 25 12:05:09 2009 +0100 @@ -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\