Changeset 850 in Sophya for trunk/SophyaLib/TArray
- Timestamp:
- Apr 10, 2000, 2:57:45 PM (25 years ago)
- Location:
- trunk/SophyaLib/TArray
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/basarr.cc
r813 r850 308 308 void BaseArray::Show(ostream& os, bool si) const 309 309 { 310 if (ndim_ < 1) { 311 os << "\n--- " << BaseArray::InfoString() << " Unallocated Array ! " << endl; 312 return; 313 } 310 314 os << "\n--- " << InfoString() ; 311 315 os << " ND=" << ndim_ << " SizeX*Y*...= " ; -
trunk/SophyaLib/TArray/sopemtx.h
r804 r850 39 39 } 40 40 41 inline r_4 LinSolve(const TMatrix<r_4>& a, const TVector<r_4>& b, TVector<r_4>& c) 42 { 43 if(a.NCols() != b.NRows() || a.NCols() != a.NRows()) 44 throw(SzMismatchError("LinSolve(TMatrix<r_4>,TVector<r_4>) size mismatch")); 45 c = b; 46 TMatrix<r_4> a1(a); 47 return SimpleMatrixOperation<r_4>::GausPiv(a1,c); 48 } 49 50 // Inverse d'une matrice 51 inline TMatrix<r_8> Inverse(TMatrix<r_8> const & A) 52 { 53 return SimpleMatrixOperation<r_8>::Inverse(A); 54 } 55 56 inline TMatrix<r_4> Inverse(TMatrix<r_4> const & A) 57 { 58 return SimpleMatrixOperation<r_4>::Inverse(A); 59 } 60 61 41 62 //-------------------------------------- 42 63 // Linear fitting -
trunk/SophyaLib/TArray/tarray.cc
r813 r850 695 695 int_4 npr = 0; 696 696 Show(os, si); 697 if (ndim_ < 1) return; 697 698 uint_4 k0,k1,k2,k3,k4; 698 699 for(k4=0; k4<size_[4]; k4++) { -
trunk/SophyaLib/TArray/tmatrix.cc
r813 r850 1 // $Id: tmatrix.cc,v 1. 4 2000-04-05 15:44:15ansari Exp $1 // $Id: tmatrix.cc,v 1.5 2000-04-10 12:57:44 ansari Exp $ 2 2 // C.Magneville 04/99 3 3 #include "machdefs.h" … … 232 232 int_4 npr = 0; 233 233 Show(os, si); 234 if (ndim_ < 1) return; 234 235 uint_4 kc,kr; 235 236 for(kr=0; kr<size_[marowi_]; kr++) { -
trunk/SophyaLib/TArray/utilarr.cc
r813 r850 4 4 #include "machdefs.h" 5 5 #include "utilarr.h" 6 #include "srandgen.h" 6 7 7 8 // Classe utilitaires 9 10 RandomSequence::RandomSequence(int typ, double m, double s) 11 { 12 typ_ = (typ == Flat) ? Flat : Gaussian; 13 mean_ = m; 14 sig_ = s; 15 } 16 17 double RandomSequence::Rand() 18 { 19 if (typ_ == Flat) 20 return(drandpm1()*sig_ + mean_); 21 else return(GauRnd(mean_, sig_)); 22 } 23 24 8 25 Sequence::Sequence(double start, double step, Arr_DoubleFunctionOfX f) 26 : rseq_(RandomSequence::Gaussian) 9 27 { 10 28 start_ = start; 11 29 step_ = step; 12 30 myf_ = f; 31 fgrseq_ = false; 32 } 33 34 Sequence::Sequence(RandomSequence rseq) 35 { 36 start_ = 0.; 37 step_ = 1.; 38 myf_ = NULL; 39 rseq_ = rseq; 40 fgrseq_ = true; 13 41 } 14 42 15 43 double Sequence::operator () (uint_4 k) 16 44 { 17 double x = start_+(double)k*step_; 18 if (myf_) return(myf_(x)); 19 return x; 45 if (fgrseq_) return(rseq_.Rand()); 46 else { 47 double x = start_+(double)k*step_; 48 if (myf_) return(myf_(x)); 49 else return x; 50 } 20 51 } 21 52 -
trunk/SophyaLib/TArray/utilarr.h
r813 r850 16 16 typedef float (* Arr_FloatFunctionOfX) (float x); 17 17 18 class RandomSequence { 19 public: 20 enum { Gaussian = 0, Flat = 1 }; 21 RandomSequence(int typ = RandomSequence::Gaussian, double m=0., double s=1.); 22 double Rand(); 23 protected: 24 int typ_; 25 double mean_, sig_; 26 }; 27 28 18 29 class Sequence { 19 30 public: 20 31 explicit Sequence (double start=0., double step=1., Arr_DoubleFunctionOfX f=NULL); 32 explicit Sequence (RandomSequence rseq); 21 33 inline double & Start() { return start_; } 22 34 inline double & Step() { return step_; } … … 25 37 double start_, step_; 26 38 Arr_DoubleFunctionOfX myf_; 39 bool fgrseq_; 40 RandomSequence rseq_; 27 41 }; 28 42
Note:
See TracChangeset
for help on using the changeset viewer.