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

Comparing trunk/src/math/Vector.hpp (file contents):
Revision 1615 by gezelter, Fri Aug 26 17:55:44 2011 UTC vs.
Revision 1782 by gezelter, Wed Aug 22 02:28:28 2012 UTC

# Line 36 | Line 36
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38   * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 < * [4]  Vardeman & Gezelter, in progress (2009).                        
39 > * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 > * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   /**
# Line 72 | Line 73 | namespace OpenMD {
73    inline bool equal(RealType e1, RealType e2) {
74      return fabs(e1 - e2) < epsilon;
75    }
75
76      
77    /**
78     * @class Vector Vector.hpp "math/Vector.hpp"
# Line 107 | Line 107 | namespace OpenMD {
107        return *this;
108      }
109  
110 <    template<typename T>
111 <    inline Vector(const T& s){
110 >    // template<typename T>
111 >    // inline Vector(const T& s){
112 >    inline Vector(const Real& s) {
113        for (unsigned int i = 0; i < Dim; i++)
114 <        this->data_[i] = s;
114 >        this->data_[i] = s;
115      }
116              
117      /** Constructs and initializes a Vector from an array */            
# Line 284 | Line 285 | namespace OpenMD {
285          this->data_[i] = v1.data_[i] * v2.data_[i];
286      }
287  
288 +    /* replaces the elements with the absolute values of those elements */
289 +    inline Vector<Real, Dim>& abs() {
290 +      for (unsigned int i = 0; i < Dim; i++) {
291 +        this->data_[i] = std::abs(this->data_[i]);
292 +      }
293 +      return *this;
294 +    }
295 +    
296 +    /* returns the maximum value in this vector */
297 +    inline Real max() {
298 +      Real val = this->data_[0];
299 +      for (unsigned int i = 0; i < Dim; i++) {
300 +        if (this->data_[i] > val) val = this->data_[i];
301 +      }
302 +      return val;
303 +    }
304 +    
305      /**
306       * Sets the value of this vector to the scalar division of itself  (*this /= s ).
307       * @param s the scalar value

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines