Changeset 788


Ignore:
Timestamp:
Mar 10, 2007, 8:59:51 PM (15 years ago)
Author:
Jari Häkkinen
Message:

Improved comparison operator and equal function doxygen doc. Added for self comparison in equal.

Location:
trunk/yat/utility
Files:
2 edited

Legend:

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

    r780 r788  
    189189  bool matrix::equal(const matrix& other, const double d) const
    190190  {
     191    if (this==&other)
     192      return true;
    191193    if (columns()!=other.columns() || rows()!=other.rows())
    192194      return false;
  • trunk/yat/utility/matrix.h

    r776 r788  
    157157    void div_elements(const matrix& b);
    158158
    159     ///
    160     /// Check whether matrices are equal within a user defined
    161     /// precision, set by \a precision.
    162     ///
    163     /// @return True if each element deviates less or equal than \a
    164     /// d. If any matrix contain a NaN, false is always returned.
    165     ///
     159    /**
     160       \brief Check whether matrices are equal within a user defined
     161       precision, set by \a precision.
     162
     163       \return True if each element deviates less or equal than \a
     164       d. If any matrix contain a NaN, false is always returned.
     165
     166       \see operator== and operator!=
     167    */
    166168    bool equal(const matrix&, const double precision=0) const;
    167169
     
    289291    const double& operator()(size_t row,size_t column) const;
    290292
    291     ///
    292     /// @brief Comparison operator.
    293     ///
    294     /// @return True if all elements are equal otherwise False.
    295     ///
    296     /// @see equal
    297     ///
     293    /**
     294       \brief Comparison operator. Takes squared time.
     295
     296       Checks are performed with exact matching, i.e., rounding off
     297       effects may destroy comparison. Use the equal function for
     298       comparing elements within a user defined precision.
     299
     300       \return True if all elements are equal otherwise false.
     301
     302       \see equal
     303    */
    298304    bool operator==(const matrix& other) const;
    299305
    300     ///
    301     /// @brief Comparison operator.
    302     ///
    303     /// @return False if all elements are equal otherwise True.
    304     ///
    305     /// @see equal
    306     ///
     306    /**
     307       \brief Comparison operator. Takes squared time.
     308
     309       Checks are performed with exact matching, i.e., rounding off
     310       effects may destroy comparison. Use the equal function for
     311       comparing elements within a user defined precision.
     312
     313       \return False if all elements are equal otherwise true.
     314
     315       \see equal
     316    */
    307317    bool operator!=(const matrix& other) const;
    308318
Note: See TracChangeset for help on using the changeset viewer.