COIN-OR::LEMON - Graph Library

Changeset 1771:5faaa9880d4d in lemon-0.x for lemon


Ignore:
Timestamp:
11/04/05 17:21:41 (18 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2303
Message:

(Dual)Expr::simplify(double tolerance) added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lp_base.h

    r1766 r1771  
    290290          ++j;
    291291          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);
    292302          j=i;
    293303        }
     
    500510      }
    501511
     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
    502523      ///Sets all coefficients to 0.
    503524      void clear() {
Note: See TracChangeset for help on using the changeset viewer.