~jrheinlaender/eqc/eqc

« back to all changes in this revision

Viewing changes to src/eqc.cpp

  • Committer: jrheinlaender
  • Date: 2014-09-25 18:53:43 UTC
  • Revision ID: svn-v4:1ad18896-7416-496f-9572-ea5bada698e5::140
Remove unnecessary conversion to double in iterate()

Show diffs side-by-side

added added

removed removed

Lines of Context:
867
867
  const matrix eqc::iterate(const matrix& syms, const matrix& exprs, const matrix& start, const matrix& conv, const unsigned maxiter) {
868
868
    unsigned rows = syms.rows();
869
869
 
870
 
    // Convert convergence criteria to double
 
870
    // Convert convergence criteria to numerics
871
871
    matrix criteria(rows,1);
872
872
    for (unsigned row = 0; row < rows; ++row)
873
 
      criteria(row,0) = ex_to<numeric>(conv(row,0)).to_double();
 
873
      criteria(row,0) = ex_to<numeric>(conv(row,0));
874
874
 
875
875
    // Iteration zero
876
876
    unsigned iter = 0;
899
899
      for (unsigned row = 0; row < rows; ++row) {
900
900
        ex diff = (*nextvar)(row,0) - (*var)(row,0);
901
901
        if (diff.info(info_flags::real)) {
902
 
          if (fabs(ex_to<numeric>(diff).to_double()) > criteria(row,0)) {
 
902
          if (abs(ex_to<numeric>(diff)) > criteria(row,0)) {
903
903
            converged = false;
904
904
            break;
905
905
          }