Changeset 894 in Sophya for trunk/SophyaLib/TArray/tmatrix.h
- Timestamp:
- Apr 12, 2000, 7:42:33 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/tmatrix.h
r813 r894 8 8 9 9 namespace SOPHYA { 10 11 //! Class of matrixes 12 /*! 13 \sa TArray 14 */ 10 15 11 16 template <class T> … … 23 28 // Pour verifiez la compatibilite de dimensions lors de l'affectation 24 29 virtual TArray<T>& Set(const TArray<T>& a); 30 //! Operator = between matrices 25 31 inline TMatrix<T>& operator = (const TMatrix<T>& a) 26 32 { Set(a); return(*this); } 27 33 28 34 // Size - Changing the Size 35 //! return number of rows 29 36 inline uint_4 NRows() const {return Size(marowi_); } 37 //! return number of columns 30 38 inline uint_4 NCols() const {return Size(macoli_); } 39 //! return number of columns 31 40 inline uint_4 NCol() const {return Size(macoli_); } // back-compat Peida 32 41 … … 36 45 // Sub-matrix extraction $CHECK$ Reza 03/2000 Doit-on declarer ces methode const ? 37 46 TMatrix<T> SubMatrix(Range rline, Range rcol) const ; 47 //! () : Return submatrix define by \b Range \b rline and \b rcol 38 48 inline TMatrix<T> operator () (Range rline, Range rcol) const 39 49 { return SubMatrix(rline, rcol); } 40 50 // Lignes et colonnes de la matrice 51 //! Return submatrix define by line \b ir (line vector) 41 52 inline TMatrix<T> Row(uint_4 ir) const 42 53 { return SubMatrix(Range(ir,ir), Range(0,NCols()-1)); } 54 //! Return submatrix define by column \b ic (column vector) 43 55 inline TMatrix<T> Column(uint_4 ic) const 44 56 { return SubMatrix(Range(0,NRows()-1), Range(ic,ic)); } … … 58 70 // A = x (matrice diagonale Identite) 59 71 virtual TMatrix<T>& SetIdentity(IdentityMatrix imx); 72 // = : fill matrix with an identity matrix \b imx 60 73 inline TMatrix<T>& operator = (IdentityMatrix imx) { return SetIdentity(imx); } 61 74 75 // = : fill matrix with a Sequence \b seq 62 76 inline TMatrix<T>& operator = (Sequence seq) { SetSeq(seq); return(*this); } 63 77 64 78 // Operations diverses avec une constante 79 //! = : fill matrix with constant value \b x 65 80 inline TMatrix<T>& operator = (T x) { SetT(x); return(*this); } 81 //! += : add constant value \b x to matrix 66 82 inline TMatrix<T>& operator += (T x) { Add(x); return(*this); } 83 //! -= : substract constant value \b x to matrix 67 84 inline TMatrix<T>& operator -= (T x) { Sub(x); return(*this); } 85 //! *= : multiply matrix by constant value \b x 68 86 inline TMatrix<T>& operator *= (T x) { Mul(x); return(*this); } 87 //! /= : divide matrix by constant value \b x 69 88 inline TMatrix<T>& operator /= (T x) { Div(x); return(*this); } 70 89 71 90 // operations avec matrices 91 //! += : add a matrix 72 92 inline TMatrix<T>& operator += (const TMatrix<T>& a) { AddElt(a); return(*this); } 93 //! -= : substract a matrix 73 94 inline TMatrix<T>& operator -= (const TMatrix<T>& a) { SubElt(a); return(*this); } 74 // Produit matriciel Multiply : C = (*this)*B75 95 TMatrix<T> Multiply(const TMatrix<T>& b, short mm=SameMemoryMapping) const; 96 //! *= : matrix product : C = (*this)*B 76 97 inline TMatrix<T>& operator *= (const TMatrix<T>& b) 77 98 { this->Set(Multiply(b)); return(*this); } … … 85 106 86 107 // ---- inline acces methods ------ 108 //! () : return element for line \b r and column \b c 87 109 template <class T> 88 110 inline T const& TMatrix<T>::operator()(uint_4 r, uint_4 c) const … … 96 118 } 97 119 120 //! () : return element for line \b r and column \b c 98 121 template <class T> 99 122 inline T & TMatrix<T>::operator()(uint_4 r, uint_4 c) … … 113 136 // Doit-on le faire aussi pour les constantes ? - Fin de $CHECK$ Reza 3/4/2000 114 137 138 //! + : add matrixes \b a and \b b 115 139 template <class T> 116 140 inline TMatrix<T> operator + (const TMatrix<T>& a,const TMatrix<T>& b) 117 141 {TMatrix<T> result(a); result.SetTemp(true); result.AddElt(b); return result;} 118 142 143 //! - : substract matrixes \b a and \b b 119 144 template <class T> 120 145 inline TMatrix<T> operator - (const TMatrix<T>& a,const TMatrix<T>& b) … … 122 147 123 148 // Surcharge d'operateurs C = A * B 124 149 //! - : multiply matrixes \b a and \b b 125 150 template <class T> inline TMatrix<T> operator * (const TMatrix<T>& a, const TMatrix<T>& b) 126 151 { TMatrix<T> result(a); result.SetTemp(true); return(result.Multiply(b)); } 127 152 153 //! Define Matrix to be TMatrix<r_8> 128 154 typedef TMatrix<r_8> Matrix; 129 155
Note:
See TracChangeset
for help on using the changeset viewer.