Changeset 508 in Sophya for trunk/SophyaLib/NTools/cvector.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/cvector.cc

    r307 r508  
    66
    77//++
    8 // Class        Vector
     8// Class        OVector
    99// Lib  Outils++
    1010// include      cvector.h
     
    1616//++
    1717// Links        Parents
    18 // Matrix
     18// OMatrix
    1919//--
    2020
     
    2424
    2525//++
    26 Vector::Vector(int n)
     26OVector::OVector(int n)
    2727//
    2828//      Constructeur, n = nombre d'éléments.
    2929//--
    30 : Matrix(n, 1)
     30: OMatrix(n, 1)
    3131{END_CONSTRUCTOR}
    3232
    3333
    3434//++
    35 Vector::Vector(int n, double* values)
     35OVector::OVector(int n, double* values)
    3636//
    3737//      Constructeur, à partir des valeurs. Pas d'allocation.
    3838//--
    39 : Matrix(n, 1, values)
     39: OMatrix(n, 1, values)
    4040{END_CONSTRUCTOR}
    4141
    4242
    4343//++
    44 Vector::Vector(const Vector& v)
     44OVector::OVector(const OVector& v)
    4545//
    4646//      Constructeur par copie.
    4747//--
    48 : Matrix(v)
     48: OMatrix(v)
    4949{END_CONSTRUCTOR}
    5050
    5151
    5252//++
    53 Vector::Vector(const Matrix& a)
     53OVector::OVector(const OMatrix& a)
    5454//
    5555//      Constructeur par "copie" à partir d'une matrice, qui doit avoir une seule colonne.
     
    5858//      sizeMismatchErr    si la matrice a plus d'une colonne
    5959//--
    60 : Matrix(a.nr,1)      // Matrix(a) ne marche pas, pourquoi ???? bug gcc ???
     60: OMatrix(a.nr,1)      // OMatrix(a) ne marche pas, pourquoi ???? bug gcc ???
    6161{
    6262  if (a.nc != 1) THROW(sizeMismatchErr);
     
    6666
    6767//++
    68 Vector::Vector(const TVector<r_8>& v)
     68OVector::OVector(const TVector<r_8>& v)
    6969//
    7070//      Constructeur par "copie" a partir d'un TVector<r_8>.
    7171//      Attention, les donnees sont partagees.
    7272//--
    73 : Matrix(v)
     73: OMatrix(v)
    7474{
    7575}
     
    8787
    8888//++
    89 Vector& Vector::operator = (double x)
     89OVector& OVector::operator = (double x)
    9090//
    9191//      Affectation à partir d'un scalaire. Tous les éléments prennent cette valeur.
     
    9898
    9999//++
    100 double operator* (const Vector& v1, const Vector& v2)
     100double operator* (const OVector& v1, const OVector& v2)
    101101//
    102102//      Produit scalaire entre deux vecteurs.
     
    117117
    118118//++
    119 // Vector operator* (const Vector& v, double b)
     119// OVector operator* (const OVector& v, double b)
    120120//      multiplication par un scalaire.
    121121//--
    122122
    123123//++
    124 // Vector operator* (const Matrix& a, const Vector& b)
     124// OVector operator* (const OMatrix& a, const OVector& b)
    125125//      produit matrice*vecteur.
    126126//--
     
    144144
    145145//++
    146 double LinSolveInPlace(Matrix& a, Vector& b)
     146double LinSolveInPlace(OMatrix& a, OVector& b)
    147147//
    148148//      Résolution du système A*C = B
     
    152152  if (a.NCol() != a.NRows()) THROW(sizeMismatchErr);
    153153
    154   return Matrix::GausPiv(a,b);
    155 }
    156 
    157 
    158 //++
    159 double LinSolve(const Matrix& a, const Vector& b, Vector& c)
     154  return OMatrix::GausPiv(a,b);
     155}
     156
     157
     158//++
     159double LinSolve(const OMatrix& a, const OVector& b, OVector& c)
    160160//
    161161//      Résolution du système A*C = B, avec C retourné dans B
     
    165165  if (a.NCol() != a.NRows()) THROW(sizeMismatchErr);
    166166  c = b;
    167   Matrix a1(a);
    168   return Matrix::GausPiv(a1,c);
     167  OMatrix a1(a);
     168  return OMatrix::GausPiv(a1,c);
    169169}
    170170
    171171//////////////////////////////////////////////////////////
    172172//++
    173 Vector Vector::FitResidus(GeneralFit& gfit,double xorg,double dx)
     173OVector OVector::FitResidus(GeneralFit& gfit,double xorg,double dx)
    174174//
    175175//      Retourne une classe contenant les residus du fit ``gfit''.
     
    178178{
    179179if(NElts()<=0)
    180   throw(SzMismatchError("Vector::FitResidus: size mismatch\n"));
     180  throw(SzMismatchError("OVector::FitResidus: size mismatch\n"));
    181181GeneralFunction* f = gfit.GetFunction();
    182182if(f==NULL)
    183   throw(NullPtrError("Vector::FitResidus: NULL pointer\n"));
    184 Vector par = gfit.GetParm();
    185 Vector v(*this);
     183  throw(NullPtrError("OVector::FitResidus: NULL pointer\n"));
     184OVector par = gfit.GetParm();
     185OVector v(*this);
    186186for(int i=0;i<NElts();i++) {
    187187  double x = xorg+i*dx;
     
    192192
    193193//++
    194 Vector Vector::FitFunction(GeneralFit& gfit,double xorg,double dx)
     194OVector OVector::FitFunction(GeneralFit& gfit,double xorg,double dx)
    195195//
    196196//      Retourne une classe contenant la fonction du fit ``gfit''.
     
    199199{
    200200if(NElts()<=0)
    201   throw(SzMismatchError("Vector::FitResidus: size mismatch\n"));
     201  throw(SzMismatchError("OVector::FitResidus: size mismatch\n"));
    202202GeneralFunction* f = gfit.GetFunction();
    203203if(f==NULL)
    204   throw(NullPtrError("Vector::FitResidus: NULL pointer\n"));
    205 Vector par = gfit.GetParm();
    206 Vector v(*this);
     204  throw(NullPtrError("OVector::FitResidus: NULL pointer\n"));
     205OVector par = gfit.GetParm();
     206OVector v(*this);
    207207for(int i=0;i<NElts();i++) {
    208208  double x = xorg+i*dx;
Note: See TracChangeset for help on using the changeset viewer.