template<class C>
Definition at line 307 of file Matrix.h. References CxMatrixTem< C >::_nc, and CxMatrixTem< C >::_nr. 00308 { 00309 00310 if(c>= _nc || c<0){ 00311 CX_CERR << "setCol: Colnr exceeded number of columns in CxMatrixTem." 00312 << CX_ENDL; 00313 return CxMatrixTem<C>(0,0) ; 00314 } 00315 if(_nr != v.Size()){ 00316 CX_CERR << "setCol: v.nElem not equal to matrix dimension" << CX_ENDL; 00317 return CxMatrixTem<C>(0,0) ; 00318 } 00319 00320 CxMatrixTem<C> tmp(0,0); 00321 00322 if(makeCopy) { 00323 00324 tmp = CxMatrixTem<C>(_nr,_nc); 00325 00326 for(int row = 0; row<_nr; row++) 00327 for(int col = 0; col<_nc; col++) 00328 if(col!=c) tmp[row][col] = (*this)[row][col] ; 00329 else tmp[row][col] = v[row] ; 00330 } 00331 else { // only change the original, faster 00332 00333 for(int row = 0; row<_nr; row++) 00334 (*this)[row][c] = v[row] ; 00335 } 00336 00337 return tmp; 00338 00339 }
|