Revision 303 trunk/src/linad99/expm.cpp

expm.cpp (revision 303)
218 218
   cltudecomp clu = xludecomp_pivot_for_expm_solve(aa,index2);
219 219

  
220 220
   //check if invertable
221
   double det = 1.0;
221
	double ln_det = 0.0;
222

  
222 223
   for (int i = lb; i <= ub; i++)
223 224
   {
224
      det *= clu(i, i);
225
	ln_det += log(clu(i, i));
225 226
   }
226
   if (det == 0.0)
227
	if(exp(ln_det)==0.0)
227 228
   {
228 229
      cerr <<
229 230
	 "Error in matrix inverse -- matrix singular in solve(dvar_matrix)\n";
......
283 284
   dmatrix & alpha = clu1.get_L();
284 285

  
285 286
   //check if invertable --- may be able to get rid of this check
286
   double det = 1.0;
287
	double ln_det = 0.0;
287 288
   for (int i = lb; i <= ub; i++)
288 289
   {
289
      det *= clu1(i, i);
290
		ln_det += log(clu1(i, i));
290 291
   }
291
   if (det == 0.0)
292
	if(exp(ln_det)==0.0)
292 293
   {
293 294
      cerr <<
294 295
	 "Error in matrix inverse -- matrix singular in solve(dvar_matrix)\n";

Also available in: Unified diff