Changeset 307 in Sophya for trunk/SophyaLib/NTools/cvector.cc
- Timestamp:
- May 19, 1999, 5:58:06 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/cvector.cc
r303 r307 171 171 ////////////////////////////////////////////////////////// 172 172 //++ 173 Vector * Vector::FitResidus(GeneralFit& gfit)173 Vector Vector::FitResidus(GeneralFit& gfit,double xorg,double dx) 174 174 // 175 175 // Retourne une classe contenant les residus du fit ``gfit''. 176 // On suppose que x=i. 177 //-- 178 { 179 if(NElts()<=0) return NULL; 176 // La coordonnee de l'element (i) est -> x = xorg + i*dx 177 //-- 178 { 179 if(NElts()<=0) 180 throw(SzMismatchError("Vector::FitResidus: size mismatch\n")); 180 181 GeneralFunction* f = gfit.GetFunction(); 181 if(f==NULL) return NULL; 182 if(f==NULL) 183 throw(NullPtrError("Vector::FitResidus: NULL pointer\n")); 182 184 Vector par = gfit.GetParm(); 183 Vector * v = new Vector(*this);185 Vector v(*this); 184 186 for(int i=0;i<NElts();i++) { 185 double x = (double)i;186 (*v)(i) -= f->Value(&x,par.Data());187 double x = xorg+i*dx; 188 v(i) -= f->Value(&x,par.Data()); 187 189 } 188 190 return v; … … 190 192 191 193 //++ 192 Vector * Vector::FitFunction(GeneralFit& gfit)194 Vector Vector::FitFunction(GeneralFit& gfit,double xorg,double dx) 193 195 // 194 196 // Retourne une classe contenant la fonction du fit ``gfit''. 195 // On suppose que x=i. 196 //-- 197 { 198 if(NElts()<=0) return NULL; 197 // La coordonnee de l'element (i) est -> x = xorg + i*dx 198 //-- 199 { 200 if(NElts()<=0) 201 throw(SzMismatchError("Vector::FitResidus: size mismatch\n")); 199 202 GeneralFunction* f = gfit.GetFunction(); 200 if(f==NULL) return NULL; 203 if(f==NULL) 204 throw(NullPtrError("Vector::FitResidus: NULL pointer\n")); 201 205 Vector par = gfit.GetParm(); 202 Vector * v = new Vector(*this);206 Vector v(*this); 203 207 for(int i=0;i<NElts();i++) { 204 double x = (double)i;205 (*v)(i) = f->Value(&x,par.Data());208 double x = xorg+i*dx; 209 v(i) = f->Value(&x,par.Data()); 206 210 } 207 211 return v;
Note:
See TracChangeset
for help on using the changeset viewer.