diff --git a/include/rotgen/impl/matrix_impl64.hpp b/include/rotgen/impl/matrix_impl64.hpp index ff9d349..e814c7c 100644 --- a/include/rotgen/impl/matrix_impl64.hpp +++ b/include/rotgen/impl/matrix_impl64.hpp @@ -47,6 +47,7 @@ namespace rotgen matrix_impl64& operator-(); matrix_impl64& operator*=(matrix_impl64 const& rhs); matrix_impl64& operator*=(double d); + matrix_impl64& operator/=(double d); friend std::ostream& operator<<(std::ostream&,matrix_impl64 const&); friend bool operator==(matrix_impl64 const& lhs, matrix_impl64 const& rhs); diff --git a/include/rotgen/matrix.hpp b/include/rotgen/matrix.hpp index b7ef164..6018b13 100644 --- a/include/rotgen/matrix.hpp +++ b/include/rotgen/matrix.hpp @@ -91,6 +91,12 @@ namespace rotgen static_cast(*this) *= rhs; return *this; } + + matrix& operator/=(double rhs) + { + static_cast(*this) /= rhs; + return *this; + } }; template @@ -126,4 +132,11 @@ namespace rotgen { return rhs * lhs; } + + template + matrix operator/(matrix const& lhs, double rhs) + { + matrix that(lhs); + return that /= rhs; + } } \ No newline at end of file diff --git a/src/matrix_impl64.cpp b/src/matrix_impl64.cpp index 515659a..a5a69ad 100644 --- a/src/matrix_impl64.cpp +++ b/src/matrix_impl64.cpp @@ -119,4 +119,10 @@ namespace rotgen storage_->data *= s; return *this; } + + matrix_impl64& matrix_impl64::operator/=(double s) + { + storage_->data /= s; + return *this; + } } \ No newline at end of file