Changeset 1007 in Sophya for trunk/SophyaLib/TArray/sopemtx.h
- Timestamp:
- May 16, 2000, 7:54:20 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/sopemtx.h
r999 r1007 27 27 class SimpleMatrixOperation { 28 28 public: 29 //! To define the type of data scaling for Gauss pivoting method (type T) 30 enum GausPivScal { 31 PIV_NO_SCALE = 0, //!< do not scale datas for gauss pivoting 32 PIV_GLOB_SCALE = 1, //!< do a global scaling of datas for gauss pivoting (default) 33 PIV_ROW_SCALE = 2 //!< do a scaling by row of datas for gauss pivoting 34 }; 35 static inline int SetGausPivScal(int gps = PIV_GLOB_SCALE) 36 { GausPivScaling = gps; return GausPivScaling; } 37 29 38 static TMatrix<T> Inverse(TMatrix<T> const & A); 30 static T GausPiv(TMatrix<T>& A, TMatrix<T>& B); 39 static T GausPiv(TMatrix<T>& A, TMatrix<T>& B, bool computedet=false); 40 41 protected: 42 static int GausPivScaling; 31 43 }; 32 44 … … 47 59 //------------------------------------------------------------ 48 60 /*! \ingroup TArray \fn LinSolveInPlace(TMatrix<T>&,TVector<T>&) 49 \brief Solve A*C = B for C in place and return determinant61 \brief Solve A*C = B for C in place and return 1 if OK, 0 if not. 50 62 */ 51 63 template <class T> … … 62 74 /*! \ingroup TArray 63 75 \fn LinSolve(const TMatrix<T>&, const TVector<T>&, TVector<T>&) 64 \brief Solve A*C = B and return C and determinant76 \brief Solve A*C = B and return C. Return 1 if OK, 0 if not. 65 77 */ 66 78 template <class T> … … 86 98 /*! \ingroup TArray 87 99 \fn Inverse(TMatrix<T> const &) 88 \brief To inverse a TMatrix 100 \brief To inverse a TMatrix. 89 101 */ 90 102 template <class T> … … 94 106 /*! \ingroup TArray 95 107 \fn Determinant(TMatrix<T> const &) 96 \brief Givethe TMatrix determinant108 \brief Return the TMatrix determinant 97 109 */ 98 110 template <class T> … … 100 112 TMatrix<T> a(A,false); 101 113 TMatrix<T> b(a.NCols(),a.NRows()); b = IdentityMatrix(1.); 102 return SimpleMatrixOperation<T>::GausPiv(a,b );114 return SimpleMatrixOperation<T>::GausPiv(a,b,true); 103 115 } 104 116 105 117 /*! \ingroup TArray 106 \fn GausPiv(TMatrix<T> const &,TMatrix<T> & )118 \fn GausPiv(TMatrix<T> const &,TMatrix<T> &, bool) 107 119 \brief Gauss pivoting on matrix \b A, doing the same operations 108 on matrix \b B and return determinant of \b A. 109 \sa SOPHYA::SimpleMatrixOperation::GausPiv(TMatrix<T>&,TMatrix<T>&) 120 on matrix \b B. 121 \param computedet = true : return the determinant of \b A 122 (beware of over/underfloat), default is false. 123 \return determinant if requested, or 1 if OK. 124 \sa SOPHYA::SimpleMatrixOperation::GausPiv(TMatrix<T>&,TMatrix<T>&,bool) 110 125 */ 111 126 template <class T> 112 inline T GausPiv(TMatrix<T> const & A,TMatrix<T> & B ) {127 inline T GausPiv(TMatrix<T> const & A,TMatrix<T> & B, bool computedet=false) { 113 128 TMatrix<T> a(A,false); 114 return SimpleMatrixOperation<T>::GausPiv(a,B );129 return SimpleMatrixOperation<T>::GausPiv(a,B,computedet); 115 130 } 116 131
Note:
See TracChangeset
for help on using the changeset viewer.