--- liboctave/dMatrix.cc.orig 2008-01-26 09:45:53.000000000 +0100 +++ liboctave/dMatrix.cc 2008-01-26 09:46:49.000000000 +0100 @@ -2547,48 +2547,32 @@ for (octave_idx_type i = 0; i < nc; i++) iperm(i) = i; // identity permutation - // leading permutations in forward order - for (octave_idx_type i = 0; i < (ilo-1); i++) + // trailing permutations must be done in reverse order + for (octave_idx_type i = nc - 1; i >= ihi; i--) { octave_idx_type swapidx = static_cast (dpermute(i)) - 1; octave_idx_type tmp = iperm(i); - iperm(i) = iperm (swapidx); + iperm(i) = iperm(swapidx); iperm(swapidx) = tmp; } - // construct inverse balancing permutation vector - Array 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--) + // leading permutations in forward order + for (octave_idx_type i = 0; i < (ilo-1); i++) { octave_idx_type swapidx = static_cast (dpermute(i)) - 1; octave_idx_type tmp = iperm(i); - iperm(i) = iperm(swapidx); + iperm(i) = iperm (swapidx); iperm(swapidx) = tmp; } // construct inverse balancing permutation vector + Array 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; - tmpMat = retval; + 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));