- Timestamp:
- Oct 25, 1999, 12:36:22 PM (26 years ago)
- Location:
- trunk/SophyaLib
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/cvector.cc
r307 r508 6 6 7 7 //++ 8 // Class Vector8 // Class OVector 9 9 // Lib Outils++ 10 10 // include cvector.h … … 16 16 //++ 17 17 // Links Parents 18 // Matrix18 // OMatrix 19 19 //-- 20 20 … … 24 24 25 25 //++ 26 Vector::Vector(int n)26 OVector::OVector(int n) 27 27 // 28 28 // Constructeur, n = nombre d'éléments. 29 29 //-- 30 : Matrix(n, 1)30 : OMatrix(n, 1) 31 31 {END_CONSTRUCTOR} 32 32 33 33 34 34 //++ 35 Vector::Vector(int n, double* values)35 OVector::OVector(int n, double* values) 36 36 // 37 37 // Constructeur, à partir des valeurs. Pas d'allocation. 38 38 //-- 39 : Matrix(n, 1, values)39 : OMatrix(n, 1, values) 40 40 {END_CONSTRUCTOR} 41 41 42 42 43 43 //++ 44 Vector::Vector(constVector& v)44 OVector::OVector(const OVector& v) 45 45 // 46 46 // Constructeur par copie. 47 47 //-- 48 : Matrix(v)48 : OMatrix(v) 49 49 {END_CONSTRUCTOR} 50 50 51 51 52 52 //++ 53 Vector::Vector(constMatrix& a)53 OVector::OVector(const OMatrix& a) 54 54 // 55 55 // Constructeur par "copie" à partir d'une matrice, qui doit avoir une seule colonne. … … 58 58 // sizeMismatchErr si la matrice a plus d'une colonne 59 59 //-- 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 ??? 61 61 { 62 62 if (a.nc != 1) THROW(sizeMismatchErr); … … 66 66 67 67 //++ 68 Vector::Vector(const TVector<r_8>& v)68 OVector::OVector(const TVector<r_8>& v) 69 69 // 70 70 // Constructeur par "copie" a partir d'un TVector<r_8>. 71 71 // Attention, les donnees sont partagees. 72 72 //-- 73 : Matrix(v)73 : OMatrix(v) 74 74 { 75 75 } … … 87 87 88 88 //++ 89 Vector&Vector::operator = (double x)89 OVector& OVector::operator = (double x) 90 90 // 91 91 // Affectation à partir d'un scalaire. Tous les éléments prennent cette valeur. … … 98 98 99 99 //++ 100 double operator* (const Vector& v1, constVector& v2)100 double operator* (const OVector& v1, const OVector& v2) 101 101 // 102 102 // Produit scalaire entre deux vecteurs. … … 117 117 118 118 //++ 119 // Vector operator* (constVector& v, double b)119 // OVector operator* (const OVector& v, double b) 120 120 // multiplication par un scalaire. 121 121 //-- 122 122 123 123 //++ 124 // Vector operator* (const Matrix& a, constVector& b)124 // OVector operator* (const OMatrix& a, const OVector& b) 125 125 // produit matrice*vecteur. 126 126 //-- … … 144 144 145 145 //++ 146 double LinSolveInPlace( Matrix& a,Vector& b)146 double LinSolveInPlace(OMatrix& a, OVector& b) 147 147 // 148 148 // Résolution du système A*C = B … … 152 152 if (a.NCol() != a.NRows()) THROW(sizeMismatchErr); 153 153 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 //++ 159 double LinSolve(const OMatrix& a, const OVector& b, OVector& c) 160 160 // 161 161 // Résolution du système A*C = B, avec C retourné dans B … … 165 165 if (a.NCol() != a.NRows()) THROW(sizeMismatchErr); 166 166 c = b; 167 Matrix a1(a);168 return Matrix::GausPiv(a1,c);167 OMatrix a1(a); 168 return OMatrix::GausPiv(a1,c); 169 169 } 170 170 171 171 ////////////////////////////////////////////////////////// 172 172 //++ 173 VectorVector::FitResidus(GeneralFit& gfit,double xorg,double dx)173 OVector OVector::FitResidus(GeneralFit& gfit,double xorg,double dx) 174 174 // 175 175 // Retourne une classe contenant les residus du fit ``gfit''. … … 178 178 { 179 179 if(NElts()<=0) 180 throw(SzMismatchError(" Vector::FitResidus: size mismatch\n"));180 throw(SzMismatchError("OVector::FitResidus: size mismatch\n")); 181 181 GeneralFunction* f = gfit.GetFunction(); 182 182 if(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")); 184 OVector par = gfit.GetParm(); 185 OVector v(*this); 186 186 for(int i=0;i<NElts();i++) { 187 187 double x = xorg+i*dx; … … 192 192 193 193 //++ 194 VectorVector::FitFunction(GeneralFit& gfit,double xorg,double dx)194 OVector OVector::FitFunction(GeneralFit& gfit,double xorg,double dx) 195 195 // 196 196 // Retourne une classe contenant la fonction du fit ``gfit''. … … 199 199 { 200 200 if(NElts()<=0) 201 throw(SzMismatchError(" Vector::FitResidus: size mismatch\n"));201 throw(SzMismatchError("OVector::FitResidus: size mismatch\n")); 202 202 GeneralFunction* f = gfit.GetFunction(); 203 203 if(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")); 205 OVector par = gfit.GetParm(); 206 OVector v(*this); 207 207 for(int i=0;i<NElts();i++) { 208 208 double x = xorg+i*dx; -
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 -
trunk/SophyaLib/NTools/difeq.cc
r244 r508 106 106 //++ 107 107 DiffEqSolver& 108 DiffEqSolver::StartV( Vector const& yi, double t)108 DiffEqSolver::StartV(OVector const& yi, double t) 109 109 // 110 110 // Spécifie le point de départ de l'intégration de l'équadif. … … 169 169 170 170 //++ 171 // virtual void DiffEqSolver::SolveArr( Matrix& y, double* t, double tf, int n)=0171 // virtual void DiffEqSolver::SolveArr(OMatrix& y, double* t, double tf, int n)=0 172 172 // Lance la résolution de l'équadif, jusqu'à la valeur 173 173 // tf du temps. N valeurs intermédiaires sont retournées dans … … 189 189 //++ 190 190 void 191 DiffEqSolver::SolveV( Vector& yf, double tf)191 DiffEqSolver::SolveV(OVector& yf, double tf) 192 192 // 193 193 // Lance la résolution de l'équadif, jusqu'à la valeur … … 201 201 { 202 202 double t; 203 Matrix m(1, mFunc->NFuncReal());203 OMatrix m(1, mFunc->NFuncReal()); 204 204 SolveArr(m, &t, tf, 1); 205 205 yf.Realloc(mFunc->NFunc()); … … 219 219 ASSERT(mFunc->NFunc() == 1); 220 220 double t; 221 Matrix m(1,mFunc->NFuncReal());221 OMatrix m(1,mFunc->NFuncReal()); 222 222 SolveArr(m, &t, tf, 1); 223 223 yf = m(0,0); … … 238 238 { 239 239 double t; 240 Matrix m(1, mFunc->NFuncReal());240 OMatrix m(1, mFunc->NFuncReal()); 241 241 SolveArr(m, &t, tf, 1); 242 242 for (int i=0; i<mFunc->NFunc(); i++) … … 258 258 { 259 259 ASSERT(mFunc->NFunc() == 1); 260 Matrix m(n, mFunc->NFuncReal());260 OMatrix m(n, mFunc->NFuncReal()); 261 261 SolveArr(m, t, tf, n); 262 262 for (int i=0; i<n; i++) … … 281 281 //-- 282 282 { 283 Matrix m(n, mFunc->NFuncReal());283 OMatrix m(n, mFunc->NFuncReal()); 284 284 SolveArr(m, t, tf, n); 285 285 for (int i=0; i<n; i++) … … 318 318 319 319 //++ 320 // virtual void ComputeV( Vector& fpi,Vector const& fi)320 // virtual void ComputeV(OVector& fpi, OVector const& fi) 321 321 // Calcule les valeurs des dérivées fpi à partir des valeurs 322 322 // des fonctions fi. A redéfinir. … … 340 340 341 341 //++ 342 // virtual void AdjustStart( Vector& start, double tstart)342 // virtual void AdjustStart(OVector& start, double tstart) 343 343 // Pour ajuster le vecteur de départ quand il y a des 344 344 // fonctions à usage interne... … … 405 405 406 406 void 407 DiffEqFcnT1::ComputeV( Vector& fpi,Vector const& fi)407 DiffEqFcnT1::ComputeV(OVector& fpi, OVector const& fi) 408 408 { 409 409 fpi(0) = (*mFcn)(fi(0), fi(1)); … … 412 412 413 413 void 414 DiffEqFcnT1::AdjustStart( Vector& start, double tstart)414 DiffEqFcnT1::AdjustStart(OVector& start, double tstart) 415 415 { 416 416 start.Realloc(2); … … 446 446 447 447 void 448 DiffEqFcn2::ComputeV( Vector& fpi,Vector const& fi)448 DiffEqFcn2::ComputeV(OVector& fpi, OVector const& fi) 449 449 { 450 450 fpi(0) = fi(1); … … 481 481 482 482 void 483 DiffEqFcnT2::ComputeV( Vector& fpi,Vector const& fi)483 DiffEqFcnT2::ComputeV(OVector& fpi, OVector const& fi) 484 484 { 485 485 fpi(0) = fi(1); … … 489 489 490 490 void 491 DiffEqFcnT2::AdjustStart( Vector& start, double tstart)491 DiffEqFcnT2::AdjustStart(OVector& start, double tstart) 492 492 { 493 493 start.Realloc(3); … … 505 505 // un vecteur de dimension 3. 506 506 // On fournit une fonction de type 507 //| typedef void(*DIFEQFCNV)( Vector& y2,Vector const& y1,508 //| Vector const& y);507 //| typedef void(*DIFEQFCNV)(OVector& y2, OVector const& y1, 508 //| OVector const& y); 509 509 // qui retourne y'' en fonction de y' et y. 510 510 // Note : le système résolu est alors en fait … … 527 527 528 528 void 529 DiffEqFcnV::ComputeV( Vector& fpi,Vector const& fi)529 DiffEqFcnV::ComputeV(OVector& fpi, OVector const& fi) 530 530 { 531 531 fpi(0) = fi(3); … … 582 582 583 583 void 584 RK4DiffEq::SolveArr( Matrix& y, double* t, double tf, int n)584 RK4DiffEq::SolveArr(OMatrix& y, double* t, double tf, int n) 585 585 { 586 586 //TIMEF; … … 592 592 double dx = (tf - mXStart)/(n*nStep); 593 593 594 Vector yt = mYStart;594 OVector yt = mYStart; 595 595 596 596 k1.Realloc(mFunc->NFuncReal()); … … 610 610 611 611 void 612 RK4DiffEq::RKStep( Vector& newY,Vector const& y0, double dt)612 RK4DiffEq::RKStep(OVector& newY, OVector const& y0, double dt) 613 613 { 614 614 mFunc->ComputeV(k1, y0); -
trunk/SophyaLib/NTools/difeq.h
r307 r508 28 28 29 29 // Calcule les valeurs des derivees fpi a partir des valeurs des fonctions fi 30 virtual void ComputeV( Vector& fpi,Vector const& fi)30 virtual void ComputeV(OVector& fpi, OVector const& fi) 31 31 { Compute(fpi(0), fi(0)); } 32 32 … … 44 44 // Pour ajuster vecteur de depart quand il y a des fonctions a usage 45 45 // interne... 46 virtual void AdjustStart( Vector& /*start*/, double /*tstart*/)46 virtual void AdjustStart(OVector& /*start*/, double /*tstart*/) 47 47 {} 48 48 protected: … … 87 87 // Implementation de Compute qui va utiliser la fonction fournie 88 88 // au constructeur. 89 virtual void ComputeV( Vector& fpi,Vector const& fi);89 virtual void ComputeV(OVector& fpi, OVector const& fi); 90 90 91 91 // Implementation de AdjustStart qui gere la fonction a usage interne. 92 virtual void AdjustStart( Vector& start, double tstart);92 virtual void AdjustStart(OVector& start, double tstart); 93 93 protected: 94 94 DIFEQFCNT1 mFcn; … … 102 102 DiffEqFcn2(DIFEQFCN2); 103 103 104 virtual void ComputeV( Vector& fpi,Vector const& fi);104 virtual void ComputeV(OVector& fpi, OVector const& fi); 105 105 protected: 106 106 DIFEQFCN2 mFcn; … … 121 121 // Implementation de Compute qui va utiliser la fonction fournie 122 122 // au constructeur. 123 virtual void ComputeV( Vector& fpi,Vector const& fi);123 virtual void ComputeV(OVector& fpi, OVector const& fi); 124 124 125 125 // Implementation de AdjustStart qui gere la fonction a usage interne. 126 virtual void AdjustStart( Vector& start, double tstart);126 virtual void AdjustStart(OVector& start, double tstart); 127 127 protected: 128 128 DIFEQFCNT2 mFcn; … … 130 130 131 131 // Cas y'' = f(y',y) avec des 3-vecteurs 132 typedef void(*DIFEQFCNV)( Vector&, Vector const&,Vector const&);132 typedef void(*DIFEQFCNV)(OVector&, OVector const&, OVector const&); 133 133 134 134 // <summary> y'' = f(y',y,t) </summary> 135 135 // Cas y'' = f(y',y,t), on fournit la fonction f, sous la forme 136 // double f( Vector), et ca construit la bonne DiffEqFunction136 // double f(OVector), et ca construit la bonne DiffEqFunction 137 137 class DiffEqFcnV : public DiffEqFunction { 138 138 public: 139 // Constructeur, on fournit une fonction ( Vector)->double139 // Constructeur, on fournit une fonction (OVector)->double 140 140 // qui donne y'' en fonction du vecteur (t, y, y') 141 141 DiffEqFcnV(DIFEQFCNV); … … 143 143 // Implementation de Compute qui va utiliser la fonction fournie 144 144 // au constructeur. 145 virtual void ComputeV( Vector& fpi,Vector const& fi);145 virtual void ComputeV(OVector& fpi, OVector const& fi); 146 146 protected: 147 147 DIFEQFCNV mFcn; 148 Vector tmp1, tmp2, tmp3;148 OVector tmp1, tmp2, tmp3; 149 149 }; 150 150 … … 176 176 // Change les conditions initiales. Notation chainee possible. 177 177 // <group> 178 DiffEqSolver& StartV( Vector const& yi, double t);178 DiffEqSolver& StartV(OVector const& yi, double t); 179 179 // si NFunc == 1 180 180 DiffEqSolver& Start1(double yi, double t); … … 184 184 // Lance la resolution, avec ou sans conservation de n valeurs intermediaires 185 185 // <group> 186 virtual void SolveV( Vector& yf, double tf);186 virtual void SolveV(OVector& yf, double tf); 187 187 // si NFunc == 1 188 188 virtual void Solve1(double& yf, double tf); 189 189 virtual void Solve(double* yf, double tf); 190 virtual void SolveArr( Matrix& y, double* t, double tf, int n)=0;190 virtual void SolveArr(OMatrix& y, double* t, double tf, int n)=0; 191 191 // si NFunc == 1 192 192 virtual void SolveArr1(double* y, double* t, double tf, int n); … … 198 198 bool mOwnFunc; 199 199 200 Vector mYStart;200 OVector mYStart; 201 201 double mXStart; 202 202 double mStep; … … 215 215 216 216 // Implementation de RK4 217 virtual void SolveArr( Matrix& y, double* t, double tf, int n);217 virtual void SolveArr(OMatrix& y, double* t, double tf, int n); 218 218 219 219 protected: 220 220 // Un pas RK4 221 void RKStep( Vector& newY,Vector const& y0, double dt);221 void RKStep(OVector& newY, OVector const& y0, double dt); 222 222 // Vecteurs utilises en interne, pour ne pas les reallouer. 223 Vector k1, k2, k3, k4;223 OVector k1, k2, k3, k4; 224 224 }; 225 225 -
trunk/SophyaLib/NTools/fftserver.cc
r467 r508 156 156 } 157 157 158 void FFTServer::fftf( Vector& in,Vector& out)158 void FFTServer::fftf(OVector& in, OVector& out) 159 159 { 160 160 int l = in.NElts(); 161 /* ----- Si c'etait un Vector<float> on aurait ecrit comme ca162 Pour le moment Vector est double, on passe donc par un tableau161 /* ----- Si c'etait un OVector<float> on aurait ecrit comme ca 162 Pour le moment OVector est double, on passe donc par un tableau 163 163 intermediare 164 164 // La transformee sur le tableau de flaot se fait en place, … … 175 175 } 176 176 177 void FFTServer::fftb( Vector& in,Vector& out)177 void FFTServer::fftb(OVector& in, OVector& out) 178 178 { 179 179 int l = in.NElts(); 180 /* ----- Si c'etait un Vector<float> on aurait ecrit comme ca181 Pour le moment Vector est double, on passe donc par un tableau180 /* ----- Si c'etait un OVector<float> on aurait ecrit comme ca 181 Pour le moment OVector est double, on passe donc par un tableau 182 182 intermediare 183 183 // La transformee sur le tableau de flaot se fait en place, -
trunk/SophyaLib/NTools/fftserver.h
r467 r508 17 17 virtual void fftf(int l, complex<double>* inout); 18 18 virtual void fftb(int l, complex<double>* inout); 19 virtual void fftf( Vector& in,Vector& out);20 virtual void fftb( Vector& in,Vector& out);19 virtual void fftf(OVector& in, OVector& out); 20 virtual void fftb(OVector& in, OVector& out); 21 21 22 22 protected: … … 94 94 \param inout input array /output backward FFT(original array destroyed) 95 95 */ 96 /*!\fn virtual void FFTServer::fftf( Vector& in,Vector& out)96 /*!\fn virtual void FFTServer::fftf(OVector& in, OVector& out) 97 97 \param in input array 98 98 \param out forward FFT 99 99 */ 100 /*! \fn virtual void FFTServer::fftb( Vector& in,Vector& out)100 /*! \fn virtual void FFTServer::fftb(OVector& in, OVector& out) 101 101 \param in input array 102 102 \param out backward FFT -
trunk/SophyaLib/NTools/generaldata.cc
r490 r508 748 748 if(varx<0 || varx>=mNVar) return -2.; 749 749 if(mNDataGood<=0) return -4.; 750 Vector x(mNDataGood);751 Vector y(mNDataGood);752 Vector ey2(1);750 OVector x(mNDataGood); 751 OVector y(mNDataGood); 752 OVector ey2(1); 753 753 if(ey) ey2.Realloc(mNDataGood,true); 754 754 int ntest = 0; … … 763 763 double res = 0.; 764 764 if(ey) { 765 Vector errcoef(1);765 OVector errcoef(1); 766 766 res = pol.Fit(x,y,ey2,degre,errcoef); 767 767 } else { … … 797 797 if(vary<0 || vary>=mNVar || vary==varx) return -3.; 798 798 if(mNDataGood<=0) return -4.; 799 Vector x(mNDataGood);800 Vector y(mNDataGood);801 Vector z(mNDataGood);802 Vector ez2(1);799 OVector x(mNDataGood); 800 OVector y(mNDataGood); 801 OVector z(mNDataGood); 802 OVector ez2(1); 803 803 if(ez) ez2.Realloc(mNDataGood,true); 804 804 int ntest = 0; … … 814 814 double res = 0.; 815 815 if(ez) { 816 Vector errcoef(1);816 OVector errcoef(1); 817 817 if(degre2>0) res = pol.Fit(x,y,z,ez2,degre1,degre2,errcoef); 818 818 else res = pol.Fit(x,y,z,ez2,degre1,errcoef); -
trunk/SophyaLib/NTools/generalfit.cc
r490 r508 874 874 875 875 //++ 876 Vector GeneralFit::GetParm()876 OVector GeneralFit::GetParm() 877 877 // 878 878 // Retourne les valeurs des parametres dans un vecteur. … … 1096 1096 { 1097 1097 volatile double oldChi2; 1098 Matrix COVAR(mNPar,mNPar);1099 Vector DA(mNPar);1100 Vector dparam(mNPar);1101 Vector paramTry(mNPar);1102 Vector param_tr(mNPar);1103 Vector paramTry_tr(mNPar);1104 Vector step_tr(mNPar);1098 OMatrix COVAR(mNPar,mNPar); 1099 OVector DA(mNPar); 1100 OVector dparam(mNPar); 1101 OVector paramTry(mNPar); 1102 OVector param_tr(mNPar); 1103 OVector paramTry_tr(mNPar); 1104 OVector step_tr(mNPar); 1105 1105 nStop = nStopL = nStep = 0; 1106 1106 Chi2 = oldChi2 = 0.; … … 1515 1515 1516 1516 ////////////////////////////////////////////////////////////////////// 1517 void GeneralFit::write_in_step(double ci2, Vector& par)1517 void GeneralFit::write_in_step(double ci2,OVector& par) 1518 1518 { 1519 1519 if(FileStep==NULL) return; … … 1524 1524 1525 1525 ////////////////////////////////////////////////////////////////////// 1526 void GeneralFit::TryFunc( Vector& par,Vector& par_tr)1526 void GeneralFit::TryFunc(OVector& par,OVector& par_tr) 1527 1527 { 1528 1528 BETA_Try = 0; 1529 1529 ATGA_Try = 0; 1530 1530 Chi2 = 0; 1531 Vector deriv(mNPar);1532 Vector derivtr(mNPar);1531 OVector deriv(mNPar); 1532 OVector derivtr(mNPar); 1533 1533 double result; 1534 1534 … … 1564 1564 1565 1565 ////////////////////////////////////////////////////////////////////// 1566 void GeneralFit::TryXi2( Vector& par,Vector& par_tr)1566 void GeneralFit::TryXi2(OVector& par,OVector& par_tr) 1567 1567 { 1568 1568 double c, *parloc; … … 1664 1664 1665 1665 ////////////////////////////////////////////////////////////////////// 1666 Vector GeneralFit::p_vers_tr(Vector const& p)1667 { 1668 Vector tr(p);1666 OVector GeneralFit::p_vers_tr(OVector const& p) 1667 { 1668 OVector tr(p); 1669 1669 for(int i=0;i<mNPar;i++) { 1670 1670 if( fixParam[i] || ! boundParam[i] ) continue; … … 1675 1675 1676 1676 ////////////////////////////////////////////////////////////////////// 1677 void GeneralFit::p_vers_tr( Vector const& p,Vector& tr)1677 void GeneralFit::p_vers_tr(OVector const& p,OVector& tr) 1678 1678 { 1679 1679 for(int i=0;i<mNPar;i++) { … … 1695 1695 1696 1696 ////////////////////////////////////////////////////////////////////// 1697 Vector GeneralFit::tr_vers_p(Vector const& tr)1698 { 1699 Vector p(tr);1697 OVector GeneralFit::tr_vers_p(OVector const& tr) 1698 { 1699 OVector p(tr); 1700 1700 for(int i=0;i<mNPar;i++) { 1701 1701 if( fixParam[i] || ! boundParam[i] ) continue; … … 1706 1706 1707 1707 ////////////////////////////////////////////////////////////////////// 1708 void GeneralFit::tr_vers_p( Vector const& tr,Vector& p)1708 void GeneralFit::tr_vers_p(OVector const& tr,OVector& p) 1709 1709 { 1710 1710 for(int i=0;i<mNPar;i++) { … … 1727 1727 1728 1728 ////////////////////////////////////////////////////////////////////// 1729 Vector GeneralFit::dp_vers_dtr(Vector const& dp,Vector const& tr)1730 { 1731 Vector dtr(dp);1729 OVector GeneralFit::dp_vers_dtr(OVector const& dp,OVector const& tr) 1730 { 1731 OVector dtr(dp); 1732 1732 for(int i=0;i<mNPar;i++) { 1733 1733 if( fixParam[i] || ! boundParam[i] ) continue; … … 1738 1738 1739 1739 ////////////////////////////////////////////////////////////////////// 1740 void GeneralFit::dp_vers_dtr( Vector const& dp,Vector const& tr,Vector& dtr)1740 void GeneralFit::dp_vers_dtr(OVector const& dp,OVector const& tr,OVector& dtr) 1741 1741 { 1742 1742 for(int i=0;i<mNPar;i++) { … … 1759 1759 1760 1760 ////////////////////////////////////////////////////////////////////// 1761 Vector GeneralFit::dtr_vers_dp(Vector const& dtr,Vector const& tr)1762 { 1763 Vector dp(dtr);1761 OVector GeneralFit::dtr_vers_dp(OVector const& dtr,OVector const& tr) 1762 { 1763 OVector dp(dtr); 1764 1764 for(int i=0;i<mNPar;i++) { 1765 1765 if( fixParam[i] || ! boundParam[i] ) continue; … … 1771 1771 ////////////////////////////////////////////////////////////////////// 1772 1772 // inline fonction pour aller + vite dans le try() 1773 //void GeneralFit::dtr_vers_dp( Vector const& dtr,Vector const& tr,Vector& dp)1774 1775 ////////////////////////////////////////////////////////////////////// 1776 int GeneralFit::put_in_limits_for_deriv( Vector const& p,Vector& dp,double dist)1773 //void GeneralFit::dtr_vers_dp(OVector const& dtr,OVector const& tr,OVector& dp) 1774 1775 ////////////////////////////////////////////////////////////////////// 1776 int GeneralFit::put_in_limits_for_deriv(OVector const& p,OVector& dp,double dist) 1777 1777 // 1-/ Redefinit dp pour qu'il soit superieur a minStepDeriv 1778 1778 // 2-/ Redefinit dp pour que p+/-dp reste dans les limites (parametre borne) -
trunk/SophyaLib/NTools/generalfit.h
r307 r508 124 124 125 125 double GetParm(int); 126 Vector GetParm();126 OVector GetParm(); 127 127 double GetParmErr(int); 128 128 double GetCoVar(int,int); … … 168 168 GeneralFitData* mData; 169 169 170 Vector Param;171 Vector errParam;172 Vector stepParam;173 Vector minParam;174 Vector maxParam;175 Vector minStepDeriv;176 Vector Eps;170 OVector Param; 171 OVector errParam; 172 OVector stepParam; 173 OVector minParam; 174 OVector maxParam; 175 OVector minStepDeriv; 176 OVector Eps; 177 177 unsigned short int* fixParam; 178 178 unsigned short int* boundParam; … … 188 188 FILE *FileStep; 189 189 190 Matrix ATGA;191 Vector BETA;192 Matrix ATGA_Try;193 Vector BETA_Try;194 Vector C;195 Vector D;190 OMatrix ATGA; 191 OVector BETA; 192 OMatrix ATGA_Try; 193 OVector BETA_Try; 194 OVector C; 195 OVector D; 196 196 197 197 double Chi2; … … 202 202 203 203 // Fonctions privees 204 void write_in_step(double ci2, Vector& par);204 void write_in_step(double ci2,OVector& par); 205 205 void General_Init(void); 206 void TryFunc( Vector& par,Vector& par_tr);207 void TryXi2( Vector& par,Vector& par_tr);206 void TryFunc(OVector& par,OVector& par_tr); 207 void TryXi2(OVector& par,OVector& par_tr); 208 208 void CheckSanity(); 209 209 void Set_Bound_C_D(int i); 210 210 void Set_Bound_C_D(); 211 211 double p_vers_tr(int i,double p); 212 Vector p_vers_tr(Vector const& p);213 void p_vers_tr( Vector const& p,Vector& tr);212 OVector p_vers_tr(OVector const& p); 213 void p_vers_tr(OVector const& p,OVector& tr); 214 214 double tr_vers_p(int i,double tr); 215 Vector tr_vers_p(Vector const& tr);216 void tr_vers_p( Vector const& tr,Vector& p);215 OVector tr_vers_p(OVector const& tr); 216 void tr_vers_p(OVector const& tr,OVector& p); 217 217 double c_dp_vers_dtr(int i,double tr); 218 Vector dp_vers_dtr(Vector const& dp,Vector const& tr);219 void dp_vers_dtr( Vector const& dp,Vector const& tr,Vector& dtr);218 OVector dp_vers_dtr(OVector const& dp,OVector const& tr); 219 void dp_vers_dtr(OVector const& dp,OVector const& tr,OVector& dtr); 220 220 double c_dtr_vers_dp(int i,double tr); 221 Vector dtr_vers_dp(Vector const& dtr,Vector const& tr);222 int put_in_limits_for_deriv( Vector const& p,Vector& dp,double dist=0.66);223 inline void dtr_vers_dp( Vector const& dtr,Vector const& tr,Vector& dp)221 OVector dtr_vers_dp(OVector const& dtr,OVector const& tr); 222 int put_in_limits_for_deriv(OVector const& p,OVector& dp,double dist=0.66); 223 inline void dtr_vers_dp(OVector const& dtr,OVector const& tr,OVector& dp) 224 224 { for(int i=0;i<mNPar;i++) 225 225 { if( fixParam[i] ) continue; -
trunk/SophyaLib/NTools/hisprof.cc
r490 r508 260 260 //-- 261 261 //++ 262 // inline void GetMean( Vector& v)262 // inline void GetMean(OVector& v) 263 263 // Retourne le contenu de la moyenne dans le vecteur v 264 264 //-- 265 265 //++ 266 // inline void GetError2( Vector& v)266 // inline void GetError2(OVector& v) 267 267 // Retourne le contenu au carre de la dispersion/erreur dans le vecteur v 268 268 //-- -
trunk/SophyaLib/NTools/hisprof.h
r490 r508 29 29 // Acces a l information 30 30 inline Histo GetHisto() {if(!Ok) UpdateHisto(); return (Histo) *this;} 31 inline void GetMean( Vector& v) {if(!Ok) UpdateHisto(); Histo::GetValue(v);}32 inline void GetError2( Vector& v) {if(!Ok) UpdateHisto(); Histo::GetError2(v);}31 inline void GetMean(OVector& v) {if(!Ok) UpdateHisto(); Histo::GetValue(v);} 32 inline void GetError2(OVector& v) {if(!Ok) UpdateHisto(); Histo::GetError2(v);} 33 33 inline float operator()(int i) const {if(!Ok) UpdateHisto(); return data[i];} 34 34 inline float Error2(int i) const {if(!Ok) UpdateHisto(); return (float) err2[i];} -
trunk/SophyaLib/NTools/histos.cc
r490 r508 1 1 // 2 // $Id: histos.cc,v 1. 4 1999-10-21 15:25:45ansari Exp $2 // $Id: histos.cc,v 1.5 1999-10-25 10:36:07 ansari Exp $ 3 3 // 4 4 … … 404 404 /********* Methode *********/ 405 405 //++ 406 void Histo::GetAbsc( Vector &v)406 void Histo::GetAbsc(OVector &v) 407 407 // 408 408 // Remplissage d'un tableau avec la valeur des abscisses … … 415 415 416 416 //++ 417 void Histo::GetValue( Vector &v)417 void Histo::GetValue(OVector &v) 418 418 // 419 419 // Remplissage d'un tableau avec la valeur du contenu … … 426 426 427 427 //++ 428 void Histo::GetError2( Vector &v)428 void Histo::GetError2(OVector &v) 429 429 // 430 430 // Remplissage d'un tableau avec la valeur des erreurs au carre … … 438 438 439 439 //++ 440 void Histo::GetError( Vector &v)440 void Histo::GetError(OVector &v) 441 441 // 442 442 // Remplissage d'un tableau avec la valeur des erreurs … … 451 451 /********* Methode *********/ 452 452 //++ 453 void Histo::PutValue( Vector &v, int ierr)453 void Histo::PutValue(OVector &v, int ierr) 454 454 // 455 455 // Remplissage du contenu de l'histo avec les valeurs d'un vecteur … … 465 465 466 466 //++ 467 void Histo::PutValueAdd( Vector &v, int ierr)467 void Histo::PutValueAdd(OVector &v, int ierr) 468 468 // 469 469 // Addition du contenu de l'histo avec les valeurs d'un vecteur … … 479 479 480 480 //++ 481 void Histo::PutError2( Vector &v)481 void Histo::PutError2(OVector &v) 482 482 // 483 483 // Remplissage des erreurs au carre de l'histo avec les valeurs d'un vecteur … … 491 491 492 492 //++ 493 void Histo::PutError2Add( Vector &v)493 void Histo::PutError2Add(OVector &v) 494 494 // 495 495 // Addition des erreurs au carre de l'histo avec les valeurs d'un vecteur … … 503 503 504 504 //++ 505 void Histo::PutError( Vector &v)505 void Histo::PutError(OVector &v) 506 506 // 507 507 // Remplissage des erreurs de l'histo avec les valeurs d'un vecteur … … 1121 1121 } 1122 1122 1123 Vector xFit(nLowHigh);1124 Vector yFit(nLowHigh);1125 Vector e2Fit(nLowHigh);1126 Vector errcoef(1);1123 OVector xFit(nLowHigh); 1124 OVector yFit(nLowHigh); 1125 OVector e2Fit(nLowHigh); 1126 OVector errcoef(1); 1127 1127 int ii = 0; 1128 1128 for (int j=iLow; j<=iHigh; j++) { … … 1444 1444 if(f==NULL) 1445 1445 throw(NullPtrError("Histo::FitResidus: NULL pointer\n")); 1446 Vector par = gfit.GetParm();1446 OVector par = gfit.GetParm(); 1447 1447 Histo h(*this); 1448 1448 for(int i=0;i<NBins();i++) { … … 1464 1464 if(f==NULL) 1465 1465 throw(NullPtrError("Histo::FitFunction: NULL pointer\n")); 1466 Vector par = gfit.GetParm();1466 OVector par = gfit.GetParm(); 1467 1467 Histo h(*this); 1468 1468 for(int i=0;i<NBins();i++) { -
trunk/SophyaLib/NTools/histos.h
r490 r508 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: histos.h,v 1. 3 1999-10-21 15:25:47 ansari Exp $3 // $Id: histos.h,v 1.4 1999-10-25 10:36:07 ansari Exp $ 4 4 // 5 5 … … 66 66 67 67 // get/put dans/depuis un vector 68 void GetAbsc( Vector& v);69 void GetValue( Vector& v);70 void GetError2( Vector& v);71 void GetError( Vector& v);72 void PutValue( Vector& v, int ierr=0);73 void PutValueAdd( Vector &v, int ierr=0);74 void PutError2( Vector& v);75 void PutError2Add( Vector& v);76 void PutError( Vector& v);68 void GetAbsc(OVector& v); 69 void GetValue(OVector& v); 70 void GetError2(OVector& v); 71 void GetError(OVector& v); 72 void PutValue(OVector& v, int ierr=0); 73 void PutValueAdd(OVector &v, int ierr=0); 74 void PutError2(OVector& v); 75 void PutError2Add(OVector& v); 76 void PutError(OVector& v); 77 77 78 78 // INLINES -
trunk/SophyaLib/NTools/histos2.cc
r490 r508 603 603 /////////////////////////////////////////////////////////////////// 604 604 //++ 605 void Histo2D::GetXCoor( Vector &v)605 void Histo2D::GetXCoor(OVector &v) 606 606 // 607 607 // Remplissage d'un tableau avec les valeurs des abscisses. … … 615 615 616 616 //++ 617 void Histo2D::GetYCoor( Vector &v)617 void Histo2D::GetYCoor(OVector &v) 618 618 // 619 619 // Remplissage d'un tableau avec les valeurs des ordonnees. … … 644 644 645 645 //++ 646 void Histo2D::GetValue( Matrix &v)646 void Histo2D::GetValue(OMatrix &v) 647 647 // 648 648 // Remplissage d'un tableau avec les valeurs du contenu. … … 656 656 657 657 //++ 658 void Histo2D::GetError2( Matrix &v)658 void Histo2D::GetError2(OMatrix &v) 659 659 // 660 660 // Remplissage d'un tableau avec les valeurs du carre des erreurs. … … 670 670 671 671 //++ 672 void Histo2D::GetError( Matrix &v)672 void Histo2D::GetError(OMatrix &v) 673 673 // 674 674 // Remplissage d'un tableau avec les valeurs des erreurs. … … 685 685 /////////////////////////////////////////////////////////////////// 686 686 //++ 687 void Histo2D::PutValue( Matrix &v, int ierr)687 void Histo2D::PutValue(OMatrix &v, int ierr) 688 688 // 689 689 // Remplissage du contenu de l'histo avec les valeurs d'un tableau. … … 700 700 701 701 //++ 702 void Histo2D::PutValueAdd( Matrix &v, int ierr)702 void Histo2D::PutValueAdd(OMatrix &v, int ierr) 703 703 // 704 704 // Addition du contenu de l'histo avec les valeurs d'un tableau. … … 715 715 716 716 //++ 717 void Histo2D::PutError2( Matrix &v)717 void Histo2D::PutError2(OMatrix &v) 718 718 // 719 719 // Remplissage des erreurs au carre de l'histo … … 729 729 730 730 //++ 731 void Histo2D::PutError2Add( Matrix &v)731 void Histo2D::PutError2Add(OMatrix &v) 732 732 // 733 733 // Addition des erreurs au carre de l'histo … … 744 744 745 745 //++ 746 void Histo2D::PutError( Matrix &v)746 void Histo2D::PutError(OMatrix &v) 747 747 // 748 748 // Remplissage des erreurs de l'histo avec les valeurs d'un tableau. … … 1105 1105 if(f==NULL) 1106 1106 throw(NullPtrError("Histo2D::FitResidus: NULL pointer\n")); 1107 Vector par = gfit.GetParm();1107 OVector par = gfit.GetParm(); 1108 1108 Histo2D h2(*this); 1109 1109 for(int i=0;i<NBinX();i++) for(int j=0;j<NBinY();j++) { … … 1127 1127 if(f==NULL) 1128 1128 throw(NullPtrError("Histo2D::FitFunction: NULL pointer\n")); 1129 Vector par = gfit.GetParm();1129 OVector par = gfit.GetParm(); 1130 1130 Histo2D h2(*this); 1131 1131 for(int i=0;i<NBinX();i++) for(int j=0;j<NBinY();j++) { -
trunk/SophyaLib/NTools/histos2.h
r490 r508 63 63 64 64 // get/put dans/depuis une matrice / vector 65 void GetXCoor( Vector& v);66 void GetValue( Matrix &v);67 void GetYCoor( Vector& v);68 void GetError2( Matrix& v);69 void GetError( Matrix& v);70 void PutValue( Matrix& v, int ierr=0);71 void PutValueAdd( Matrix& v, int ierr=0);72 void PutError2( Matrix& v);73 void PutError2Add( Matrix& v);74 void PutError( Matrix& v);65 void GetXCoor(OVector& v); 66 void GetValue(OMatrix &v); 67 void GetYCoor(OVector& v); 68 void GetError2(OMatrix& v); 69 void GetError(OMatrix& v); 70 void PutValue(OMatrix& v, int ierr=0); 71 void PutValueAdd(OMatrix& v, int ierr=0); 72 void PutError2(OMatrix& v); 73 void PutError2Add(OMatrix& v); 74 void PutError(OMatrix& v); 75 75 76 76 // INLINES -
trunk/SophyaLib/NTools/linfit.cc
r244 r508 5 5 #include "cvector.h" 6 6 7 double LinFit(const Vector& x, constVector& y, int nf, double (*f)(int, double),8 Vector& c)7 double LinFit(const OVector& x, const OVector& y, int nf, double (*f)(int, double), 8 OVector& c) 9 9 { 10 10 int n = x.NElts(); 11 11 if (n != y.NElts()) THROW(sizeMismatchErr); 12 12 13 Matrix fx(nf, n);13 OMatrix fx(nf, n); 14 14 for (int i=0; i<nf; i++) 15 15 for (int j=0; j<n; j++) … … 21 21 22 22 23 double LinFit(const Matrix& fx, const Vector& y,Vector& c)23 double LinFit(const OMatrix& fx, const OVector& y, OVector& c) 24 24 { 25 25 int n = y.NElts(); … … 28 28 int nf = fx.NRows(); 29 29 30 Matrix a(nf,nf);30 OMatrix a(nf,nf); 31 31 32 32 for (int j=0; j<nf; j++) … … 36 36 c = fx * y; 37 37 38 if ( Matrix::GausPiv(a,c) == 0) THROW(singMatxErr);38 if (OMatrix::GausPiv(a,c) == 0) THROW(singMatxErr); 39 39 40 40 double xi2 = 0; … … 52 52 53 53 54 double LinFit(const Vector& x, const Vector& y, constVector& errY2, int nf,55 double (*f)(int, double), Vector& c,Vector& errC)54 double LinFit(const OVector& x, const OVector& y, const OVector& errY2, int nf, 55 double (*f)(int, double), OVector& c, OVector& errC) 56 56 { 57 57 int n = x.NElts(); 58 58 if (n != y.NElts()) THROW(sizeMismatchErr); 59 59 60 Matrix fx(nf, n);60 OMatrix fx(nf, n); 61 61 for (int i=0; i<nf; i++) 62 62 for (int j=0; j<n; j++) … … 67 67 68 68 69 double LinFit(const Matrix& fx, const Vector& y, constVector& errY2,70 Vector& c,Vector& errC)69 double LinFit(const OMatrix& fx, const OVector& y, const OVector& errY2, 70 OVector& c, OVector& errC) 71 71 { 72 72 int n = y.NElts(); … … 76 76 int nf = fx.NRows(); 77 77 78 Matrix a(nf,nf);78 OMatrix a(nf,nf); 79 79 80 80 c.Realloc(nf); … … 89 89 } 90 90 91 Matrix d(nf,nf+1);91 OMatrix d(nf,nf+1); 92 92 for (int k=0; k<nf; k++) { 93 93 double x=0; … … 99 99 } 100 100 101 if ( Matrix::GausPiv(a,d) == 0) THROW(singMatxErr);101 if (OMatrix::GausPiv(a,d) == 0) THROW(singMatxErr); 102 102 103 103 for (int l=0; l<nf; l++) { -
trunk/SophyaLib/NTools/linfit.h
r494 r508 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: linfit.h,v 1. 2 1999-10-21 18:45:46ansari Exp $3 // $Id: linfit.h,v 1.3 1999-10-25 10:36:08 ansari Exp $ 4 4 // 5 5 … … 10 10 11 11 #include "machdefs.h" 12 class Matrix;13 class Vector;12 class OMatrix; 13 class OVector; 14 14 15 double LinFit(const Vector& x, constVector& y, int nf,16 double (*f)(int, double), Vector& c);15 double LinFit(const OVector& x, const OVector& y, int nf, 16 double (*f)(int, double), OVector& c); 17 17 // fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1; 18 18 19 19 20 double LinFit(const Matrix& fx, const Vector& y,Vector& c);20 double LinFit(const OMatrix& fx, const OVector& y, OVector& c); 21 21 // fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1, 22 22 // la matrice fx contient les valeurs des f: … … 24 24 25 25 26 double LinFit(const Vector& x, const Vector& y, constVector& errY2, int nf,27 double (*f)(int, double), Vector& c,Vector& errC);26 double LinFit(const OVector& x, const OVector& y, const OVector& errY2, int nf, 27 double (*f)(int, double), OVector& c, OVector& errC); 28 28 // fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1, 29 29 // errY2 contient les carres des erreurs sur les Y. … … 31 31 32 32 33 double LinFit(const Matrix& fx, const Vector& y, constVector& errY2,34 Vector& c,Vector& errC);33 double LinFit(const OMatrix& fx, const OVector& y, const OVector& errY2, 34 OVector& c, OVector& errC); 35 35 // fit lineaire des y en tant que somme de c(i)f(i,x), i=0..nf-1, 36 36 // la matrice fx contient les valeurs des f: -
trunk/SophyaLib/NTools/matrix.cc
r490 r508 1 // $Id: matrix.cc,v 1. 5 1999-10-21 15:25:49 ansari Exp $1 // $Id: matrix.cc,v 1.6 1999-10-25 10:36:09 ansari Exp $ 2 2 3 3 #include "machdefs.h" … … 26 26 27 27 //++ 28 // Class Matrix28 // Class OMatrix 29 29 // Lib Outils++ 30 30 // include matrix.h … … 38 38 39 39 //++ 40 Matrix::Matrix()40 OMatrix::OMatrix() 41 41 // 42 42 // Construit une matrice 1x1 (pour ppersist). … … 50 50 51 51 //++ 52 Matrix::Matrix(int r, int c)52 OMatrix::OMatrix(int r, int c) 53 53 // 54 54 // Construit une matrice de r lignes et c colonnes. … … 62 62 63 63 //++ 64 Matrix::Matrix(int r, int c, double* values)64 OMatrix::OMatrix(int r, int c, double* values) 65 65 // 66 66 // Construit une matrice de r lignes et c colonnes. On fournit … … 73 73 74 74 //++ 75 Matrix::Matrix(constMatrix& a)75 OMatrix::OMatrix(const OMatrix& a) 76 76 // 77 77 // Constructeur par copie. … … 85 85 86 86 //++ 87 Matrix::Matrix(const TMatrix<r_8>& a)87 OMatrix::OMatrix(const TMatrix<r_8>& a) 88 88 // 89 89 // Constructeur par copie a partir d'une TMatrix<r_8>. … … 99 99 100 100 101 Matrix::~Matrix()101 OMatrix::~OMatrix() 102 102 { 103 103 DBASSERT(ndata == nr*nc); … … 111 111 112 112 //++ 113 void Matrix::Zero()113 void OMatrix::Zero() 114 114 // 115 115 // Remise à zero de tous les éléments … … 121 121 122 122 //++ 123 void Matrix::Realloc(int r, int c, bool force)123 void OMatrix::Realloc(int r, int c, bool force) 124 124 // 125 125 // Change la taille de la matrice. Réallocation physique seulement si … … 145 145 146 146 //++ 147 Matrix& Matrix::operator = (constMatrix& a)147 OMatrix& OMatrix::operator = (const OMatrix& a) 148 148 // 149 149 // Opérateur d'affectation. … … 158 158 159 159 //++ 160 Matrix&Matrix::operator = (double x)160 OMatrix& OMatrix::operator = (double x) 161 161 // 162 162 // Opérateur d'affectation depuis scalaire : identité * scalaire. … … 176 176 177 177 //++ 178 ostream& operator << (ostream& s, const Matrix& a)178 ostream& operator << (ostream& s, const OMatrix& a) 179 179 // 180 180 // Impression … … 194 194 195 195 //++ 196 Matrix&Matrix::operator *= (double b)196 OMatrix& OMatrix::operator *= (double b) 197 197 // 198 198 //-- … … 208 208 209 209 //++ 210 Matrix&Matrix::operator += (double b)210 OMatrix& OMatrix::operator += (double b) 211 211 // 212 212 //-- … … 222 222 223 223 //++ 224 Matrix&Matrix::operator -= (double b)224 OMatrix& OMatrix::operator -= (double b) 225 225 // 226 226 //-- … … 236 236 237 237 //++ 238 Matrix&Matrix::operator /= (double b)238 OMatrix& OMatrix::operator /= (double b) 239 239 // 240 240 //-- … … 251 251 252 252 //++ 253 Matrix operator * (constMatrix& a, double b)254 // 255 //-- 256 { 257 Matrix result(a);253 OMatrix operator * (const OMatrix& a, double b) 254 // 255 //-- 256 { 257 OMatrix result(a); 258 258 return (result *= b); 259 259 } 260 260 261 261 //++ 262 Matrix operator * (double b, constMatrix& a)263 // 264 //-- 265 { 266 Matrix result(a);262 OMatrix operator * (double b, const OMatrix& a) 263 // 264 //-- 265 { 266 OMatrix result(a); 267 267 return (result *= b); 268 268 } 269 269 270 270 //++ 271 Matrix operator + (constMatrix& a, double b)272 // 273 //-- 274 { 275 Matrix result(a);271 OMatrix operator + (const OMatrix& a, double b) 272 // 273 //-- 274 { 275 OMatrix result(a); 276 276 return (result += b); 277 277 } 278 278 279 279 //++ 280 Matrix operator + (double b, constMatrix& a)281 // 282 //-- 283 { 284 Matrix result(a);280 OMatrix operator + (double b, const OMatrix& a) 281 // 282 //-- 283 { 284 OMatrix result(a); 285 285 return (result += b); 286 286 } 287 287 288 288 //++ 289 Matrix operator - (constMatrix& a, double b)290 // 291 //-- 292 { 293 Matrix result(a);289 OMatrix operator - (const OMatrix& a, double b) 290 // 291 //-- 292 { 293 OMatrix result(a); 294 294 return (result -= b); 295 295 } 296 296 297 297 //++ 298 Matrix operator - (double b, constMatrix& a)299 // 300 //-- 301 { 302 Matrix result(a);298 OMatrix operator - (double b, const OMatrix& a) 299 // 300 //-- 301 { 302 OMatrix result(a); 303 303 result *= -1; 304 304 return (result += b); … … 306 306 307 307 //++ 308 Matrix operator / (constMatrix& a, double b)309 // 310 //-- 311 { 312 Matrix result(a);308 OMatrix operator / (const OMatrix& a, double b) 309 // 310 //-- 311 { 312 OMatrix result(a); 313 313 return (result /= b); 314 314 } 315 315 316 316 //++ 317 Matrix operator * (constMatrix& a, int b)318 // 319 //-- 320 { 321 Matrix result(a);317 OMatrix operator * (const OMatrix& a, int b) 318 // 319 //-- 320 { 321 OMatrix result(a); 322 322 return (result *= b); 323 323 } 324 324 325 325 //++ 326 Matrix operator * (int b, constMatrix& a)327 // 328 //-- 329 { 330 Matrix result(a);326 OMatrix operator * (int b, const OMatrix& a) 327 // 328 //-- 329 { 330 OMatrix result(a); 331 331 return (result *= b); 332 332 } 333 333 334 334 //++ 335 Matrix operator + (constMatrix& a, int b)336 // 337 //-- 338 { 339 Matrix result(a);335 OMatrix operator + (const OMatrix& a, int b) 336 // 337 //-- 338 { 339 OMatrix result(a); 340 340 return (result += b); 341 341 } 342 342 343 343 //++ 344 Matrix operator + (int b, constMatrix& a)345 // 346 //-- 347 { 348 Matrix result(a);344 OMatrix operator + (int b, const OMatrix& a) 345 // 346 //-- 347 { 348 OMatrix result(a); 349 349 return (result += b); 350 350 } 351 351 352 352 //++ 353 Matrix operator - (constMatrix& a, int b)354 // 355 //-- 356 { 357 Matrix result(a);353 OMatrix operator - (const OMatrix& a, int b) 354 // 355 //-- 356 { 357 OMatrix result(a); 358 358 return (result -= b); 359 359 } 360 360 361 361 //++ 362 Matrix operator - (int b, constMatrix& a)363 // 364 //-- 365 { 366 Matrix result(a);362 OMatrix operator - (int b, const OMatrix& a) 363 // 364 //-- 365 { 366 OMatrix result(a); 367 367 result *= -1; 368 368 return (result += b); … … 370 370 371 371 //++ 372 Matrix operator / (constMatrix& a, int b)373 // 374 //-- 375 { 376 Matrix result(a);372 OMatrix operator / (const OMatrix& a, int b) 373 // 374 //-- 375 { 376 OMatrix result(a); 377 377 return (result /= b); 378 378 } … … 382 382 383 383 //++ 384 Matrix& Matrix::operator += (constMatrix& a)384 OMatrix& OMatrix::operator += (const OMatrix& a) 385 385 // 386 386 //-- … … 399 399 400 400 //++ 401 Matrix& Matrix::operator -= (constMatrix& a)401 OMatrix& OMatrix::operator -= (const OMatrix& a) 402 402 // 403 403 //-- … … 417 417 418 418 //++ 419 Matrix& Matrix::operator *= (constMatrix& a)419 OMatrix& OMatrix::operator *= (const OMatrix& a) 420 420 // 421 421 //-- … … 448 448 449 449 //++ 450 Matrix operator + (const Matrix& a, constMatrix& b)450 OMatrix operator + (const OMatrix& a, const OMatrix& b) 451 451 // 452 452 //-- … … 454 454 if (b.nc != a.nc || b.nr != a.nr) THROW(sizeMismatchErr); 455 455 456 Matrix c(a);456 OMatrix c(a); 457 457 return (c += b); 458 458 } 459 459 460 460 //++ 461 Matrix operator - (const Matrix& a, constMatrix& b)461 OMatrix operator - (const OMatrix& a, const OMatrix& b) 462 462 // 463 463 //-- … … 465 465 if (b.nc != a.nc || b.nr != a.nr) THROW(sizeMismatchErr); 466 466 467 Matrix c(a);467 OMatrix c(a); 468 468 return (c -= b); 469 469 } … … 471 471 #if 0 472 472 473 Matrix operator * (const Matrix& a, constMatrix& b)473 OMatrix operator * (const OMatrix& a, const OMatrix& b) 474 474 { 475 475 if (a.nc != b.nr) THROW(sizeMismatchErr); 476 476 477 Matrix c(a.nr, b.nc);477 OMatrix c(a.nr, b.nc); 478 478 479 479 double* pc = c.data; … … 505 505 506 506 //++ 507 Matrix operator * (const Matrix& a, constMatrix& b)507 OMatrix operator * (const OMatrix& a, const OMatrix& b) 508 508 // 509 509 //-- … … 511 511 if (a.nc != b.nr) THROW(sizeMismatchErr); 512 512 513 Matrix c(a.nr, b.nc);513 OMatrix c(a.nr, b.nc); 514 514 515 515 for (int rc = 0; rc < c.nr; rc++) … … 527 527 528 528 //++ 529 MatrixMatrix::Transpose() const529 OMatrix OMatrix::Transpose() const 530 530 // 531 531 // Retourne la transposée. … … 536 536 { 537 537 #if !HAS_NAMED_RETURN 538 Matrix a(nc,nr);538 OMatrix a(nc,nr); 539 539 #endif 540 540 for (int i=0; i<nr; i++) … … 548 548 549 549 //++ 550 MatrixMatrix::Inverse() const550 OMatrix OMatrix::Inverse() const 551 551 // 552 552 // Retourne la matrice inverse. … … 559 559 { 560 560 #if !HAS_NAMED_RETURN 561 Matrix b(nc,nr);562 #endif 563 Matrix a(*this);561 OMatrix b(nc,nr); 562 #endif 563 OMatrix a(*this); 564 564 b = 1.0; 565 if (fabs( Matrix::GausPiv(a,b)) < 1.e-50) THROW(singMatxErr);565 if (fabs(OMatrix::GausPiv(a,b)) < 1.e-50) THROW(singMatxErr); 566 566 #if !HAS_NAMED_RETURN 567 567 return b; … … 570 570 571 571 572 void Matrix::WriteSelf(POutPersist& s) const572 void OMatrix::WriteSelf(POutPersist& s) const 573 573 { 574 574 ASSERT(ndata == nr*nc); … … 577 577 } 578 578 579 void Matrix::ReadSelf(PInPersist& s)579 void OMatrix::ReadSelf(PInPersist& s) 580 580 { 581 581 int_4 r,c; … … 587 587 588 588 589 MatrixRC::MatrixRC()589 OMatrixRC::OMatrixRC() 590 590 : matrix(0), data(0), index(0), step(0) 591 591 {} 592 592 593 MatrixRC::MatrixRC(Matrix& m, RCKind rckind, int ind)593 OMatrixRC::OMatrixRC(OMatrix& m, RCKind rckind, int ind) 594 594 : matrix(&m), data(Org(m,rckind,ind)), 595 595 index(ind), step(Step(m,rckind)), kind(rckind) … … 599 599 600 600 601 int MatrixRC::Next()601 int OMatrixRC::Next() 602 602 { 603 603 if (!matrix) return -1; // Failure ? … … 621 621 622 622 623 int MatrixRC::Prev()623 int OMatrixRC::Prev() 624 624 { 625 625 if (!matrix) return -1; // Failure ? … … 638 638 639 639 640 int MatrixRC::SetCol(int c)640 int OMatrixRC::SetCol(int c) 641 641 { 642 642 if (!matrix) return -1; // Failure ? … … 650 650 651 651 652 int MatrixRC::SetRow(int r)652 int OMatrixRC::SetRow(int r) 653 653 { 654 654 if (!matrix) return -1; // Failure ? … … 662 662 663 663 664 int MatrixRC::SetDiag()664 int OMatrixRC::SetDiag() 665 665 { 666 666 if (!matrix) return -1; // Failure ? … … 674 674 675 675 676 MatrixRC& MatrixRC::operator = (constMatrixRC& rc)676 OMatrixRC& OMatrixRC::operator = (const OMatrixRC& rc) 677 677 { 678 678 matrix = rc.matrix; … … 684 684 } 685 685 686 // MatrixRC::operatorVector() const687 VectorMatrixRC::GetVect() const686 //OMatrixRC::operator OVector() const 687 OVector OMatrixRC::GetVect() const 688 688 #if HAS_NAMED_RETURN 689 689 return v(NElts()) … … 691 691 { 692 692 #if !HAS_NAMED_RETURN 693 Vector v(NElts());693 OVector v(NElts()); 694 694 #endif 695 695 int n = NElts(); … … 702 702 703 703 704 MatrixRC& MatrixRC::operator += (constMatrixRC& rc)704 OMatrixRC& OMatrixRC::operator += (const OMatrixRC& rc) 705 705 { 706 706 int n = NElts(); … … 716 716 717 717 718 MatrixRC& MatrixRC::operator -= (constMatrixRC& rc)718 OMatrixRC& OMatrixRC::operator -= (const OMatrixRC& rc) 719 719 { 720 720 int n = NElts(); … … 729 729 730 730 731 MatrixRC&MatrixRC::operator *= (double x)731 OMatrixRC& OMatrixRC::operator *= (double x) 732 732 { 733 733 int n = NElts(); … … 740 740 741 741 742 MatrixRC&MatrixRC::operator /= (double x)742 OMatrixRC& OMatrixRC::operator /= (double x) 743 743 { 744 744 int n = NElts(); … … 751 751 752 752 753 MatrixRC&MatrixRC::operator -= (double x)753 OMatrixRC& OMatrixRC::operator -= (double x) 754 754 { 755 755 int n = NElts(); … … 762 762 763 763 764 MatrixRC&MatrixRC::operator += (double x)764 OMatrixRC& OMatrixRC::operator += (double x) 765 765 { 766 766 int n = NElts(); … … 774 774 775 775 776 double operator * (const MatrixRC& a, constMatrixRC& b)776 double operator * (const OMatrixRC& a, const OMatrixRC& b) 777 777 { 778 778 int n = a.NElts(); … … 786 786 787 787 788 MatrixRC& MatrixRC::LinComb(double a, double b, constMatrixRC& rc, int first)788 OMatrixRC& OMatrixRC::LinComb(double a, double b, const OMatrixRC& rc, int first) 789 789 { 790 790 int n = NElts(); … … 799 799 800 800 801 MatrixRC& MatrixRC::LinComb(double b, constMatrixRC& rc, int first)801 OMatrixRC& OMatrixRC::LinComb(double b, const OMatrixRC& rc, int first) 802 802 { 803 803 int n = NElts(); … … 813 813 814 814 815 MatrixRCMatrix::Row(int r) const815 OMatrixRC OMatrix::Row(int r) const 816 816 #if HAS_NAMED_RETURN 817 return rc(( Matrix&)*this, matrixRow, r)817 return rc((OMatrix&)*this, matrixRow, r) 818 818 #endif 819 819 { 820 820 #if !HAS_NAMED_RETURN 821 MatrixRC rc((Matrix&)*this, matrixRow, r);821 OMatrixRC rc((OMatrix&)*this, matrixRow, r); 822 822 return rc; 823 823 #endif … … 825 825 826 826 827 MatrixRCMatrix::Col(int c) const827 OMatrixRC OMatrix::Col(int c) const 828 828 #if HAS_NAMED_RETURN 829 return rc(( Matrix&)*this, matrixCol, c)829 return rc((OMatrix&)*this, matrixCol, c) 830 830 #endif 831 831 { 832 832 #if !HAS_NAMED_RETURN 833 MatrixRC rc((Matrix&)*this, matrixCol, c);833 OMatrixRC rc((OMatrix&)*this, matrixCol, c); 834 834 return rc; 835 835 #endif … … 837 837 838 838 839 MatrixRCMatrix::Diag() const839 OMatrixRC OMatrix::Diag() const 840 840 #if HAS_NAMED_RETURN 841 return rc(( Matrix&)*this, matrixDiag)841 return rc((OMatrix&)*this, matrixDiag) 842 842 #endif 843 843 { 844 844 #if !HAS_NAMED_RETURN 845 MatrixRC rc((Matrix&)*this, matrixDiag);845 OMatrixRC rc((OMatrix&)*this, matrixDiag); 846 846 return rc; 847 847 #endif … … 849 849 850 850 851 int MatrixRC::IMaxAbs(int first)851 int OMatrixRC::IMaxAbs(int first) 852 852 { 853 853 int n=NElts(); … … 865 865 866 866 867 void MatrixRC::Swap(MatrixRC& rc1,MatrixRC& rc2)867 void OMatrixRC::Swap(OMatrixRC& rc1, OMatrixRC& rc2) 868 868 { 869 869 int n=rc1.NElts(); … … 877 877 878 878 879 double Matrix::GausPiv(Matrix& a,Matrix& b)879 double OMatrix::GausPiv(OMatrix& a, OMatrix& b) 880 880 { 881 881 int n = a.NRows(); … … 902 902 double ld = a.NRows() * log(nrm); 903 903 if (ld <= LN_MINDOUBLE || ld >= LN_MAXDOUBLE) { 904 // cerr << " Matrix warning, overflow for det" << endl;904 // cerr << "OMatrix warning, overflow for det" << endl; 905 905 } else { 906 906 det = exp(ld); … … 908 908 } 909 909 910 MatrixRC pivRowa(a,matrixRow);911 MatrixRC pivRowb(b,matrixRow);910 OMatrixRC pivRowa(a,matrixRow); 911 OMatrixRC pivRowb(b,matrixRow); 912 912 913 913 for (int k=0; k<n-1; k++) { 914 914 int iPiv = a.Col(k).IMaxAbs(k); 915 915 if (iPiv != k) { 916 MatrixRC aIPiv(a.Row(iPiv));917 MatrixRC aK(a.Row(k));918 MatrixRC::Swap(aIPiv,aK);919 MatrixRC bIPiv(b.Row(iPiv));920 MatrixRC bK(b.Row(k));921 MatrixRC::Swap(bIPiv,bK);916 OMatrixRC aIPiv(a.Row(iPiv)); 917 OMatrixRC aK(a.Row(k)); 918 OMatrixRC::Swap(aIPiv,aK); 919 OMatrixRC bIPiv(b.Row(iPiv)); 920 OMatrixRC bK(b.Row(k)); 921 OMatrixRC::Swap(bIPiv,bK); 922 922 } 923 923 double pivot = a(k,k); … … 958 958 959 959 //++ 960 double Matrix::Norm1()960 double OMatrix::Norm1() 961 961 // 962 962 // Norme 1 : somme des valeurs absolues. … … 970 970 971 971 //++ 972 double Matrix::Norm2()972 double OMatrix::Norm2() 973 973 // 974 974 // Norme 2, euclidienne. … … 983 983 ////////////////////////////////////////////////////////// 984 984 //++ 985 MatrixMatrix::FitResidus(GeneralFit& gfit985 OMatrix OMatrix::FitResidus(GeneralFit& gfit 986 986 ,double xorg,double yorg,double dx,double dy) 987 987 // … … 992 992 { 993 993 if(NCol()<=0||NRows()<=0) 994 throw(SzMismatchError(" Matrix::FitResidus: size mismatch\n"));994 throw(SzMismatchError("OMatrix::FitResidus: size mismatch\n")); 995 995 GeneralFunction* f = gfit.GetFunction(); 996 996 if(f==NULL) 997 throw(NullPtrError(" Matrix::FitResidus: NULL pointer\n"));998 Vector par = gfit.GetParm();999 Matrix m(*this);997 throw(NullPtrError("OMatrix::FitResidus: NULL pointer\n")); 998 OVector par = gfit.GetParm(); 999 OMatrix m(*this); 1000 1000 for(int i=0;i<NRows();i++) for(int j=0;j<NCol();j++) { 1001 1001 double x[2] = {xorg+j*dx,yorg+i*dy}; … … 1006 1006 1007 1007 //++ 1008 MatrixMatrix::FitFunction(GeneralFit& gfit1008 OMatrix OMatrix::FitFunction(GeneralFit& gfit 1009 1009 ,double xorg,double yorg,double dx,double dy) 1010 1010 // … … 1015 1015 { 1016 1016 if(NCol()<=0||NRows()<=0) 1017 throw(SzMismatchError(" Matrix::FitFunction: size mismatch\n"));1017 throw(SzMismatchError("OMatrix::FitFunction: size mismatch\n")); 1018 1018 GeneralFunction* f = gfit.GetFunction(); 1019 1019 if(f==NULL) 1020 throw(NullPtrError(" Matrix::FitFunction: NULL pointer\n"));1021 Vector par = gfit.GetParm();1022 Matrix m(*this);1020 throw(NullPtrError("OMatrix::FitFunction: NULL pointer\n")); 1021 OVector par = gfit.GetParm(); 1022 OMatrix m(*this); 1023 1023 for(int i=0;i<NRows();i++) for(int j=0;j<NCol();j++) { 1024 1024 double x[2] = {xorg+j*dx,yorg+i*dy}; -
trunk/SophyaLib/NTools/matrix.h
r494 r508 18 18 // <summary> Operations matricielles </summary> 19 19 // Operations matricielles, algebre lineaire... 20 class Matrix : public PPersist, public AnyDataObj {21 friend class Vector;22 friend class MatrixRC;20 class OMatrix : public PPersist, public AnyDataObj { 21 friend class OVector; 22 friend class OMatrixRC; 23 23 friend class TMatrix<r_8>; 24 24 public: 25 Matrix();25 OMatrix(); 26 26 // Constructeur, matrice a zero 27 Matrix(int r, int c);27 OMatrix(int r, int c); 28 28 // Constructeur avec des valeurs. Pas d'allocation, juste pointe. 29 Matrix(int r, int c, double* values);29 OMatrix(int r, int c, double* values); 30 30 // Constructeur par copie 31 Matrix(constMatrix& a);31 OMatrix(const OMatrix& a); 32 32 // Constructeur par copie a partir d'une TMatrix<r_8> 33 Matrix(const TMatrix<r_8>& a);33 OMatrix(const TMatrix<r_8>& a); 34 34 // Destructeur 35 virtual ~ Matrix();35 virtual ~OMatrix(); 36 36 37 37 // Construction automatique pour PPF … … 39 39 enum {classId = ClassId_Matrix}; 40 40 int_4 ClassId() const { return classId; } 41 static PPersist* Create() {return new Matrix(1,1);}41 static PPersist* Create() {return new OMatrix(1,1);} 42 42 // </group> 43 43 … … 49 49 50 50 // Operateur d'affectation 51 Matrix& operator = (constMatrix& a);51 OMatrix& operator = (const OMatrix& a); 52 52 // Affectation depuis scalaire : identite * scalaire 53 Matrix& operator = (double x);53 OMatrix& operator = (double x); 54 54 55 55 // Impression 56 friend ostream& operator << (ostream& s, const Matrix& a);56 friend ostream& operator << (ostream& s, const OMatrix& a); 57 57 58 58 // Acces aux elements … … 74 74 // Operations matricielles avec scalaire, allocation d'une nouvelle matrice 75 75 // <group> 76 friend Matrix operator * (constMatrix& a, double b);77 friend Matrix operator * (double b, constMatrix& a);78 friend Matrix operator + (constMatrix& a, double b);79 friend Matrix operator + (double b, constMatrix& a);80 friend Matrix operator - (constMatrix& a, double b);81 friend Matrix operator - (double b, constMatrix& a);82 friend Matrix operator / (constMatrix& a, double b);76 friend OMatrix operator * (const OMatrix& a, double b); 77 friend OMatrix operator * (double b, const OMatrix& a); 78 friend OMatrix operator + (const OMatrix& a, double b); 79 friend OMatrix operator + (double b, const OMatrix& a); 80 friend OMatrix operator - (const OMatrix& a, double b); 81 friend OMatrix operator - (double b, const OMatrix& a); 82 friend OMatrix operator / (const OMatrix& a, double b); 83 83 // </group> 84 84 85 85 // Operations matricielles avec scalaires entiers, pour eviter l'appel 86 86 // du constructeur de vecteur a partir d'un entier... 87 // sinon v*2 = v * Vector(2), BUG !88 // <group> 89 friend Matrix operator * (constMatrix& a, int b);90 friend Matrix operator * (int b, constMatrix& a);91 friend Matrix operator + (constMatrix& a, int b);92 friend Matrix operator + (int b, constMatrix& a);93 friend Matrix operator - (constMatrix& a, int b);94 friend Matrix operator - (int b, constMatrix& a);95 friend Matrix operator / (constMatrix& a, int b);87 // sinon v*2 = v * OVector(2), BUG ! 88 // <group> 89 friend OMatrix operator * (const OMatrix& a, int b); 90 friend OMatrix operator * (int b, const OMatrix& a); 91 friend OMatrix operator + (const OMatrix& a, int b); 92 friend OMatrix operator + (int b, const OMatrix& a); 93 friend OMatrix operator - (const OMatrix& a, int b); 94 friend OMatrix operator - (int b, const OMatrix& a); 95 friend OMatrix operator / (const OMatrix& a, int b); 96 96 // </group> 97 97 98 98 // Operations matricielles "en place", avec scalaire 99 99 // <group> 100 Matrix& operator *= (double b);101 Matrix& operator += (double b);102 Matrix& operator -= (double b);103 Matrix& operator /= (double b);100 OMatrix& operator *= (double b); 101 OMatrix& operator += (double b); 102 OMatrix& operator -= (double b); 103 OMatrix& operator /= (double b); 104 104 // </group> 105 105 106 106 // Operations matricielles 107 107 // <group> 108 friend Matrix operator * (const Matrix& a, constMatrix& b);109 friend Matrix operator + (const Matrix& a, constMatrix& b);110 friend Matrix operator - (const Matrix& a, constMatrix& b);111 112 Matrix& operator *= (constMatrix& a);113 Matrix& operator += (constMatrix& b);114 Matrix& operator -= (constMatrix& b);108 friend OMatrix operator * (const OMatrix& a, const OMatrix& b); 109 friend OMatrix operator + (const OMatrix& a, const OMatrix& b); 110 friend OMatrix operator - (const OMatrix& a, const OMatrix& b); 111 112 OMatrix& operator *= (const OMatrix& a); 113 OMatrix& operator += (const OMatrix& b); 114 OMatrix& operator -= (const OMatrix& b); 115 115 // </group> 116 116 117 117 // Matrice transposee 118 Matrix Transpose() const;118 OMatrix Transpose() const; 119 119 // Matrice inverse 120 120 // <thrown> singMatxErr </thrown> 121 Matrix Inverse() const;121 OMatrix Inverse() const; 122 122 123 123 // Nombre de lignes … … 134 134 // Acces aux rangees et colonnes 135 135 // <group> 136 MatrixRC Row(int r) const;137 MatrixRC Col(int c) const;138 MatrixRC Diag() const;139 // </group> 140 /* Versions const ? Alors il faut constructeur const pour MatrixRC, */141 /* mais MatrixRC contient unMatrix* qui detruit const.... */136 OMatrixRC Row(int r) const; 137 OMatrixRC Col(int c) const; 138 OMatrixRC Diag() const; 139 // </group> 140 /* Versions const ? Alors il faut constructeur const pour OMatrixRC, */ 141 /* mais OMatrixRC contient un OMatrix* qui detruit const.... */ 142 142 /* mais en eux-meme, ils ne modifient pas la matrice. Ils permettent */ 143 143 /* de le faire... */ … … 145 145 // Pivot de Gauss : diagonalise la matrice A, en effectuant les memes 146 146 // operations sur la matrice B 147 static double GausPiv( Matrix& A,Matrix& B);147 static double GausPiv(OMatrix& A, OMatrix& B); 148 148 149 149 // Residus et fonction fittees. 150 Matrix FitResidus(GeneralFit& gfit150 OMatrix FitResidus(GeneralFit& gfit 151 151 ,double xorg=0.,double yorg=0.,double dx=1.,double dy=1.); 152 Matrix FitFunction(GeneralFit& gfit152 OMatrix FitFunction(GeneralFit& gfit 153 153 ,double xorg=0.,double yorg=0.,double dx=1.,double dy=1.); 154 154 … … 163 163 164 164 165 inline r_8& Matrix::operator()(int r, int c)165 inline r_8& OMatrix::operator()(int r, int c) 166 166 { 167 167 #ifdef RGCHECK … … 172 172 173 173 174 inline r_8 const& Matrix::operator()(int r, int c) const174 inline r_8 const& OMatrix::operator()(int r, int c) const 175 175 { 176 176 #ifdef RGCHECK … … 186 186 // Permet d'acceder a une ligne ou colonne d'une matrice, en place, comme 187 187 // avec un vecteur. 188 class MatrixRC EXC_AWARE {189 friend class Vector;190 friend class Matrix;188 class OMatrixRC EXC_AWARE { 189 friend class OVector; 190 friend class OMatrix; 191 191 public: 192 MatrixRC();193 194 virtual ~ MatrixRC() {}192 OMatrixRC(); 193 194 virtual ~OMatrixRC() {} 195 195 196 196 int Next(); … … 200 200 int SetDiag(); 201 201 202 static int Step(const Matrix& m, RCKind rckind);203 static double* Org(const Matrix&, RCKind rckind, int ind=0);202 static int Step(const OMatrix& m, RCKind rckind); 203 static double* Org(const OMatrix&, RCKind rckind, int ind=0); 204 204 205 205 int NElts() const; … … 207 207 r_8 operator()(int i) const; 208 208 209 MatrixRC& operator = (constMatrixRC& rc);210 //operator Vector() const;211 Vector GetVect() const;212 213 MatrixRC& operator += (constMatrixRC& rc);214 MatrixRC& operator -= (constMatrixRC& rc);215 216 MatrixRC& operator *= (double x);217 MatrixRC& operator /= (double x);218 MatrixRC& operator -= (double x);219 MatrixRC& operator += (double x);220 221 friend double operator * (const MatrixRC& a, constMatrixRC& b);222 223 MatrixRC& LinComb(double a, double b, constMatrixRC& rc, int first=0);224 MatrixRC& LinComb(double b, constMatrixRC& rc, int first=0);209 OMatrixRC& operator = (const OMatrixRC& rc); 210 //operator OVector() const; 211 OVector GetVect() const; 212 213 OMatrixRC& operator += (const OMatrixRC& rc); 214 OMatrixRC& operator -= (const OMatrixRC& rc); 215 216 OMatrixRC& operator *= (double x); 217 OMatrixRC& operator /= (double x); 218 OMatrixRC& operator -= (double x); 219 OMatrixRC& operator += (double x); 220 221 friend double operator * (const OMatrixRC& a, const OMatrixRC& b); 222 223 OMatrixRC& LinComb(double a, double b, const OMatrixRC& rc, int first=0); 224 OMatrixRC& LinComb(double b, const OMatrixRC& rc, int first=0); 225 225 226 226 int IMaxAbs(int first=0); 227 227 228 static void Swap( MatrixRC& rc1,MatrixRC& rc2);229 // comme c'est symetrique, soit c'est static MatrixRC, soit staticMatrix,230 // soit Matrix avec verification qu'on parle bien de la meme...228 static void Swap(OMatrixRC& rc1, OMatrixRC& rc2); 229 // comme c'est symetrique, soit c'est static OMatrixRC, soit static OMatrix, 230 // soit OMatrix avec verification qu'on parle bien de la meme... 231 231 232 232 protected: 233 MatrixRC(Matrix& m, RCKind kind, int index=0);234 Matrix* matrix;233 OMatrixRC(OMatrix& m, RCKind kind, int index=0); 234 OMatrix* matrix; 235 235 r_8* data; 236 236 int index; … … 240 240 241 241 242 inline int MatrixRC::Step(constMatrix& m, RCKind rckind)242 inline int OMatrixRC::Step(const OMatrix& m, RCKind rckind) 243 243 { 244 244 switch (rckind) … … 255 255 256 256 257 inline double* MatrixRC::Org(constMatrix& m, RCKind rckind, int index)257 inline double* OMatrixRC::Org(const OMatrix& m, RCKind rckind, int index) 258 258 { 259 259 switch (rckind) … … 270 270 271 271 272 inline int MatrixRC::NElts() const272 inline int OMatrixRC::NElts() const 273 273 { 274 274 if (!matrix) return -1; // Failure ? … … 287 287 288 288 289 inline double& MatrixRC::operator()(int i)289 inline double& OMatrixRC::operator()(int i) 290 290 { 291 291 return data[i*step]; … … 293 293 294 294 295 inline double MatrixRC::operator()(int i) const295 inline double OMatrixRC::operator()(int i) const 296 296 { 297 297 return data[i*step]; -
trunk/SophyaLib/NTools/outilsinit.cc
r490 r508 32 32 // Enregistrement des classes PPersist du modules Outils++ 33 33 34 PPRegister( Matrix);35 PPRegister( Vector);34 PPRegister(OMatrix); 35 PPRegister(OVector); 36 36 PPRegister(Poly); 37 37 PPRegister(Poly2); … … 73 73 PPRegister(ImageR4); 74 74 75 //PPersistMgr::RegisterClass( Matrix::classId,Matrix::Create);75 //PPersistMgr::RegisterClass(OMatrix::classId, OMatrix::Create); 76 76 77 77 int pnice; -
trunk/SophyaLib/NTools/pclassids.h
r490 r508 20 20 ClassId_DVList = 0x0105, 21 21 22 ClassId_P MatrixF = 0x0110,23 ClassId_P MatrixD = 0x0111,24 ClassId_P VectorF = 0x0112,25 ClassId_P VectorD = 0x0113,22 ClassId_POMatrixF = 0x0110, 23 ClassId_POMatrixD = 0x0111, 24 ClassId_POVectorF = 0x0112, 25 ClassId_POVectorD = 0x0113, 26 26 27 27 ClassId_Histo1D = 0x0201, -
trunk/SophyaLib/NTools/poly.cc
r490 r508 13 13 //++ 14 14 // Links Parents 15 // Vector15 // OVector 16 16 //-- 17 17 … … 29 29 30 30 Poly::Poly(int degre) 31 : Vector(degre+1), dirty(0), deg(0)31 : OVector(degre+1), dirty(0), deg(0) 32 32 { 33 33 END_CONSTRUCTOR … … 99 99 100 100 //++ 101 int Poly::Roots( Vector& roots) const101 int Poly::Roots(OVector& roots) const 102 102 // 103 103 // Retourne dans roots les racines réelles, si on sait … … 167 167 { 168 168 if (this == &a) return *this; 169 Vector::operator=(a);169 OVector::operator=(a); 170 170 171 171 UpdateDeg(); … … 324 324 #endif 325 325 326 Vector::ReadSelf(s);326 OVector::ReadSelf(s); 327 327 328 328 #ifdef DEBUG … … 341 341 ((Poly*)(this))->Realloc(deg, true); 342 342 s << deg; 343 Vector::WriteSelf(s);343 OVector::WriteSelf(s); 344 344 } 345 345 … … 375 375 376 376 //++ 377 double Poly::Fit( Vector const& x,Vector const& y, int degre)377 double Poly::Fit(OVector const& x, OVector const& y, int degre) 378 378 // 379 379 // Ajustement polynomial par moindre carrés. Un polynôme de … … 387 387 Realloc(degre); 388 388 389 Matrix a(degre+1, n);389 OMatrix a(degre+1, n); 390 390 391 391 for (int c=0; c<n; c++) { … … 397 397 } 398 398 399 double rc = LinFit(a,y,( Vector&)*this);399 double rc = LinFit(a,y,(OVector&)*this); 400 400 UpdateDeg(); 401 401 return rc; … … 403 403 404 404 //++ 405 double Poly::Fit( Vector const& x, Vector const& y,Vector const& erry2, int degre,406 Vector& errCoef)405 double Poly::Fit(OVector const& x, OVector const& y, OVector const& erry2, int degre, 406 OVector& errCoef) 407 407 // 408 408 // Ajustement polynomial par moindre carrés. Un polynôme de … … 419 419 errCoef.Realloc(degre+1); 420 420 421 Matrix a(degre+1, n);421 OMatrix a(degre+1, n); 422 422 423 423 for (int c=0; c<n; c++) { … … 429 429 } 430 430 431 double rc = LinFit(a,y,erry2,( Vector&)*this,errCoef);431 double rc = LinFit(a,y,erry2,(OVector&)*this,errCoef); 432 432 UpdateDeg(); 433 433 return rc; … … 482 482 //++ 483 483 // Links Parents 484 // Vector484 // OVector 485 485 //-- 486 486 … … 494 494 // Crée un polynôme de degrés partiels degreX et degreY. 495 495 //-- 496 : Vector((degreX+1)*(degreY+1)), dirty(0),496 :OVector((degreX+1)*(degreY+1)), dirty(0), 497 497 maxDegX(degreX), maxDegY(degreY), degX(0), degY(0), deg(0) 498 498 { … … 506 506 // de deux polynômes à une variable, p2(x,y)=px(x)py(y) 507 507 //-- 508 : Vector((polX.Degre()+1)*(polY.Degre()+1)), dirty(0),508 :OVector((polX.Degre()+1)*(polY.Degre()+1)), dirty(0), 509 509 maxDegX(polX.Degre()), maxDegY(polY.Degre()), 510 510 degX(polX.Degre()), degY(polY.Degre()), deg(degX+degY) … … 521 521 // Constructeur par copie. 522 522 //-- 523 : Vector(a), dirty(a.dirty),523 :OVector(a), dirty(a.dirty), 524 524 maxDegX(a.maxDegX), maxDegY(a.maxDegY), 525 525 degX(a.degX), degY(a.degY), deg(a.deg) … … 561 561 UpdateDegIfDirty(); 562 562 Poly2 tmp(*this); 563 Vector::Realloc((degreX+1)*(degreY+1));563 OVector::Realloc((degreX+1)*(degreY+1)); 564 564 Zero(); 565 565 maxDegX = degreX; … … 631 631 632 632 //++ 633 double Poly2::Fit( Vector const& x, Vector const& y,Vector const& z,633 double Poly2::Fit(OVector const& x, OVector const& y, OVector const& z, 634 634 int degreX, int degreY) 635 635 // … … 643 643 Realloc(degreX, degreY); 644 644 645 Matrix a((degreX+1)*(degreY+1), n);645 OMatrix a((degreX+1)*(degreY+1), n); 646 646 647 647 for (int c=0; c<n; c++) { … … 657 657 } 658 658 659 double rc = LinFit(a,z,( Vector&)*this);659 double rc = LinFit(a,z,(OVector&)*this); 660 660 UpdateDeg(); 661 661 return rc; … … 664 664 665 665 //++ 666 double Poly2::Fit( Vector const& x, Vector const& y,Vector const& z,667 Vector const& errz2, int degreX, int degreY,668 Vector& errCoef)666 double Poly2::Fit(OVector const& x, OVector const& y, OVector const& z, 667 OVector const& errz2, int degreX, int degreY, 668 OVector& errCoef) 669 669 // 670 670 // Ajustement par moindre carrés z = P(x,y), degrés partiels imposés, … … 680 680 errCoef.Realloc((degreX+1)*(degreY+1)); 681 681 682 Matrix a((degreX+1)*(degreY+1), n);682 OMatrix a((degreX+1)*(degreY+1), n); 683 683 684 684 for (int c=0; c<n; c++) { … … 694 694 } 695 695 696 double rc = LinFit(a,z,errz2,( Vector&)*this,errCoef);696 double rc = LinFit(a,z,errz2,(OVector&)*this,errCoef); 697 697 UpdateDeg(); 698 698 return rc; … … 700 700 701 701 //++ 702 double Poly2::Fit( Vector const& x, Vector const& y,Vector const& z,702 double Poly2::Fit(OVector const& x, OVector const& y, OVector const& z, 703 703 int degre) 704 704 // … … 712 712 Realloc(degre, degre); // certains vaudront 0, impose. 713 713 714 Matrix a((degre+1)*(degre+2)/2, n);715 Vector cf((degre+1)*(degre+2)/2);714 OMatrix a((degre+1)*(degre+2)/2, n); 715 OVector cf((degre+1)*(degre+2)/2); 716 716 #define C_INDEX(i,j) ((i) + (j)*(2*degre+3-(j))/2) 717 717 … … 744 744 745 745 //++ 746 double Poly2::Fit( Vector const& x, Vector const& y,Vector const& z,747 Vector const& errz2, int degre,748 Vector& errCoef)746 double Poly2::Fit(OVector const& x, OVector const& y, OVector const& z, 747 OVector const& errz2, int degre, 748 OVector& errCoef) 749 749 // 750 750 // Ajustement par moindre carrés z = P(x,y), degré total imposé, … … 761 761 #define C_INDEX(i,j) ((i) + (j)*(2*degre+3-(j))/2) 762 762 763 Matrix a((degre+1)*(degre+2)/2, n);764 Vector cf((degre+1)*(degre+2)/2);765 Vector ecf((degre+1)*(degre+2)/2);763 OMatrix a((degre+1)*(degre+2)/2, n); 764 OVector cf((degre+1)*(degre+2)/2); 765 OVector ecf((degre+1)*(degre+2)/2); 766 766 767 767 for (int c=0; c<n; c++) { … … 806 806 #endif 807 807 808 Vector::ReadSelf(s);808 OVector::ReadSelf(s); 809 809 810 810 #ifdef DEBUG … … 817 817 { 818 818 s << maxDegX << maxDegY; 819 Vector::WriteSelf(s);819 OVector::WriteSelf(s); 820 820 } 821 821 -
trunk/SophyaLib/NTools/poly.h
r220 r508 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: poly.h,v 1. 1.1.1 1999-04-09 17:57:58ansari Exp $3 // $Id: poly.h,v 1.2 1999-10-25 10:36:11 ansari Exp $ 4 4 // 5 5 … … 16 16 class Poly2; 17 17 18 class Poly : public Vector {18 class Poly : public OVector { 19 19 public: 20 20 Poly(int degre = 0); … … 26 26 inline int Degre() const {UpdateDegIfDirty(); return deg;} 27 27 28 inline void Realloc(int n, bool force=false) { Vector::Realloc(n+1,force);}28 inline void Realloc(int n, bool force=false) {OVector::Realloc(n+1,force);} 29 29 30 30 inline double operator[](int i) const {return data[i];} … … 41 41 // Derive le polynome dans un autre 42 42 43 int Roots( Vector& roots) const;43 int Roots(OVector& roots) const; 44 44 // retourne les racines si on peut les calculer... 45 45 … … 72 72 friend ostream& operator << (ostream& s, const Poly& a); 73 73 74 double Fit( Vector const& x,Vector const& y, int degre);74 double Fit(OVector const& x, OVector const& y, int degre); 75 75 // Fit d'un polynome de degre donne sur les x et y. 76 76 77 double Fit( Vector const& x, Vector const& y,Vector const& erry2, int degre,78 Vector& errCoef);77 double Fit(OVector const& x, OVector const& y, OVector const& erry2, int degre, 78 OVector& errCoef); 79 79 // En plus, on fournit les carres des erreurs sur y et on a les erreurs 80 80 // sur les coefficients dans un vecteur. … … 90 90 91 91 92 class Poly2 : public Vector { // Ca pourrait etre une matrice mais92 class Poly2 : public OVector { // Ca pourrait etre une matrice mais 93 93 // la encore, un vecteur est utile pour les 94 94 // fits. … … 131 131 // retourne le coefficient de degre (dx,dy) 132 132 133 double Fit( Vector const& x, Vector const& y,Vector const& z,133 double Fit(OVector const& x, OVector const& y, OVector const& z, 134 134 int degreX, int degreY); 135 double Fit( Vector const& x, Vector const& y,Vector const& z,136 Vector const& errz2, int degreX, int degreY,137 Vector& errCoef);135 double Fit(OVector const& x, OVector const& y, OVector const& z, 136 OVector const& errz2, int degreX, int degreY, 137 OVector& errCoef); 138 138 // degres partiels imposes. cf Poly::Fit sinon 139 139 140 140 141 double Fit( Vector const& x, Vector const& y,Vector const& z,141 double Fit(OVector const& x, OVector const& y, OVector const& z, 142 142 int degre); 143 double Fit( Vector const& x, Vector const& y,Vector const& z,144 Vector const& errz2, int degre,145 Vector& errCoef);143 double Fit(OVector const& x, OVector const& y, OVector const& z, 144 OVector const& errz2, int degre, 145 OVector& errCoef); 146 146 // degre total impose. cf Poly::Fit sinon 147 147 -
trunk/SophyaLib/NTools/rk4cdifeq.cc
r244 r508 74 74 //++ 75 75 RK4CDiffEq& 76 RK4CDiffEq::AbsAccuracy( Vector const& vScal)76 RK4CDiffEq::AbsAccuracy(OVector const& vScal) 77 77 // 78 78 // On souhaite une précision absolue, et le vecteur vScal contient … … 118 118 119 119 void 120 RK4CDiffEq::RKCStep( Vector& newY, Vector const& y0,Vector const& yScale,120 RK4CDiffEq::RKCStep(OVector& newY, OVector const& y0, OVector const& yScale, 121 121 double dttry, double& dtdone, double& dtnext) 122 122 { … … 155 155 156 156 void 157 RK4CDiffEq::SolveArr( Matrix& y, double* t, double tf, int n)157 RK4CDiffEq::SolveArr(OMatrix& y, double* t, double tf, int n) 158 158 { 159 159 //TIMEF; … … 162 162 double dxres = (tf - mXStart)/n; 163 163 164 Vector yt = mYStart;164 OVector yt = mYStart; 165 165 166 166 k1.Realloc(mFunc->NFuncReal()); -
trunk/SophyaLib/NTools/rk4cdifeq.h
r220 r508 20 20 // <group> 21 21 RK4CDiffEq& Accuracy(double); 22 RK4CDiffEq& AbsAccuracy( Vector const& vScal);22 RK4CDiffEq& AbsAccuracy(OVector const& vScal); 23 23 RK4CDiffEq& AbsAccuracy(double scal); 24 24 RK4CDiffEq& RelAccuracy(); … … 26 26 27 27 // Implementation RK4 adaptatif 28 virtual void SolveArr( Matrix& y, double* t, double tf, int n);28 virtual void SolveArr(OMatrix& y, double* t, double tf, int n); 29 29 30 30 protected: 31 31 // Un pas adaptatif 32 void RKCStep( Vector& newY, Vector const& y0,Vector const& yScale,32 void RKCStep(OVector& newY, OVector const& y0, OVector const& yScale, 33 33 double dttry, double& dtdone, double& dtnext); 34 34 35 35 double eps; 36 36 bool relAccuracy; 37 Vector accScale;38 Vector yTemp; // Pour ne pas reallouer39 Vector ySave;37 OVector accScale; 38 OVector yTemp; // Pour ne pas reallouer 39 OVector ySave; 40 40 }; 41 41 -
trunk/SophyaLib/NTools/rzimage.cc
r278 r508 5 5 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 6 6 7 // $Id: rzimage.cc,v 1. 4 1999-04-28 13:36:50ansari Exp $7 // $Id: rzimage.cc,v 1.5 1999-10-25 10:36:12 ansari Exp $ 8 8 9 9 #include "machdefs.h" … … 765 765 GeneralFunction* f = gfit.GetFunction(); 766 766 if(f==NULL) return NULL; 767 Vector par = gfit.GetParm();767 OVector par = gfit.GetParm(); 768 768 RzImage* img = new RzImage(DataType((r_4)0.),XSize(),YSize()); 769 769 img->SetOrg(XOrg(),YOrg()); … … 790 790 GeneralFunction* f = gfit.GetFunction(); 791 791 if(f==NULL) return NULL; 792 Vector par = gfit.GetParm();792 OVector par = gfit.GetParm(); 793 793 RzImage* img = new RzImage(DataType((r_4)0.),XSize(),YSize()); 794 794 img->SetOrg(XOrg(),YOrg()); -
trunk/SophyaLib/NTools/tmatrix.cc
r501 r508 1 // $Id: tmatrix.cc,v 1.1 0 1999-10-23 10:21:23ansari Exp $1 // $Id: tmatrix.cc,v 1.11 1999-10-25 10:36:12 ansari Exp $ 2 2 // C.Magneville 04/99 3 3 #include "machdefs.h" … … 284 284 TMatrix<r_8> b(mNc,mNr); TMatrix<r_8> a(*this); b = 1.; 285 285 if(fabs(TMatrix<r_8>::GausPiv(a,b)) < 1.e-50) 286 throw(MathExc("TMatrix Inverse() Singular Matrix"));286 throw(MathExc("TMatrix Inverse() Singular OMatrix")); 287 287 return b; 288 288 } -
trunk/SophyaLib/NTools/tmatrix.h
r502 r508 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // C.Magneville 04/99 3 #ifndef TM ATRIX_SEEN4 #define TM ATRIX_SEEN3 #ifndef TMatrix_SEEN 4 #define TMatrix_SEEN 5 5 6 6 #include "machdefs.h" … … 179 179 180 180 //////////////////////////////////////////////////////////////// 181 // Typedef pour simplifier 182 //typedef TMatrix<r_8> Matrix;181 // Typedef pour simplifier et compatibilite Peida 182 typedef TMatrix<r_8> Matrix; 183 183 184 184 ///////////////////////////////////////////////////////////////////////// … … 314 314 inline T TMatrixRC<T>::operator()(uint_4 i) const {return data[i*step];} 315 315 316 //////////////////////////////////////////////////////////////// 317 // Typedef pour simplifier et compatibilite Peida 318 typedef TMatrixRC<r_8> MatrixRC; 319 316 320 } // Fin du namespace 317 321 -
trunk/SophyaLib/NTools/tvector.h
r502 r508 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // C.Magneville 05/99 3 #ifndef TV ECTOR_SEEN4 #define TV ECTOR_SEEN3 #ifndef TVector_SEEN 4 #define TVector_SEEN 5 5 6 6 #include "tmatrix.h" … … 76 76 } 77 77 78 // Typedef pour simplifier 79 //typedef TVector<r_8> Vector;78 // Typedef pour simplifier et compatibilite Peida 79 typedef TVector<r_8> Vector; 80 80 81 81 ///////////////////////////////////////////////////////////////////////// -
trunk/SophyaLib/Samba/anagen.cc
r468 r508 37 37 double phi0; 38 38 float theta; 39 Vector phin, datan, phis, datas;39 OVector phin, datan, phis, datas; 40 40 map.GetThetaSlice(map.NbThetaSlices()-ith-1,theta,phis,datas); 41 41 map.GetThetaSlice(ith,theta,phin,datan); … … 77 77 78 78 79 void comp_phas2gen(int nsmax,int nlmax,int nmmax, Vector datain,79 void comp_phas2gen(int nsmax,int nlmax,int nmmax, OVector datain, 80 80 int nph,vector< complex<double> >& dataout,double phi0){ 81 81 /*======================================================================= … … 92 92 //FFTVector outf=FFTServer::solve(inf,-1); 93 93 FFTServer fft; 94 Vector outf;94 OVector outf; 95 95 //cout<<"in :"<<datain<<endl; 96 96 fft.fftb(datain,outf); -
trunk/SophyaLib/Samba/anagen.h
r468 r508 10 10 vector< vector< complex<double> > >& alm, double cos_theta_cut); 11 11 12 void comp_phas2gen(int nsmax,int nlmax,int nmmax, Vector datain,12 void comp_phas2gen(int nsmax,int nlmax,int nmmax, OVector datain, 13 13 int nph,vector< complex<double> >& dataout,double phi0); 14 14 -
trunk/SophyaLib/Samba/syngen.cc
r468 r508 43 43 double phi0; 44 44 float theta,thetas; 45 Vector phin, datan,phis,datas;45 OVector phin, datan,phis,datas; 46 46 map.GetThetaSlice(map.NbThetaSlices()-ith-1,thetas,phis,datas); 47 47 map.GetThetaSlice(ith,theta,phin,datan); … … 104 104 void syn_phasgen(const int nsmax,const int nlmax,const int nmmax, 105 105 const vector< complex<long double> >& datain, 106 int nph, Vector& dataout, double phi0,106 int nph, OVector& dataout, double phi0, 107 107 vector< complex<long double> >& bw){ 108 108 -
trunk/SophyaLib/Samba/syngen.h
r468 r508 18 18 void syn_phasgen(const int nsmax,const int nlmax,const int nmmax, 19 19 const vector< complex<long double> >& datain, 20 int nph, Vector& dataout, double phi0,20 int nph, OVector& dataout, double phi0, 21 21 vector< complex<long double> >& bw); 22 22 -
trunk/SophyaLib/Samba/utilgeom.cc
r272 r508 95 95 } 96 96 97 // Matrix vecTxMat(const Vector& v, constMatrix& M) {97 //OMatrix vecTxMat(const OVector& v, const OMatrix& M) { 98 98
Note:
See TracChangeset
for help on using the changeset viewer.