Changeset 1682


Ignore:
Timestamp:
Dec 29, 2008, 10:27:32 PM (15 years ago)
Author:
Peter
Message:

prefer std::abs and re-use code

Location:
trunk/yat/utility
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/Matrix.cc

    r1681 r1682  
    286286      return false;
    287287    for (size_t i=0; i<rows(); i++)
    288       for (size_t j=0; j<columns(); j++)
    289         // The two last condition checks are needed for NaN detection
    290         if (fabs( (*this)(i,j)-other(i,j) ) > d ||
    291             (*this)(i,j)!=(*this)(i,j) || other(i,j)!=other(i,j))
    292           return false;
     288      if (!row_const_view(i).equal(other.row_const_view(i), d))
     289        return false;
    293290    return true;
    294291  }
  • trunk/yat/utility/VectorBase.cc

    r1680 r1682  
    7979    // abort the program.
    8080    for (size_t i=0; i<size(); ++i)
    81       if (fabs( (*this)(i)-other(i) ) > d ||
     81      if (std::abs( (*this)(i)-other(i) ) > d ||
    8282          std::isnan((*this)(i)) || std::isnan(other(i)) )
    8383        return false;
Note: See TracChangeset for help on using the changeset viewer.