00001
00002
00003 #ifndef LHCBMATH_EIGENSYSTEM_H
00004 #define LHCBMATH_EIGENSYSTEM_H 1
00005
00006
00007
00008
00009
00010 #include <vector>
00011
00012
00013
00014 #include "Math/SMatrix.h"
00015 #include "Math/SVector.h"
00016
00017
00018
00019 #include "gsl/gsl_eigen.h"
00020
00021
00022
00023 #include "GaudiKernel/StatusCode.h"
00024
00025
00026 namespace Gaudi
00027 {
00028 namespace Math
00029 {
00030 namespace GSL
00031 {
00032
00041 class EigenSystem
00042 {
00043 public:
00045 enum
00046 {
00047 MatrixAllocationFailure = 101 ,
00048 VectorAllocationFailure = 102 ,
00049 WorkspaceAllocationFailure = 103 ,
00050
00051 ErrorFromGSL = 199 ,
00052 } ;
00053 public:
00055 EigenSystem () ;
00057 ~EigenSystem () ;
00058 public:
00059
00080 template <class T,unsigned int D>
00081 inline ROOT::Math::SVector<T,D>
00082 eigenValues
00083 ( const ROOT::Math::SMatrix<T,D,D,ROOT::Math::MatRepSym<T,D> >& mtrx ,
00084 const bool sorted = true ) const ;
00085
00106 template <class T,unsigned int D>
00107 inline StatusCode
00108 eigenValues
00109 ( const ROOT::Math::SMatrix<T,D,D,ROOT::Math::MatRepSym<T,D> >& mtrx ,
00110 ROOT::Math::SVector<T,D>& vals ,
00111 const bool sorted = true ) const ;
00112
00152 template <class T, unsigned int D>
00153 inline StatusCode
00154 eigenVectors
00155 ( const ROOT::Math::SMatrix<T,D,D,ROOT::Math::MatRepSym<T,D> >& mtrx ,
00156 ROOT::Math::SVector<T,D>& vals ,
00157 ROOT::Math::SMatrix<T,D,D>& vecs ,
00158 const bool sorted = true ) const ;
00159
00184 template <class T, unsigned int D>
00185 inline StatusCode
00186 eigenVectors
00187 ( const ROOT::Math::SMatrix<T,D,D,ROOT::Math::MatRepSym<T,D> >& mtrx ,
00188 ROOT::Math::SVector<T,D>& vals ,
00189 std::vector<ROOT::Math::SVector<T,D> >& vecs ,
00190 const bool sorted = true ) const ;
00191
00192 protected:
00193
00195 StatusCode _fun1 ( const bool sorted ) const ;
00197 StatusCode _fun2 ( const bool sorted ) const ;
00198
00199 private:
00200
00202 template <class T,unsigned int D>
00203 inline StatusCode _fill
00204 ( const ROOT::Math::SMatrix<T,D,D,ROOT::Math::MatRepSym<T,D> >& mtrx ) const;
00206 StatusCode _check ( const unsigned int D ) const ;
00207
00208 StatusCode Exception ( const StatusCode& sc ) const ;
00209
00210 private:
00211
00212 mutable unsigned int m_dim1 ;
00213 mutable unsigned int m_dim2 ;
00214
00215 mutable gsl_eigen_symm_workspace* m_work1 ;
00216
00217 mutable gsl_eigen_symmv_workspace* m_work2 ;
00218
00219 mutable gsl_matrix* m_matrix ;
00220
00221 mutable gsl_matrix* m_evec ;
00222
00223 mutable gsl_vector* m_vector ;
00224 } ;
00225
00233 template <class T, unsigned int D>
00234 inline void
00235 _copy
00236 ( const gsl_vector* input ,
00237 ROOT::Math::SVector<T,D>& output ) ;
00238
00246 template < class T, unsigned int D>
00247 inline void
00248 _copy
00249 ( const ROOT::Math::SMatrix<T,D,D,ROOT::Math::MatRepSym<T,D> >& input ,
00250 gsl_matrix* output ) ;
00251
00259 template < class T, unsigned int D>
00260 inline void
00261 _copy
00262 ( const gsl_matrix* input ,
00263 ROOT::Math::SMatrix<T,D,D>& output ) ;
00264
00265 }
00266 }
00267 }
00268
00269 #endif // LHCBMATH_EIGENSYSTEM_H
00270
00271 #include "EigenSystem.icpp"
00272
00273
00274