lemon/lp_base.h
changeset 1771 5faaa9880d4d
parent 1766 6c59b1386fe8
child 1787 932b8490caf0
     1.1 --- a/lemon/lp_base.h	Fri Nov 04 16:18:51 2005 +0000
     1.2 +++ b/lemon/lp_base.h	Fri Nov 04 16:21:41 2005 +0000
     1.3 @@ -293,6 +293,16 @@
     1.4  	}
     1.5        }
     1.6  
     1.7 +      ///Removes the coefficients closer to zero than \c tolerance.
     1.8 +      void simplify(double &tolerance) {
     1.9 +	for (Base::iterator i=Base::begin(); i!=Base::end();) {
    1.10 +	  Base::iterator j=i;
    1.11 +	  ++j;
    1.12 +	  if (std::fabs((*i).second)<tolerance) Base::erase(i);
    1.13 +	  j=i;
    1.14 +	}
    1.15 +      }
    1.16 +
    1.17        ///Sets all coefficients and the constant component to 0.
    1.18        void clear() {
    1.19  	Base::clear();
    1.20 @@ -499,6 +509,17 @@
    1.21  	}
    1.22        }
    1.23  
    1.24 +      ///Removes the coefficients closer to zero than \c tolerance.
    1.25 +      void simplify(double &tolerance) {
    1.26 +	for (Base::iterator i=Base::begin(); i!=Base::end();) {
    1.27 +	  Base::iterator j=i;
    1.28 +	  ++j;
    1.29 +	  if (std::fabs((*i).second)<tolerance) Base::erase(i);
    1.30 +	  j=i;
    1.31 +	}
    1.32 +      }
    1.33 +
    1.34 +
    1.35        ///Sets all coefficients to 0.
    1.36        void clear() {
    1.37  	Base::clear();