diff liboctave/fMatrix.cc @ 8335:64cf956a109c

templatize & fix DET
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 19 Nov 2008 11:23:07 +0100
parents 851803f7bb4d
children 9813c07ca946
line wrap: on
line diff
--- a/liboctave/fMatrix.cc
+++ b/liboctave/fMatrix.cc
@@ -35,7 +35,7 @@
 #include "Array-util.h"
 #include "byte-swap.h"
 #include "fMatrix.h"
-#include "floatDET.h"
+#include "DET.h"
 #include "floatSCHUR.h"
 #include "floatSVD.h"
 #include "floatCHOL.h"
@@ -1296,33 +1296,13 @@
 	    } 
 	  else 
 	    {
-	      float c = 1.0;
-	      int e = 0;
-
+              retval = FloatDET (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 (fabs (c) < 0.5)
-		    {
-		      c *= 2.0;
-		      e--;
-		    }
-
-		  while (fabs (c) >= 2.0)
-		    {
-		      c /= 2.0;
-		      e++;
-		    }
-		}
-
-	      retval = FloatDET (c, e);
+                  float c = atmp(i,i);
+                  retval *= (ipvt(i) != (i+1)) ? -c : c;
+                }
 	    }
 	}
     }