ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/math/Vector.hpp
(Generate patch)

Comparing branches/development/src/math/Vector.hpp (file contents):
Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC vs.
Revision 1760 by gezelter, Thu Jun 21 19:26:46 2012 UTC

# Line 73 | Line 73 | namespace OpenMD {
73    inline bool equal(RealType e1, RealType e2) {
74      return fabs(e1 - e2) < epsilon;
75    }
76
76      
77    /**
78     * @class Vector Vector.hpp "math/Vector.hpp"
# Line 285 | Line 284 | namespace OpenMD {
284          this->data_[i] = v1.data_[i] * v2.data_[i];
285      }
286  
287 +    /* replaces the elements with the absolute values of those elements */
288 +    inline Vector<Real, Dim>& abs() {
289 +      for (unsigned int i = 0; i < Dim; i++) {
290 +        this->data_[i] = std::abs(this->data_[i]);
291 +      }
292 +      return *this;
293 +    }
294 +    
295 +    /* returns the maximum value in this vector */
296 +    inline Real max() {
297 +      Real val = this->data_[0];
298 +      for (unsigned int i = 0; i < Dim; i++) {
299 +        if (this->data_[i] > val) val = this->data_[i];
300 +      }
301 +      return val;
302 +    }
303 +    
304      /**
305       * Sets the value of this vector to the scalar division of itself  (*this /= s ).
306       * @param s the scalar value

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines