Changeset 540 in Sophya
- Timestamp:
- Nov 3, 1999, 3:38:48 PM (26 years ago)
- Location:
- trunk/SophyaLib/NTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/linfit.cc
r524 r540 3 3 #include "linfit.h" 4 4 5 double LinFit(const Vector& x, const Vector& y, int nf, double (*f)(int, double), 6 Vector& c) 5 LinFitter::LinFitter() 6 { 7 } 8 9 LinFitter::~LinFitter() 10 { 11 } 12 13 double LinFitter::LinFit(const Vector& x, const Vector& y, int nf, 14 double (*f)(int, double), Vector& c) 7 15 { 8 16 int n = x.NElts(); … … 19 27 20 28 21 double LinFit (const Matrix& fx, const Vector& y, Vector& c)29 double LinFitter::LinFit(const Matrix& fx, const Vector& y, Vector& c) 22 30 { 23 31 int n = y.NElts(); … … 50 58 51 59 52 double LinFit (const Vector& x, const Vector& y, const Vector& errY2, int nf,53 double (*f)(int, double), Vector& c, Vector& errC)60 double LinFitter::LinFit(const Vector& x, const Vector& y, const Vector& errY2, int nf, 61 double (*f)(int, double), Vector& c, Vector& errC) 54 62 { 55 63 int n = x.NElts(); … … 65 73 66 74 67 double LinFit (const Matrix& fx, const Vector& y, const Vector& errY2,75 double LinFitter::LinFit(const Matrix& fx, const Vector& y, const Vector& errY2, 68 76 Vector& c, Vector& errC) 69 77 { -
trunk/SophyaLib/NTools/linfit.h
r514 r540 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: linfit.h,v 1. 4 1999-10-25 16:40:00ansari Exp $3 // $Id: linfit.h,v 1.5 1999-11-03 14:38:48 ansari Exp $ 4 4 // 5 5 … … 14 14 namespace PlanckDPC { 15 15 16 double LinFit(const Vector& x, const Vector& y, int nf, 17 double (*f)(int, double), Vector& c); 16 class LinFitter { 17 public : 18 LinFitter(); 19 virtual ~LinFitter(); 20 21 double LinFit(const Vector& x, const Vector& y, int nf, 22 double (*f)(int, double), Vector& c); 18 23 // fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1; 19 24 20 21 double LinFit(const Matrix& fx, const Vector& y, Vector& c); 25 double LinFit(const Matrix& fx, const Vector& y, Vector& c); 22 26 // fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1, 23 27 // la matrice fx contient les valeurs des f: 24 28 // fx(i,j) = f(i, x(j)). 25 29 26 27 double LinFit(const Vector& x, const Vector& y, const Vector& errY2, int nf, 28 double (*f)(int, double), Vector& c, Vector& errC); 30 double LinFit(const Vector& x, const Vector& y, const Vector& errY2, int nf, 31 double (*f)(int, double), Vector& c, Vector& errC); 29 32 // fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1, 30 33 // errY2 contient les carres des erreurs sur les Y. 31 34 // au retour, errC contient les erreurs sur les coefs. 32 35 33 34 double LinFit(const Matrix& fx, const Vector& y, const Vector& errY2, 35 Vector& c, Vector& errC); 36 double LinFit(const Matrix& fx, const Vector& y, const Vector& errY2, 37 Vector& c, Vector& errC); 36 38 // fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1, 37 39 // la matrice fx contient les valeurs des f: … … 39 41 // errY2 contient les carres des erreurs sur les Y. 40 42 // au retour, errC contient les erreurs sur les coefs. 43 }; 41 44 42 45 } // Fin du namespace -
trunk/SophyaLib/NTools/poly.cc
r514 r540 296 296 } 297 297 298 double rc = LinFit(a,y,(Vector&)*this); 298 LinFitter lf; 299 double rc = lf.LinFit(a,y,(Vector&)*this); 299 300 UpdateDeg(); 300 301 return rc; … … 328 329 } 329 330 330 double rc = LinFit(a,y,erry2,(Vector&)*this,errCoef); 331 LinFitter lf; 332 double rc = lf.LinFit(a,y,erry2,(Vector&)*this,errCoef); 331 333 UpdateDeg(); 332 334 return rc; … … 577 579 } 578 580 579 double rc = LinFit(a,z,(Vector&)*this); 581 LinFitter lf; 582 double rc = lf.LinFit(a,z,(Vector&)*this); 580 583 UpdateDeg(); 581 584 return rc; … … 614 617 } 615 618 616 double rc = LinFit(a,z,errz2,(Vector&)*this,errCoef); 619 LinFitter lf; 620 double rc = lf.LinFit(a,z,errz2,(Vector&)*this,errCoef); 617 621 UpdateDeg(); 618 622 return rc; … … 649 653 } 650 654 651 double rc = LinFit(a,z,cf); 655 LinFitter lf; 656 double rc = lf.LinFit(a,z,cf); 652 657 653 658 for (int dx = 0; dx <= degre; dx++) … … 698 703 } 699 704 700 double rc = LinFit(a,z,errz2,cf,ecf); 705 LinFitter lf; 706 double rc = lf.LinFit(a,z,errz2,cf,ecf); 701 707 702 708
Note:
See TracChangeset
for help on using the changeset viewer.