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

Comparing:
trunk/src/math/Vector.hpp (file contents), Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
branches/development/src/math/Vector.hpp (file contents), Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 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 268 | Line 269 | namespace OpenMD {
269      inline void mul( const Vector<Real, Dim>& v1, Real s) {
270        for (unsigned int i = 0; i < Dim; i++)
271          this->data_[i] = s * v1.data_[i];
272 +    }
273 +
274 +    /**
275 +     * Sets the elements of this vector to the multiplication of
276 +     * elements of two other vectors.  Not to be confused with scalar
277 +     * multiplication (mul) or dot products.
278 +     *
279 +     * (*this.data_[i] =  v1.data_[i] * v2.data_[i]).
280 +     * @param v1 the first vector            
281 +     * @param v2 the second vector
282 +     */
283 +    inline void Vmul( const Vector<Real, Dim>& v1, const Vector<Real, Dim>& v2) {
284 +      for (unsigned int i = 0; i < Dim; i++)
285 +        this->data_[i] = v1.data_[i] * v2.data_[i];
286      }
287  
288      /**
# Line 289 | Line 304 | namespace OpenMD {
304          this->data_[i] = v1.data_[i] / s;
305      }
306  
307 +    /**
308 +     * Sets the elements of this vector to the division of
309 +     * elements of two other vectors.  Not to be confused with scalar
310 +     * division (div)
311 +     *
312 +     * (*this.data_[i] =  v1.data_[i] / v2.data_[i]).
313 +     * @param v1 the first vector            
314 +     * @param v2 the second vector
315 +     */
316 +    inline void Vdiv( const Vector<Real, Dim>& v1, const Vector<Real, Dim>& v2) {
317 +      for (unsigned int i = 0; i < Dim; i++)
318 +        this->data_[i] = v1.data_[i] / v2.data_[i];
319 +    }
320 +
321 +
322      /** @see #add */
323      inline Vector<Real, Dim>& operator +=( const Vector<Real, Dim>& v1 ) {
324        add(v1);
# Line 322 | Line 352 | namespace OpenMD {
352        tmp = 0;
353        for (unsigned int i = 0; i < Dim; i++)
354          tmp += this->data_[i];
355 +      return tmp;  
356 +    }
357 +
358 +    /**
359 +     * Returns the product of all elements of this vector.
360 +     * @return the product of all elements of this vector
361 +     */
362 +    inline Real componentProduct() {
363 +      Real tmp;
364 +      tmp = 1;
365 +      for (unsigned int i = 0; i < Dim; i++)
366 +        tmp *= this->data_[i];
367        return tmp;  
368      }
369              
# Line 458 | Line 500 | namespace OpenMD {
500      return tmp;
501    }
502  
503 +
504 +  
505 +
506    /**
507 +   * Returns the wide dot product of three Vectors.  Compare with
508 +   * Rapaport's VWDot function.
509 +   *
510 +   * @param v1 first vector
511 +   * @param v2 second vector
512 +   * @param v3 third vector
513 +   * @return the wide dot product of v1, v2, and v3.
514 +   */
515 +  template<typename Real, unsigned int Dim>    
516 +  inline Real dot( const Vector<Real, Dim>& v1, const Vector<Real, Dim>& v2, const Vector<Real, Dim>& v3 ) {
517 +    Real tmp;
518 +    tmp = 0;
519 +
520 +    for (unsigned int i = 0; i < Dim; i++)
521 +      tmp += v1[i] * v2[i] * v3[i];
522 +
523 +    return tmp;
524 +  }
525 +
526 +
527 +  /**
528     * Returns the distance between  two Vectors
529     * @param v1 first vector
530     * @param v2 second vector

Comparing:
trunk/src/math/Vector.hpp (property svn:keywords), Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
branches/development/src/math/Vector.hpp (property svn:keywords), Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines