synaps/usolve/SturmAberth.h

00001 
00002 #ifndef _SYNAPS_SOLVE_STURMABERTH_H_
00003 #define _SYNAPS_SOLVE_STURMABERTH_H_
00004 
00005 
00006 #include <synaps/init.h>
00007 #include <synaps/arithm/RealOf.h>
00008 #include <synaps/usolve/solver_base.h>
00009 #include <synaps/usolve.h>
00010 #include <synaps/usolve/sturm/solve_sturm_aberth.h>
00011 #include <synaps/usolve/sturm/common.h>
00012 
00013 
00014 __BEGIN_NAMESPACE_SYNAPS
00015 
00016 template < typename NT >
00017 struct SturmAberth : public solver_base
00018 {
00019   
00020   typedef NumberTraits<NT>             NTR;
00021   
00022   typedef typename NTR::RT             RT;
00023   typedef typename NTR::FT             FT;
00024   typedef typename NTR::XT             XT;
00025   typedef RR                           RL;
00026   
00027   typedef typename NTR::FIT            FIT;
00028   typedef typename NTR::XIT            XIT;
00029   typedef typename NTR::XIT            RIT;
00030   //  typedef typename NTR::RIT            RIT;
00031   
00032 
00033   typedef UPolDse<RT>    Poly;
00034   typedef UPolDse<RT>    RT_Poly;
00035   typedef UPolDse<FT>    FT_Poly;
00036 
00037   typedef UPolDse<XT>    FT_Poly;
00038   typedef UPolDse<RL>    RL_Poly;
00039 
00040   typedef ALGEBRAIC::root_of<RT, Poly>   RO_t;
00041   typedef ALGEBRAIC::root_of<RT, Poly>   solution_type;
00042 
00043 
00044   typedef SturmAberth    self_t;
00045 
00046 };
00047 
00048 
00049 template < typename NT >
00050 Seq
00051 < 
00052   typename SturmAberth<NT>::RO_t
00053 > 
00054 solve( const typename SturmAberth<NT>::Poly& f,
00055        SturmAberth<NT> )
00056 {
00057   typedef SturmAberth<NT>    K;
00058   typedef typename K::RO_t          RO_t;
00059 
00060   Seq<RO_t> sol;
00061   ALGEBRAIC::solve_sturm_aberth(f, std::back_inserter(sol.rep()), K());
00062   
00063   std::stable_sort( sol.begin(), sol.end(), ALGEBRAIC::Refine_compare());
00064     
00065   return sol;
00066 }
00067 
00068 __END_NAMESPACE_SYNAPS
00069 
00070 #endif // _SYNAPS_SOLVE_STURMABERTH_H_
00071 
00072     

SYNAPS DOCUMENTATION
logo