source: Sophya/trunk/SophyaExt/LinAlg/intflapack.h@ 1837

Last change on this file since 1837 was 1566, checked in by ansari, 24 years ago

Ajout commentaires-documentation ds LapackServer::LeastSquareSolve() - Reza 5/7/2001

File size: 1.9 KB
RevLine 
[775]1#ifndef IntfLapack_H_SEEN
2#define IntfLapack_H_SEEN
3
4#include "machdefs.h"
5#include "tarray.h"
6
[814]7namespace SOPHYA {
[775]8
[814]9template <class T>
10class LapackServer {
11public:
[1342]12 LapackServer();
13 virtual ~LapackServer();
14
15 virtual int LinSolve(TArray<T>& a, TArray<T> & b);
[1494]16 virtual int LeastSquareSolve(TArray<T>& a, TArray<T> & b);
17
[1342]18 virtual int SVD(TArray<T>& a, TArray<T> & s);
19 virtual int SVD(TArray<T>& a, TArray<T> & s, TArray<T> & u, TArray<T> & vt);
20
[1424]21 //! Set the workspace size factor for LAPACK routines
[1342]22 inline void SetWorkSpaceSizeFactor(int f = 2)
23 { wspace_size_factor = (f > 1) ? f : 1; }
[1424]24
25 //! Returns the workspace size factor
[1342]26 inline int GetWorkSpaceSizeFactor()
27 { return wspace_size_factor; }
28
29private:
30 int SVDDriver(TArray<T>& a, TArray<T> & s,
31 TArray<T>* up=NULL, TArray<T> * vtp=NULL);
32
33 int wspace_size_factor;
[814]34};
35
[1424]36/*! \ingroup LinAlg
37 \fn LapackLinSolve(TArray<T>&, TArray<T> &)
38 \brief Solves the linear system A*X = B using LapackServer.
39*/
[814]40template <class T>
[1042]41inline int LapackLinSolve(TArray<T>& a, TArray<T> & b)
[1342]42{ LapackServer<T> lps; return( lps.LinSolve(a, b) ); }
[814]43
[1566]44/*! \ingroup LinAlg
45 \fn LapackLeastSquareSolve(TArray<T>&, TArray<T> &)
46 \brief Solves the linear least squares problem A*X - B
47*/
[1494]48template <class T>
49inline int LapackLeastSquareSolve(TArray<T>& a, TArray<T> & b)
50{ LapackServer<T> lps; return( lps.LeastSquareSolve(a, b) ); }
51
[1424]52/*! \ingroup LinAlg
53 \fn LapackSVD(TArray<T>&, TArray<T> &)
54 \brief SVD decomposition using LapackServer.
55*/
[1342]56template <class T>
57inline int LapackSVD(TArray<T>& a, TArray<T> & s)
58{ LapackServer<T> lps; return( lps.SVD(a, s) ); }
[814]59
[1424]60
61/*! \ingroup LinAlg
62 \fn LapackSVD(TArray<T>&, TArray<T> &, TArray<T> &, TArray<T> &)
63 \brief SVD decomposition using LapackServer.
64*/
[1342]65template <class T>
66inline int LapackSVD(TArray<T>& a, TArray<T> & s, TArray<T> & u, TArray<T> & vt)
67{ LapackServer<T> lps; return( lps.SVD(a, s, u, vt) ); }
68
69
[814]70} // Fin du namespace
71
[775]72#endif
Note: See TracBrowser for help on using the repository browser.