Mercurial > hg > octave-terminal
changeset 7416:a7a987b229b7
[project @ 2008-01-24 08:31:36 by jwe]
author | jwe |
---|---|
date | Thu, 24 Jan 2008 08:31:36 +0000 |
parents | 2da391ef7f55 |
children | 33577b0d4df2 |
files | liboctave/CMatrix.cc liboctave/ChangeLog liboctave/dMatrix.cc |
diffstat | 3 files changed, 41 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -2938,6 +2938,23 @@ iperm(swapidx) = tmp; } + // construct inverse balancing permutation vector + Array<octave_idx_type> invpvec (nc); + for (octave_idx_type i = 0; i < nc; i++) + invpvec(iperm(i)) = i; // Thanks to R. A. Lippert for this method + + OCTAVE_QUIT; + + ComplexMatrix tmpMat = retval; + for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type j = 0; j < nc; j++) + retval(i,j) = tmpMat(invpvec(i),invpvec(j)); + + OCTAVE_QUIT; + + for (octave_idx_type i = 0; i < nc; i++) + iperm(i) = i; // initialize to identity permutation + // trailing permutations must be done in reverse order for (octave_idx_type i = nc - 1; i >= ihi; i--) { @@ -2948,13 +2965,12 @@ } // construct inverse balancing permutation vector - Array<octave_idx_type> invpvec (nc); for (octave_idx_type i = 0; i < nc; i++) invpvec(iperm(i)) = i; // Thanks to R. A. Lippert for this method OCTAVE_QUIT; - ComplexMatrix tmpMat = retval; + tmpMat = retval; for (octave_idx_type i = 0; i < nc; i++) for (octave_idx_type j = 0; j < nc; j++) retval(i,j) = tmpMat(invpvec(i),invpvec(j));
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2008-01-18 Marco Caliari <marco.caliari@univr.it> + + * dMatrix.cc (Matrix::expm): Correctly perform reverse permutation. + * CMatrix.cc (ComplexMatrix::expm): Likewise. + 2008-01-22 Michael Goffioul <michael.goffioul@gmail.com> * oct-time.cc (octave_base_tim::init): Validate pointer argument;
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -2556,6 +2556,23 @@ iperm(swapidx) = tmp; } + // construct inverse balancing permutation vector + Array<octave_idx_type> invpvec (nc); + for (octave_idx_type i = 0; i < nc; i++) + invpvec(iperm(i)) = i; // Thanks to R. A. Lippert for this method + + OCTAVE_QUIT; + + Matrix tmpMat = retval; + for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type j = 0; j < nc; j++) + retval(i,j) = tmpMat(invpvec(i),invpvec(j)); + + OCTAVE_QUIT; + + for (octave_idx_type i = 0; i < nc; i++) + iperm(i) = i; // identity permutation + // trailing permutations must be done in reverse order for (octave_idx_type i = nc - 1; i >= ihi; i--) { @@ -2566,13 +2583,12 @@ } // construct inverse balancing permutation vector - Array<octave_idx_type> invpvec (nc); for (octave_idx_type i = 0; i < nc; i++) invpvec(iperm(i)) = i; // Thanks to R. A. Lippert for this method OCTAVE_QUIT; - Matrix tmpMat = retval; + tmpMat = retval; for (octave_idx_type i = 0; i < nc; i++) for (octave_idx_type j = 0; j < nc; j++) retval(i,j) = tmpMat(invpvec(i),invpvec(j));