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

Last change on this file since 2554 was 2554, checked in by cmv, 21 years ago

intro inversion matrices symetriques + ilaenv (cmv 19/07/04)

File size: 2.4 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);
[2554]16 virtual int LinSolveSym(TArray<T>& a, TArray<T> & b);
[1494]17 virtual int LeastSquareSolve(TArray<T>& a, TArray<T> & b);
18
[1342]19 virtual int SVD(TArray<T>& a, TArray<T> & s);
20 virtual int SVD(TArray<T>& a, TArray<T> & s, TArray<T> & u, TArray<T> & vt);
21
[1424]22 //! Set the workspace size factor for LAPACK routines
[1342]23 inline void SetWorkSpaceSizeFactor(int f = 2)
24 { wspace_size_factor = (f > 1) ? f : 1; }
[1424]25
26 //! Returns the workspace size factor
[1342]27 inline int GetWorkSpaceSizeFactor()
28 { return wspace_size_factor; }
29
30private:
31 int SVDDriver(TArray<T>& a, TArray<T> & s,
32 TArray<T>* up=NULL, TArray<T> * vtp=NULL);
[2554]33 int_4 ilaenv_en_C(int_4 ispec,char *name,char *opts,int_4 n1,int_4 n2,int_4 n3,int_4 n4);
[1342]34
35 int wspace_size_factor;
[814]36};
37
[1424]38/*! \ingroup LinAlg
39 \fn LapackLinSolve(TArray<T>&, TArray<T> &)
40 \brief Solves the linear system A*X = B using LapackServer.
41*/
[814]42template <class T>
[1042]43inline int LapackLinSolve(TArray<T>& a, TArray<T> & b)
[1342]44{ LapackServer<T> lps; return( lps.LinSolve(a, b) ); }
[814]45
[1566]46/*! \ingroup LinAlg
[2554]47 \fn LapackLinSolveSym(TArray<T>&, TArray<T> &)
48 \brief Solves the linear system A*X = B with A symetric using LapackServer.
49*/
50template <class T>
51inline int LapackLinSolveSym(TArray<T>& a, TArray<T> & b)
52{ LapackServer<T> lps; return( lps.LinSolveSym(a, b) ); }
53
54/*! \ingroup LinAlg
[1566]55 \fn LapackLeastSquareSolve(TArray<T>&, TArray<T> &)
56 \brief Solves the linear least squares problem A*X - B
57*/
[1494]58template <class T>
59inline int LapackLeastSquareSolve(TArray<T>& a, TArray<T> & b)
60{ LapackServer<T> lps; return( lps.LeastSquareSolve(a, b) ); }
61
[1424]62/*! \ingroup LinAlg
63 \fn LapackSVD(TArray<T>&, TArray<T> &)
64 \brief SVD decomposition using LapackServer.
65*/
[1342]66template <class T>
67inline int LapackSVD(TArray<T>& a, TArray<T> & s)
68{ LapackServer<T> lps; return( lps.SVD(a, s) ); }
[814]69
[1424]70
71/*! \ingroup LinAlg
72 \fn LapackSVD(TArray<T>&, TArray<T> &, TArray<T> &, TArray<T> &)
73 \brief SVD decomposition using LapackServer.
74*/
[1342]75template <class T>
76inline int LapackSVD(TArray<T>& a, TArray<T> & s, TArray<T> & u, TArray<T> & vt)
77{ LapackServer<T> lps; return( lps.SVD(a, s, u, vt) ); }
78
79
[814]80} // Fin du namespace
81
[775]82#endif
Note: See TracBrowser for help on using the repository browser.