Changeset 1007 in Sophya for trunk/SophyaLib/TArray/sopemtx.h


Ignore:
Timestamp:
May 16, 2000, 7:54:20 PM (25 years ago)
Author:
ansari
Message:

gestion det dans GausPiv et new norm cmv 16/5/00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/TArray/sopemtx.h

    r999 r1007  
    2727class SimpleMatrixOperation {
    2828public:
     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
    2938  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
     41protected:
     42  static int GausPivScaling;
    3143};
    3244
     
    4759//------------------------------------------------------------
    4860/*! \ingroup TArray \fn LinSolveInPlace(TMatrix<T>&,TVector<T>&)
    49     \brief  Solve A*C = B for C in place and return determinant
     61    \brief  Solve A*C = B for C in place and return 1 if OK, 0 if not.
    5062*/
    5163template <class T>
     
    6274/*! \ingroup TArray
    6375    \fn LinSolve(const TMatrix<T>&, const TVector<T>&, TVector<T>&)
    64     \brief Solve A*C = B and return C and determinant
     76    \brief Solve A*C = B and return C. Return 1 if OK, 0 if not.
    6577*/
    6678template <class T>
     
    8698/*! \ingroup TArray
    8799    \fn Inverse(TMatrix<T> const &)
    88     \brief To inverse a TMatrix
     100    \brief To inverse a TMatrix.
    89101*/
    90102template <class T>
     
    94106/*! \ingroup TArray
    95107    \fn Determinant(TMatrix<T> const &)
    96     \brief Give the TMatrix determinant
     108    \brief Return the TMatrix determinant
    97109*/
    98110template <class T>
     
    100112  TMatrix<T> a(A,false);
    101113  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);
    103115}
    104116
    105117/*! \ingroup TArray
    106     \fn GausPiv(TMatrix<T> const &,TMatrix<T> &)
     118    \fn GausPiv(TMatrix<T> const &,TMatrix<T> &, bool)
    107119    \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)
    110125*/
    111126template <class T>
    112 inline T GausPiv(TMatrix<T> const & A,TMatrix<T> & B) {
     127inline T GausPiv(TMatrix<T> const & A,TMatrix<T> & B, bool computedet=false) {
    113128  TMatrix<T> a(A,false);
    114   return SimpleMatrixOperation<T>::GausPiv(a,B);
     129  return SimpleMatrixOperation<T>::GausPiv(a,B,computedet);
    115130}
    116131
Note: See TracChangeset for help on using the changeset viewer.