From 6f5f0c11d2f840b3de7108c3a8b690e777eee02f Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Fri, 4 Feb 2011 17:15:47 +0100 Subject: [PATCH] matrix scalar division --- include/mitsuba/core/matrix.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/mitsuba/core/matrix.h b/include/mitsuba/core/matrix.h index 5eb5f9cb..c40207cf 100644 --- a/include/mitsuba/core/matrix.h +++ b/include/mitsuba/core/matrix.h @@ -198,6 +198,33 @@ public: return *this; } + /// Scalar division (creates a temporary) + inline Matrix operator/(T value) const { + Matrix result; +#ifdef MTS_DEBUG + if (value == 0) + SLog(EWarn, "Matrix: Division by zero!"); +#endif + Float recip = 1/value; + for (int i=0; i inline Matrix operator*(const Matrix &mat) const { BOOST_STATIC_ASSERT(N == M2);