Changeset 508 in Sophya for trunk/SophyaLib/NTools/cvector.h
- Timestamp:
- Oct 25, 1999, 12:36:22 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/cvector.h
r307 r508 13 13 // Vecteur colonne, en fait une matrice avec une seule colonne, pour faire 14 14 // des operations matricielles. 15 class Vector : publicMatrix {15 class OVector : public OMatrix { 16 16 friend class TVector<r_8>; 17 17 public: 18 18 // Constructeur, n = nombre d'elements. 19 EXPLICIT Vector(int n=1);19 EXPLICIT OVector(int n=1); 20 20 // Constructeur, a partir des valeurs. Pas d'allocation. 21 Vector(int n, double* values);21 OVector(int n, double* values); 22 22 // Constructeur par copie 23 Vector(constVector& v);23 OVector(const OVector& v); 24 24 // Constructeur par "copie" a partir d'une matrice, qui doit avoir une colonne 25 25 // <thrown> sizeMismatchErr </thrown> 26 Vector(constMatrix& a);26 OVector(const OMatrix& a); 27 27 // Constructeur par copie a partir d'un TVector<r_8> 28 Vector(const TVector<r_8>& v);28 OVector(const TVector<r_8>& v); 29 29 30 30 // Construction automatique pour PPF … … 32 32 enum {classId = ClassId_Vector}; 33 33 int_4 ClassId() const { return classId; } 34 static PPersist* Create() {return new Vector(1);}34 static PPersist* Create() {return new OVector(1);} 35 35 // </group> 36 36 … … 39 39 void Realloc(int n, bool force=false); 40 40 41 Vector& operator = (constVector& v);42 Vector& operator = (double x);41 OVector& operator = (const OVector& v); 42 OVector& operator = (double x); 43 43 44 44 // Acces aux elements … … 50 50 // produit scalaire 51 51 // <group> 52 friend double operator* (const Vector& v1, constVector& v2);53 friend Vector operator* (constVector& v, double b)54 {return Vector(((Matrix const&)v) * b);}52 friend double operator* (const OVector& v1, const OVector& v2); 53 friend OVector operator* (const OVector& v, double b) 54 {return OVector(((OMatrix const&)v) * b);} 55 55 // </group> 56 56 // produit matrice*vecteur 57 friend Vector operator* (const Matrix& a, constVector& b)58 {return Vector(a * ((Matrix const&) (b)));}57 friend OVector operator* (const OMatrix& a, const OVector& b) 58 {return OVector(a * ((OMatrix const&) (b)));} 59 59 60 60 // Nombre de lignes du vecteur … … 62 62 63 63 // Resolution du systeme A*C = B 64 friend double LinSolve(const Matrix& a, const Vector& b,Vector& c);64 friend double LinSolve(const OMatrix& a, const OVector& b, OVector& c); 65 65 66 66 // Resolution du systeme A*C = B, avec C retourne dans B 67 friend double LinSolveInPlace( Matrix& a,Vector& b);67 friend double LinSolveInPlace(OMatrix& a, OVector& b); 68 68 69 69 // Residus et fonction fittees. 70 Vector FitResidus(GeneralFit& gfit,double xorg=0.,double dx=1.);71 Vector FitFunction(GeneralFit& gfit,double xorg=0.,double dx=1.);70 OVector FitResidus(GeneralFit& gfit,double xorg=0.,double dx=1.); 71 OVector FitFunction(GeneralFit& gfit,double xorg=0.,double dx=1.); 72 72 73 73 }; 74 74 75 75 76 inline Vector& Vector::operator = (constVector& v)77 { Matrix::operator =(v); return *this; }76 inline OVector& OVector::operator = (const OVector& v) 77 { OMatrix::operator =(v); return *this; } 78 78 79 79 80 inline double const& Vector::operator()(int n) const80 inline double const& OVector::operator()(int n) const 81 81 { 82 82 #ifdef RGCHECK … … 87 87 88 88 89 inline double& Vector::operator()(int n)89 inline double& OVector::operator()(int n) 90 90 { 91 91 #ifdef RGCHECK … … 95 95 } 96 96 97 inline void Vector::Realloc(int n, bool force)98 { Matrix::Realloc(n,1,force);}97 inline void OVector::Realloc(int n, bool force) 98 { OMatrix::Realloc(n,1,force);} 99 99 100 100
Note:
See TracChangeset
for help on using the changeset viewer.