template<class C>
Definition at line 271 of file Matrix.h. References CxMatrixTem< C >::_nc, and CxMatrixTem< C >::_nr. 00272 { 00273 00274 if(r>= _nr || r<0){ 00275 CX_CERR << "setRow: rownr exceeded the number of rows in CxMatrixTem." 00276 << CX_ENDL; 00277 return CxMatrixTem<C>(0,0) ; 00278 } 00279 if(_nc != v.Size()){ 00280 CX_CERR << "setRow: v.nElem not equal to matrix dimension" << CX_ENDL; 00281 return CxMatrixTem<C>(0,0) ; 00282 } 00283 00284 CxMatrixTem<C> tmp(0,0); 00285 00286 if(makeCopy) { 00287 00288 tmp = CxMatrixTem<C>(_nr,_nc); 00289 00290 for(int row = 0; row<_nr; row++) 00291 for(int col = 0; col<_nc; col++) 00292 if(row!=r) tmp[row][col] = (*this)[row][col] ; 00293 else tmp[row][col] = v[col] ; 00294 } 00295 else { // only change the original, faster 00296 00297 for(int col = 0; col<_nc; col++) 00298 (*this)[r][col] = v[col] ; 00299 } 00300 00301 00302 return tmp; 00303 00304 }
|