From: ndjinga Date: Wed, 27 May 2009 16:40:49 +0000 (+0000) Subject: Added transposeMultiply method for rever interpolation in MEDMEM::Remapper X-Git-Tag: V5_1_main_FINAL~384 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=96f4dcb73048dc86b7ce0887d98e1e8fa746af67;p=tools%2Fmedcoupling.git Added transposeMultiply method for rever interpolation in MEDMEM::Remapper --- diff --git a/src/INTERP_KERNEL/InterpKernelMatrix.hxx b/src/INTERP_KERNEL/InterpKernelMatrix.hxx index caa98a12e..252646538 100755 --- a/src/INTERP_KERNEL/InterpKernelMatrix.hxx +++ b/src/INTERP_KERNEL/InterpKernelMatrix.hxx @@ -97,14 +97,13 @@ namespace INTERP_KERNEL _coeffs(0), _cols(0), _is_configured(false) { _nb_rows=matrix.size(); + _auxiliary_matrix.resize(_nb_rows); for (int i=0; i<_nb_rows; i++) { - _auxiliary_matrix[i].resize(matrix[i].size()); - typename std::map::iterator it; + typename std::map::iterator it; for (it=matrix[i].begin(); it != matrix[i].end(); it++) - _auxiliary_matrix[i].push_back(*it); - } - + _auxiliary_matrix[i].push_back(*it);//MN: pq push_back plutot que simple affectation? + } } /*!Copy constructor */ @@ -193,6 +192,31 @@ namespace INTERP_KERNEL } } } + + /*! + + Transpose-multiplies vector \a input and stores the result in + vector \a output. + nb_cols is the number of columns of the matrix, which is not an attribute of the class + The vector pointed by \a input must be dimensioned + to the number of lines _nb_rows while the vector pointed by output must be + dimensioned to the number of columns nb_cols. + */ + void transposeMultiply(const T* const input, T* const output, int nb_cols) + { + if (!_is_configured) + configure(); + + for (int icol=0; icol< nb_cols; icol++) + output[icol]=0; + for (int i=0; i< _nb_rows; i++) + { + for (unsigned int j=_ncols_offset[i]; j< _ncols_offset[i+1]; j++) { + int icol = _cols[j]; + output[icol]+=input[i]*_coeffs[j]; + } + } + } /*! This operation freezes the profile of the matrix and puts it under a CSR form so that it becomes