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

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

Definition at line 315 of file MatrixTem.h.

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

00316 {
00317 
00318         if(c>= _nc || c<0){
00319         std::cerr << "setCol: Colnr exceeded number of columns in MatrixTem."
00320                   << std::endl;
00321         return MatrixTem<C>(0,0) ;
00322     }
00323         if(_nr != v.Size()){
00324         std::cerr << "setCol: v.nElem not equal to matrix dimension" << std::endl;
00325         return MatrixTem<C>(0,0) ;
00326     }
00327 
00328         MatrixTem<C> tmp(0,0);
00329 
00330         if(makeCopy) {
00331 
00332                 tmp = MatrixTem<C>(_nr,_nc);
00333 
00334                 for(int row = 0; row<_nr; row++)
00335                         for(int col = 0; col<_nc; col++)
00336                                 if(col!=c) tmp[row][col] = (*this)[row][col] ;
00337                                 else tmp[row][col] = v[row] ;
00338         }
00339         else { // only change the original, faster
00340 
00341                 for(int row = 0; row<_nr; row++)
00342                         (*this)[row][c] = v[row] ;
00343         }
00344 
00345         return tmp;
00346 
00347 }

Here is the call graph for this function:


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