lemon/lp_base.h
changeset 1778 4ba7965386fb
parent 1766 6c59b1386fe8
child 1787 932b8490caf0
equal deleted inserted replaced
15:16fc7f6031dc 16:41137b2da369
   287       void simplify() {
   287       void simplify() {
   288 	for (Base::iterator i=Base::begin(); i!=Base::end();) {
   288 	for (Base::iterator i=Base::begin(); i!=Base::end();) {
   289 	  Base::iterator j=i;
   289 	  Base::iterator j=i;
   290 	  ++j;
   290 	  ++j;
   291 	  if ((*i).second==0) Base::erase(i);
   291 	  if ((*i).second==0) Base::erase(i);
       
   292 	  j=i;
       
   293 	}
       
   294       }
       
   295 
       
   296       ///Removes the coefficients closer to zero than \c tolerance.
       
   297       void simplify(double &tolerance) {
       
   298 	for (Base::iterator i=Base::begin(); i!=Base::end();) {
       
   299 	  Base::iterator j=i;
       
   300 	  ++j;
       
   301 	  if (std::fabs((*i).second)<tolerance) Base::erase(i);
   292 	  j=i;
   302 	  j=i;
   293 	}
   303 	}
   294       }
   304       }
   295 
   305 
   296       ///Sets all coefficients and the constant component to 0.
   306       ///Sets all coefficients and the constant component to 0.
   497 	  if ((*i).second==0) Base::erase(i);
   507 	  if ((*i).second==0) Base::erase(i);
   498 	  j=i;
   508 	  j=i;
   499 	}
   509 	}
   500       }
   510       }
   501 
   511 
       
   512       ///Removes the coefficients closer to zero than \c tolerance.
       
   513       void simplify(double &tolerance) {
       
   514 	for (Base::iterator i=Base::begin(); i!=Base::end();) {
       
   515 	  Base::iterator j=i;
       
   516 	  ++j;
       
   517 	  if (std::fabs((*i).second)<tolerance) Base::erase(i);
       
   518 	  j=i;
       
   519 	}
       
   520       }
       
   521 
       
   522 
   502       ///Sets all coefficients to 0.
   523       ///Sets all coefficients to 0.
   503       void clear() {
   524       void clear() {
   504 	Base::clear();
   525 	Base::clear();
   505       }
   526       }
   506 
   527