Changeset 2267 in Sophya
- Timestamp:
- Nov 15, 2002, 10:35:44 AM (23 years ago)
- Location:
- trunk/SophyaLib/TArray
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/basarr.cc
r1636 r2267 11 11 \class SOPHYA::BaseArray 12 12 \ingroup TArray 13 Base class for template arrays 14 No data are connected to this class. 15 13 Base class for template arrays with number of dimensions up to 14 \ref BASEARRAY_MAXNDIMS "BASEARRAY_MAXNDIMS". 15 This class is an abstract class and has no data connected to it. 16 16 17 Define base methods, enum and defaults for TArray , TMatrix and TVector. 18 BaseArray objects can be used in particular for performing operations on 19 arrays with unknown data types, or between arrays with different data types. 17 20 */ 18 21 -
trunk/SophyaLib/TArray/basarr.h
r1581 r2267 152 152 virtual string InfoString() const; 153 153 154 // Lecture,Ecriture sur fichier ASCII 155 //! Reads an array from an ASCII stream 156 virtual sa_size_t ReadASCII(istream& is, sa_size_t & nr, sa_size_t & nc) = 0; 157 //! Writes an array to an ASCII stream 158 virtual void WriteASCII(ostream& os) const = 0; 159 154 160 // DVList info Object 155 161 DVList& Info(); -
trunk/SophyaLib/TArray/tarray.cc
r2153 r2267 12 12 \class SOPHYA::TArray 13 13 \ingroup TArray 14 Class for template arrays 15 16 This class implements arrays of dimensions up to14 Class for template arrays with numerical data types (int, float, complex). 15 16 This class implements arrays with number of dimensions up to 17 17 \ref BASEARRAY_MAXNDIMS "BASEARRAY_MAXNDIMS" 18 19 Standard arithmetic operations on numerical arrays are implemented, 20 as well as sub-array manipulation services. 21 \b Array is a typedef for double precision floating point arrays ( TArray<r_8> ) 22 \sa SOPHYA::Range 23 \sa SOPHYA::Sequence 24 \sa SOPHYA::MathArray 25 26 \code 27 #include "array.h" 28 // ... 29 // Creating and initialising a 1-D array of integers 30 TArray<int> ia(5); 31 EnumeratedSequence es; 32 es = 24, 35, 46, 57, 68; 33 ia = es; 34 cout << "Array<int> ia = " << ia; 35 // 2-D array of floats 36 TArray<r_4> b(6,4), c(6,4); 37 // Initializing b with a constant 38 b = 2.71828; 39 // Filling c with random numbers 40 c = RandomSequence(); 41 // Arithmetic operations 42 TArray<r_4> d = b+0.3f*c; 43 cout << "Array<float> d = " << d; 44 \endcode 45 18 46 */ 19 47 -
trunk/SophyaLib/TArray/tmatrix.cc
r1624 r2267 1 // $Id: tmatrix.cc,v 1.2 2 2001-08-06 22:48:43 cmvExp $1 // $Id: tmatrix.cc,v 1.23 2002-11-15 09:35:44 ansari Exp $ 2 2 // C.Magneville 04/99 3 3 #include "machdefs.h" … … 10 10 \class SOPHYA::TMatrix 11 11 \ingroup TArray 12 Class of matrixes 13 \sa TArray 12 13 The TMatrix class specializes the TArray class for representing 14 two dimensional arrays as matrices. Matrix and vector operations, 15 such as matrix multiplication or transposition is implemented. 16 \b Matrix is a typedef for double precision floating point matrix ( TMatrix<r_8> ). 17 18 \sa SOPHYA::TArray SOPHYA::TVector 19 \sa SOPHYA::Range \sa SOPHYA::Sequence 20 \sa SOPHYA::MathArray \sa SOPHYA::SimpleMatrixOperation 21 22 The following sample code illustrates vector-matrix multiplication 23 and matrix inversion, using simple gauss inversion. 24 \code 25 #include "array.h" 26 // .... 27 int n = 5; // Size of matrix and vectors here 28 Matrix a(n,n); 29 a = RandomSequence(RandomSequence::Gaussian, 0., 2.5); 30 Vector x(n); 31 x = RegularSequence(1.,3.); 32 Vector b = a*x; 33 cout << " ----- Vector x = \n " << x << endl; 34 cout << " ----- Vector b = a*x = \n " << b << endl; 35 SimpleMatrixOperation<r_8> smo; 36 Matrix inva = smo.Inverse(a); 37 cout << " ----- Matrix Inverse(a) = \n " << inva << endl; 38 cout << " ----- Matrix a*Inverse(a) = \n " << inva*a << endl; 39 cout << " ----- Matrix Inverse(a)*b (=Inv(a)*a*x) = \n " << inva*b << endl; 40 cout << " ----- Matrix x-Inverse(a)*b = (=0 ?)\n " << x-inva*b << endl; 41 \endcode 42 14 43 */ 15 44 -
trunk/SophyaLib/TArray/tvector.cc
r1624 r2267 1 // $Id: tvector.cc,v 1.1 4 2001-08-06 22:48:43 cmvExp $1 // $Id: tvector.cc,v 1.15 2002-11-15 09:35:44 ansari Exp $ 2 2 // C.Magneville 04/99 3 3 #include "machdefs.h" … … 9 9 \class SOPHYA::TVector 10 10 \ingroup TArray 11 Class of vector (line or column) 12 \sa TMatrix TArray 13 */ 11 12 The TVector class specializes the TMatrix class for representing 13 row or column vectors. 14 15 \b Vector is a typedef for double precision floating point vectors ( TVector<r_8> ). 16 17 \sa SOPHYA::TArray SOPHYA::TMatrix 18 \sa SOPHYA::Range SOPHYA::Sequence 19 \sa SOPHYA::MathArray 20 21 The following sample code illustrates sub-vector manipulation: 22 \code 23 #include "array.h" 24 // ... 25 // Input Vector containing a noisy periodic signal 26 Vector in(1024), out(1024); 27 in = RandomSequence(RandomSequence::Gaussian, 0., 1.); 28 for(int kk=0; kk<in.Size(); kk++) 29 in(kk) += 2*sin(kk*0.05); 30 // Compute the output vector by a simple low pass filter 31 Vector out(1024); 32 int w = 2; 33 for(int k=w; k<in.Size()-w; k++) 34 out(k) = in(Range(k-w, k+w).Sum()/(2.*w+1.); 35 \endcode 36 */ 14 37 15 38 ////////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.