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