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

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

Ajout LeastSquareSolve - Reza 15/5/2001

File size: 1.8 KB
Line 
1#ifndef IntfLapack_H_SEEN
2#define IntfLapack_H_SEEN
3
4#include "machdefs.h"
5#include "tarray.h"
6
7namespace SOPHYA {
8
9template <class T>
10class LapackServer {
11public:
12 LapackServer();
13 virtual ~LapackServer();
14
15 virtual int LinSolve(TArray<T>& a, TArray<T> & b);
16 virtual int LeastSquareSolve(TArray<T>& a, TArray<T> & b);
17
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
21 //! Set the workspace size factor for LAPACK routines
22 inline void SetWorkSpaceSizeFactor(int f = 2)
23 { wspace_size_factor = (f > 1) ? f : 1; }
24
25 //! Returns the workspace size factor
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;
34};
35
36/*! \ingroup LinAlg
37 \fn LapackLinSolve(TArray<T>&, TArray<T> &)
38 \brief Solves the linear system A*X = B using LapackServer.
39*/
40template <class T>
41inline int LapackLinSolve(TArray<T>& a, TArray<T> & b)
42{ LapackServer<T> lps; return( lps.LinSolve(a, b) ); }
43
44template <class T>
45inline int LapackLeastSquareSolve(TArray<T>& a, TArray<T> & b)
46{ LapackServer<T> lps; return( lps.LeastSquareSolve(a, b) ); }
47
48/*! \ingroup LinAlg
49 \fn LapackSVD(TArray<T>&, TArray<T> &)
50 \brief SVD decomposition using LapackServer.
51*/
52template <class T>
53inline int LapackSVD(TArray<T>& a, TArray<T> & s)
54{ LapackServer<T> lps; return( lps.SVD(a, s) ); }
55
56
57/*! \ingroup LinAlg
58 \fn LapackSVD(TArray<T>&, TArray<T> &, TArray<T> &, TArray<T> &)
59 \brief SVD decomposition using LapackServer.
60*/
61template <class T>
62inline int LapackSVD(TArray<T>& a, TArray<T> & s, TArray<T> & u, TArray<T> & vt)
63{ LapackServer<T> lps; return( lps.SVD(a, s, u, vt) ); }
64
65
66} // Fin du namespace
67
68#endif
Note: See TracBrowser for help on using the repository browser.