Changeset 540 in Sophya


Ignore:
Timestamp:
Nov 3, 1999, 3:38:48 PM (26 years ago)
Author:
ansari
Message:

Transformation linfit en classe pour eviter probleme avec g++ - Reza 3/11/99

Location:
trunk/SophyaLib/NTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/NTools/linfit.cc

    r524 r540  
    33#include "linfit.h"
    44
    5 double LinFit(const Vector& x, const Vector& y, int nf, double (*f)(int, double),
    6            Vector& c)
     5LinFitter::LinFitter()
     6{
     7}
     8
     9LinFitter::~LinFitter()
     10{
     11}
     12
     13double LinFitter::LinFit(const Vector& x, const Vector& y, int nf,
     14                         double (*f)(int, double), Vector& c)
    715{
    816  int n = x.NElts();
     
    1927
    2028
    21 double LinFit(const Matrix& fx, const Vector& y, Vector& c)
     29double LinFitter::LinFit(const Matrix& fx, const Vector& y, Vector& c)
    2230{
    2331  int n = y.NElts();
     
    5058
    5159
    52 double LinFit(const Vector& x, const Vector& y, const Vector& errY2, int nf,
    53            double (*f)(int, double), Vector& c, Vector& errC)
     60double LinFitter::LinFit(const Vector& x, const Vector& y, const Vector& errY2, int nf,
     61                         double (*f)(int, double), Vector& c, Vector& errC)
    5462{
    5563  int n = x.NElts();
     
    6573
    6674
    67 double LinFit(const Matrix& fx, const Vector& y, const Vector& errY2,
     75double LinFitter::LinFit(const Matrix& fx, const Vector& y, const Vector& errY2,
    6876           Vector& c, Vector& errC)
    6977{
  • trunk/SophyaLib/NTools/linfit.h

    r514 r540  
    11// This may look like C code, but it is really -*- C++ -*-
    22//
    3 // $Id: linfit.h,v 1.4 1999-10-25 16:40:00 ansari Exp $
     3// $Id: linfit.h,v 1.5 1999-11-03 14:38:48 ansari Exp $
    44//
    55
     
    1414namespace PlanckDPC {
    1515
    16 double LinFit(const Vector& x, const Vector& y, int nf,
    17            double (*f)(int, double), Vector& c);
     16class LinFitter {
     17public :
     18                LinFitter();
     19  virtual       ~LinFitter();
     20
     21  double        LinFit(const Vector& x, const Vector& y, int nf,
     22                       double (*f)(int, double), Vector& c);
    1823// fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1;
    1924
    20 
    21 double LinFit(const Matrix& fx, const Vector& y, Vector& c);
     25  double        LinFit(const Matrix& fx, const Vector& y, Vector& c);
    2226// fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1,
    2327// la matrice fx contient les valeurs des f:
    2428// fx(i,j) = f(i, x(j)).
    2529                     
    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);
    2932// fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1,
    3033// errY2 contient les carres des erreurs sur les Y.
    3134// au retour, errC contient les erreurs sur les coefs.
    3235
    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);
    3638// fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1,
    3739// la matrice fx contient les valeurs des f:
     
    3941// errY2 contient les carres des erreurs sur les Y.
    4042// au retour, errC contient les erreurs sur les coefs.
     43};
    4144
    4245} // Fin du namespace
  • trunk/SophyaLib/NTools/poly.cc

    r514 r540  
    296296  }
    297297
    298   double rc = LinFit(a,y,(Vector&)*this);
     298  LinFitter lf;
     299  double rc = lf.LinFit(a,y,(Vector&)*this);
    299300  UpdateDeg();
    300301  return rc;
     
    328329  }
    329330
    330   double rc = LinFit(a,y,erry2,(Vector&)*this,errCoef);
     331  LinFitter lf;
     332  double rc = lf.LinFit(a,y,erry2,(Vector&)*this,errCoef);
    331333  UpdateDeg();
    332334  return rc;
     
    577579  }
    578580
    579   double rc = LinFit(a,z,(Vector&)*this);
     581  LinFitter lf;
     582  double rc = lf.LinFit(a,z,(Vector&)*this);
    580583  UpdateDeg();
    581584  return rc;
     
    614617  }
    615618
    616   double rc = LinFit(a,z,errz2,(Vector&)*this,errCoef);
     619  LinFitter lf;
     620  double rc = lf.LinFit(a,z,errz2,(Vector&)*this,errCoef);
    617621  UpdateDeg();
    618622  return rc;
     
    649653  }
    650654
    651   double rc = LinFit(a,z,cf);
     655  LinFitter lf;
     656  double rc = lf.LinFit(a,z,cf);
    652657
    653658  for (int dx = 0; dx <= degre; dx++)
     
    698703  }
    699704
    700   double rc = LinFit(a,z,errz2,cf,ecf);
     705  LinFitter lf;
     706  double rc = lf.LinFit(a,z,errz2,cf,ecf);
    701707
    702708
Note: See TracChangeset for help on using the changeset viewer.