Changeset 508 in Sophya for trunk/SophyaLib/NTools/linfit.cc


Ignore:
Timestamp:
Oct 25, 1999, 12:36:22 PM (26 years ago)
Author:
ansari
Message:

Vector/Matrix OVector/OMatrix cmv 25/10/99

File:
1 edited

Legend:

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

    r244 r508  
    55#include "cvector.h"
    66
    7 double LinFit(const Vector& x, const Vector& y, int nf, double (*f)(int, double),
    8            Vector& c)
     7double LinFit(const OVector& x, const OVector& y, int nf, double (*f)(int, double),
     8           OVector& c)
    99{
    1010  int n = x.NElts();
    1111  if (n != y.NElts()) THROW(sizeMismatchErr);
    1212 
    13   Matrix fx(nf, n);
     13  OMatrix fx(nf, n);
    1414  for (int i=0; i<nf; i++)
    1515    for (int j=0; j<n; j++)
     
    2121
    2222
    23 double LinFit(const Matrix& fx, const Vector& y, Vector& c)
     23double LinFit(const OMatrix& fx, const OVector& y, OVector& c)
    2424{
    2525  int n = y.NElts();
     
    2828  int nf = fx.NRows();
    2929
    30   Matrix a(nf,nf);
     30  OMatrix a(nf,nf);
    3131
    3232  for (int j=0; j<nf; j++)
     
    3636  c = fx * y;
    3737
    38   if (Matrix::GausPiv(a,c) == 0) THROW(singMatxErr);
     38  if (OMatrix::GausPiv(a,c) == 0) THROW(singMatxErr);
    3939
    4040  double xi2 = 0;
     
    5252
    5353
    54 double LinFit(const Vector& x, const Vector& y, const Vector& errY2, int nf,
    55            double (*f)(int, double), Vector& c, Vector& errC)
     54double LinFit(const OVector& x, const OVector& y, const OVector& errY2, int nf,
     55           double (*f)(int, double), OVector& c, OVector& errC)
    5656{
    5757  int n = x.NElts();
    5858  if (n != y.NElts()) THROW(sizeMismatchErr);
    5959 
    60   Matrix fx(nf, n);
     60  OMatrix fx(nf, n);
    6161  for (int i=0; i<nf; i++)
    6262    for (int j=0; j<n; j++)
     
    6767
    6868
    69 double LinFit(const Matrix& fx, const Vector& y, const Vector& errY2,
    70            Vector& c, Vector& errC)
     69double LinFit(const OMatrix& fx, const OVector& y, const OVector& errY2,
     70           OVector& c, OVector& errC)
    7171{
    7272  int n = y.NElts();
     
    7676  int nf = fx.NRows();
    7777
    78   Matrix a(nf,nf);
     78  OMatrix a(nf,nf);
    7979
    8080  c.Realloc(nf);
     
    8989    }
    9090 
    91   Matrix d(nf,nf+1);
     91  OMatrix d(nf,nf+1);
    9292  for (int k=0; k<nf; k++) {
    9393    double x=0;
     
    9999  }
    100100
    101   if (Matrix::GausPiv(a,d) == 0) THROW(singMatxErr);
     101  if (OMatrix::GausPiv(a,d) == 0) THROW(singMatxErr);
    102102
    103103  for (int l=0; l<nf; l++) {
Note: See TracChangeset for help on using the changeset viewer.