--- branches/development/src/math/SquareMatrix.hpp 2012/06/12 13:20:28 1753 +++ branches/development/src/math/SquareMatrix.hpp 2012/08/29 18:13:11 1787 @@ -154,7 +154,6 @@ namespace OpenMD { return tmp; } - /** Tests if this matrix is symmetrix. */ bool isSymmetric() const { for (unsigned int i = 0; i < Dim - 1; i++) @@ -182,6 +181,19 @@ namespace OpenMD { return false; return true; + } + + /** + * Returns a column vector that contains the elements from the + * diagonal of m in the order R(0) = m(0,0), R(1) = m(1,1), and so + * on. + */ + Vector diagonals() const { + Vector result; + for (unsigned int i = 0; i < Dim; i++) { + result(i) = this->data_[i][i]; + } + return result; } /** Tests if this matrix is the unit matrix. */