Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

template<class C>
MatrixTem<C> Impala::Core::Matrix::MatrixTem< C >::setRow ( long  r,
VectorTem< C >  v,
bool  makeCopy = false 
) [inline]

Definition at line 279 of file MatrixTem.h.

References Impala::Core::Matrix::MatrixTem< C >::_nc, Impala::Core::Matrix::MatrixTem< C >::_nr, and Impala::Core::Vector::VectorTem< ElemT >::Size().

Referenced by Impala::Core::Array::extractRegions(), and Impala::Core::Array::rgmerge().

00280 {
00281 
00282         if(r>= _nr || r<0){
00283         std::cerr << "setRow: rownr exceeded the number of rows in MatrixTem."
00284                   << std::endl;
00285         return MatrixTem<C>(0,0) ;
00286     }
00287         if(_nc != v.Size()){
00288         std::cerr << "setRow: v.nElem not equal to matrix dimension" << std::endl;
00289         return MatrixTem<C>(0,0) ;
00290     }
00291 
00292         MatrixTem<C> tmp(0,0);
00293 
00294         if(makeCopy) {
00295 
00296                 tmp = MatrixTem<C>(_nr,_nc);
00297 
00298                 for(int row = 0; row<_nr; row++)
00299                         for(int col = 0; col<_nc; col++)
00300                                 if(row!=r) tmp[row][col] = (*this)[row][col] ;
00301                                 else tmp[row][col] = v[col] ;
00302         } 
00303         else { // only change the original, faster
00304 
00305                 for(int col = 0; col<_nc; col++)
00306                         (*this)[r][col] = v[col] ;
00307         }
00308 
00309 
00310         return tmp;
00311 
00312 }

Here is the call graph for this function:


Generated on Thu Jan 13 09:20:20 2011 for ImpalaSrc by  doxygen 1.5.1