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

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

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

File size: 1.9 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
44/*! \ingroup LinAlg
45 \fn LapackLeastSquareSolve(TArray<T>&, TArray<T> &)
46 \brief Solves the linear least squares problem A*X - B
47*/
48template <class T>
49inline int LapackLeastSquareSolve(TArray<T>& a, TArray<T> & b)
50{ LapackServer<T> lps; return( lps.LeastSquareSolve(a, b) ); }
51
52/*! \ingroup LinAlg
53 \fn LapackSVD(TArray<T>&, TArray<T> &)
54 \brief SVD decomposition using LapackServer.
55*/
56template <class T>
57inline int LapackSVD(TArray<T>& a, TArray<T> & s)
58{ LapackServer<T> lps; return( lps.SVD(a, s) ); }
59
60
61/*! \ingroup LinAlg
62 \fn LapackSVD(TArray<T>&, TArray<T> &, TArray<T> &, TArray<T> &)
63 \brief SVD decomposition using LapackServer.
64*/
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
70} // Fin du namespace
71
72#endif
Note: See TracBrowser for help on using the repository browser.