*** empty log message ***

This commit is contained in:
jiri
2010-01-17 20:28:38 +00:00
parent 8ec7c11a6e
commit 92629a1867
8 changed files with 334 additions and 13 deletions

18
mat.h
View File

@@ -66,6 +66,7 @@ public:
NRMat & operator*=(const T &a); //multiply by a scalar
NRMat & operator+=(const NRMat &rhs);
NRMat & operator-=(const NRMat &rhs);
NRMat & operator^=(const NRMat<T> &rhs); //Hadamard (element-wise) product
NRMat & operator+=(const NRSMat<T> &rhs);
NRMat & operator-=(const NRSMat<T> &rhs);
const NRMat operator-() const; //unary minus
@@ -649,6 +650,23 @@ public:
//Hadamard product
template<typename T>
NRMat<T> & NRMat<T>::operator^=(const NRMat<T> &rhs){
#ifdef DEBUG
if (nn != rhs.nn || mm!= rhs.mm)
laerror("Mat ^= Mat of incompatible matrices");
#endif
copyonwrite();
#ifdef MATPTR
for (register int i=0; i< nn*mm; i++) v[0][i] *= rhs.v[0][i];
#else
const int Dim = nn*mm;
for(register int i=0;i<Dim;i++) v[i] *= rhs.v[i];
#endif
return *this;
}