--- trunk/src/math/DynamicRectMatrix.hpp 2013/06/13 14:26:09 1878 +++ trunk/src/math/DynamicRectMatrix.hpp 2013/06/16 15:15:42 1879 @@ -35,7 +35,7 @@ * * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). - * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ @@ -109,7 +109,7 @@ namespace OpenMD { ~DynamicRectMatrix() { deallocate();} /** copy assignment operator */ - DynamicRectMatrix operator =(const DynamicRectMatrix m) { + DynamicRectMatrix operator =(const DynamicRectMatrix &m) { if (this == &m) return *this; if (nrow_ != m.getNRow() || ncol_ != m.getNCol()) { @@ -233,11 +233,11 @@ namespace OpenMD { /** * Tests if this matrix is identical to matrix m * @return true if this matrix is equal to the matrix m, return false otherwise - * @m matrix to be compared + * @param m matrix to be compared * * @todo replace operator == by template function equal */ - bool operator ==(const DynamicRectMatrix m) { + bool operator ==(const DynamicRectMatrix &m) { assert(nrow_ == m.getNRow() && ncol_ == m.getNCol()); for (unsigned int i = 0; i < nrow_; i++) for (unsigned int j = 0; j < ncol_; j++) @@ -250,9 +250,9 @@ namespace OpenMD { /** * Tests if this matrix is not equal to matrix m * @return true if this matrix is not equal to the matrix m, return false otherwise - * @m matrix to be compared + * @param m matrix to be compared */ - bool operator !=(const DynamicRectMatrix m) { + bool operator !=(const DynamicRectMatrix &m) { return !(*this == m); } @@ -267,7 +267,7 @@ namespace OpenMD { * Sets the value of this matrix to the negation of matrix m. * @param m the source matrix */ - inline void negate(const DynamicRectMatrix m) { + inline void negate(const DynamicRectMatrix &m) { for (unsigned int i = 0; i < nrow_; i++) for (unsigned int j = 0; j < ncol_; j++) this->data_[i][j] = -m.data_[i][j]; @@ -277,7 +277,7 @@ namespace OpenMD { * Sets the value of this matrix to the sum of itself and m (*this += m). * @param m the other matrix */ - inline void add( const DynamicRectMatrix m ) { + inline void add( const DynamicRectMatrix &m ) { assert(nrow_ == m.getNRow() && ncol_ == m.getNCol()); for (unsigned int i = 0; i < nrow_; i++) for (unsigned int j = 0; j < ncol_; j++) @@ -289,7 +289,7 @@ namespace OpenMD { * @param m1 the first matrix * @param m2 the second matrix */ - inline void add( const DynamicRectMatrix m1, const DynamicRectMatrix m2 ) { + inline void add( const DynamicRectMatrix &m1, const DynamicRectMatrix &m2 ) { assert(m1.getNRow() == m2.getNRow() && m1.getNCol() == m2.getNCol()); for (unsigned int i = 0; i < nrow_; i++) for (unsigned int j = 0; j < ncol_; j++) @@ -300,7 +300,7 @@ namespace OpenMD { * Sets the value of this matrix to the difference of itself and m (*this -= m). * @param m the other matrix */ - inline void sub( const DynamicRectMatrix m ) { + inline void sub( const DynamicRectMatrix &m ) { assert(nrow_ == m.getNRow() && ncol_ == m.getNCol()); for (unsigned int i = 0; i < nrow_; i++) for (unsigned int j = 0; j < ncol_; j++) @@ -312,7 +312,7 @@ namespace OpenMD { * @param m1 the first matrix * @param m2 the second matrix */ - inline void sub( const DynamicRectMatrix m1, const DynamicRectMatrix m2){ + inline void sub( const DynamicRectMatrix &m1, const DynamicRectMatrix &m2){ assert(m1.getNRow() == m2.getNRow() && m1.getNCol() == m2.getNCol()); for (unsigned int i = 0; i < nrow_; i++) for (unsigned int j = 0; j < ncol_; j++) @@ -334,7 +334,7 @@ namespace OpenMD { * @param s the scalar value * @param m the matrix */ - inline void mul( Real s, const DynamicRectMatrix m ) { + inline void mul( Real s, const DynamicRectMatrix &m ) { assert(nrow_ == m.getNRow() && ncol_ == m.getNCol()); for (unsigned int i = 0; i < nrow_; i++) for (unsigned int j = 0; j < ncol_; j++) @@ -356,7 +356,7 @@ namespace OpenMD { * @param s the scalar value * @param m the matrix */ - inline void div( Real s, const DynamicRectMatrix m ) { + inline void div( Real s, const DynamicRectMatrix &m ) { assert(nrow_ == m.getNRow() && ncol_ == m.getNCol()); for (unsigned int i = 0; i < nrow_; i++) for (unsigned int j = 0; j < ncol_; j++) @@ -462,7 +462,7 @@ namespace OpenMD { /** Negate the value of every element of this matrix. */ template - inline DynamicRectMatrix operator -(const DynamicRectMatrix m) { + inline DynamicRectMatrix operator -(const DynamicRectMatrix &m) { DynamicRectMatrix result(m); result.negate(); @@ -477,7 +477,7 @@ namespace OpenMD { * @param m2 the second matrix */ template - inline DynamicRectMatrix operator + (const DynamicRectMatrix m1,const DynamicRectMatrix m2) { + inline DynamicRectMatrix operator + (const DynamicRectMatrix &m1, const DynamicRectMatrix &m2) { DynamicRectMatrix result(m1.getNRow(), m1.getNCol()); @@ -493,7 +493,7 @@ namespace OpenMD { * @param m2 the second matrix */ template - inline DynamicRectMatrix operator - (const DynamicRectMatrix m1, const DynamicRectMatrix m2) { + inline DynamicRectMatrix operator - (const DynamicRectMatrix &m1, const DynamicRectMatrix &m2) { DynamicRectMatrix result(m1.getNRow(), m1.getNCol()); result.sub(m1, m2); @@ -508,7 +508,7 @@ namespace OpenMD { * @param s the scalar */ template - inline DynamicRectMatrix operator *(const DynamicRectMatrix m, Real s) { + inline DynamicRectMatrix operator *(const DynamicRectMatrix &m, Real s) { DynamicRectMatrix result(m.getNRow(), m.getNCol()); result.mul(s, m); @@ -523,7 +523,7 @@ namespace OpenMD { * @param m the matrix */ template - inline DynamicRectMatrix operator *(Real s, const DynamicRectMatrix m) { + inline DynamicRectMatrix operator *(Real s, const DynamicRectMatrix &m) { DynamicRectMatrix result(m.getNRow(), m.getNCol()); result.mul(s, m); @@ -559,10 +559,10 @@ namespace OpenMD { * @param v the vector */ template - inline DynamicVector operator *(const DynamicRectMatrix m, const DynamicVector& v) { + inline DynamicVector operator *(const DynamicRectMatrix &m, const DynamicVector &v) { int nrow = m.getNRow(); int ncol = m.getNCol(); - assert(ncol = v.size()); + assert(ncol == v.size()); DynamicVector result(nrow); for (unsigned int i = 0; i < nrow ; i++) @@ -579,7 +579,7 @@ namespace OpenMD { * @param s the scalar */ template - inline DynamicRectMatrix operator /(const DynamicRectMatrix m, Real s) { + inline DynamicRectMatrix operator /(const DynamicRectMatrix &m, Real s) { DynamicRectMatrix result(m.getNRow(), m.getNCol()); result.div(s, m); @@ -591,7 +591,7 @@ namespace OpenMD { * Write to an output stream */ template - std::ostream &operator<< ( std::ostream& o, const DynamicRectMatrix m) { + std::ostream &operator<< ( std::ostream& o, const DynamicRectMatrix &m) { for (unsigned int i = 0; i < m.getNRow() ; i++) { o << "("; for (unsigned int j = 0; j < m.getNCol() ; j++) {