Mercurial > hg > octave-jordi
diff liboctave/CMatrix.cc @ 8335:64cf956a109c
templatize & fix DET
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 19 Nov 2008 11:23:07 +0100 (2008-11-19) |
parents | 851803f7bb4d |
children | 9813c07ca946 |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -40,7 +40,7 @@ #include "Array-util.h" #include "CMatrix.h" #include "CmplxAEPBAL.h" -#include "CmplxDET.h" +#include "DET.h" #include "CmplxSCHUR.h" #include "CmplxSVD.h" #include "CmplxCHOL.h" @@ -1631,33 +1631,13 @@ } else { - Complex c = 1.0; - int e = 0; - + retval = ComplexDET (1.0); + for (octave_idx_type i = 0; i < nc; i++) { - if (ipvt(i) != (i+1)) - c = -c; - - c *= atmp(i,i); - - if (c == 0.0) - break; - - while (std::abs(c) < 0.5) - { - c *= 2.0; - e--; - } - - while (std::abs(c) >= 2.0) - { - c /= 2.0; - e++; - } - } - - retval = ComplexDET (c, e); + Complex c = atmp(i,i); + retval *= (ipvt(i) != (i+1)) ? -c : c; + } } } }