Revision 303 trunk/src/linad99/dmat38.cpp

dmat38.cpp (revision 303)
54 54

  
55 55
   //check if invertable
56 56
   int i;
57
   double det = 1.0;
57
   double ln_det = 0.0;
58 58
   for (i = lb; i <= ub; i++)
59 59
   {
60
      det *= dcmp(i, i);
60
      ln_det += log(dcmp(i, i));
61 61
   }
62
   if (det == 0.0)
62
   if (exp(ln_det) == 0.0)
63 63
   {
64 64
      cerr <<
65 65
	 "Error in matrix inverse -- matrix singular in solve(dmatrix)\n";

Also available in: Unified diff