Changeset 2267 in Sophya for trunk/SophyaLib/TArray/tmatrix.cc
- Timestamp:
- Nov 15, 2002, 10:35:44 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.