## IT++ multiplication scalar and matrix

I got error when I tried to multiply a double with a complex matrix. It turns out because IT++ 4.0.6 only implement :
operator*(const double, const cmat)

So it gives error when do : (cmat*double)

To fix this, apply the patch below:
— itpp-4.0.6/itpp/base/operators.cpp 2008-10-08 19:52:24.000000000 +0800
+++ NumericalComputation/itpp-4.0.6/itpp/base/operators.cpp 2009-03-10 14:08:55.000000000 +0800
@@ -238,6 +238,7 @@
return temp;
}

+
cmat operator*(const std::complex &s, const mat &m)
{
it_assert_debug(m.rows() > 0 && m.cols() > 0, “operator*(): Matrix of zero length”);
@@ -261,6 +262,17 @@
return temp;
}

+cmat operator*(const cmat &m, const double &s)
+{
+ it_assert_debug(m.rows() > 0 && m.cols() > 0, “operator*(): Matrix of zero length”);
+
+ cmat temp = m;
+ for (int i = 0;i < m._datasize();i++) {
+ temp._data()[i] *= (double)s;
+ }
+ return temp;
+}
+
//———————- between matrix and scalar ——————–

//———– Multiplication of a scalar and a vec —————–

and for operators.h:
— itpp-4.0.6/itpp/base/operators.h 2008-10-08 19:52:24.000000000 +0800
+++ NumericalComputation/itpp-4.0.6/itpp/base/operators.h 2009-03-10 14:40:02.000000000 +0800
@@ -654,6 +654,8 @@
*/
cmat operator/(const cmat &m, const double &s);

+cmat operator*(const cmat &m, const double &s);
+
//———————- between vec and vectors ——————–

/*!