equal
deleted
inserted
replaced
294 void simplify() { |
294 void simplify() { |
295 for (Base::iterator i=Base::begin(); i!=Base::end();) { |
295 for (Base::iterator i=Base::begin(); i!=Base::end();) { |
296 Base::iterator j=i; |
296 Base::iterator j=i; |
297 ++j; |
297 ++j; |
298 if ((*i).second==0) Base::erase(i); |
298 if ((*i).second==0) Base::erase(i); |
299 j=i; |
299 i=j; |
300 } |
300 } |
301 } |
301 } |
302 |
302 |
303 ///Removes the coefficients closer to zero than \c tolerance. |
303 ///Removes the coefficients closer to zero than \c tolerance. |
304 void simplify(double &tolerance) { |
304 void simplify(double &tolerance) { |
305 for (Base::iterator i=Base::begin(); i!=Base::end();) { |
305 for (Base::iterator i=Base::begin(); i!=Base::end();) { |
306 Base::iterator j=i; |
306 Base::iterator j=i; |
307 ++j; |
307 ++j; |
308 if (std::fabs((*i).second)<tolerance) Base::erase(i); |
308 if (std::fabs((*i).second)<tolerance) Base::erase(i); |
309 j=i; |
309 i=j; |
310 } |
310 } |
311 } |
311 } |
312 |
312 |
313 ///Sets all coefficients and the constant component to 0. |
313 ///Sets all coefficients and the constant component to 0. |
314 void clear() { |
314 void clear() { |
511 void simplify() { |
511 void simplify() { |
512 for (Base::iterator i=Base::begin(); i!=Base::end();) { |
512 for (Base::iterator i=Base::begin(); i!=Base::end();) { |
513 Base::iterator j=i; |
513 Base::iterator j=i; |
514 ++j; |
514 ++j; |
515 if ((*i).second==0) Base::erase(i); |
515 if ((*i).second==0) Base::erase(i); |
516 j=i; |
516 i=j; |
517 } |
517 } |
518 } |
518 } |
519 |
519 |
520 ///Removes the coefficients closer to zero than \c tolerance. |
520 ///Removes the coefficients closer to zero than \c tolerance. |
521 void simplify(double &tolerance) { |
521 void simplify(double &tolerance) { |
522 for (Base::iterator i=Base::begin(); i!=Base::end();) { |
522 for (Base::iterator i=Base::begin(); i!=Base::end();) { |
523 Base::iterator j=i; |
523 Base::iterator j=i; |
524 ++j; |
524 ++j; |
525 if (std::fabs((*i).second)<tolerance) Base::erase(i); |
525 if (std::fabs((*i).second)<tolerance) Base::erase(i); |
526 j=i; |
526 i=j; |
527 } |
527 } |
528 } |
528 } |
529 |
529 |
530 |
530 |
531 ///Sets all coefficients to 0. |
531 ///Sets all coefficients to 0. |