synaps/usolve/Small_degree.h

00001 
00002 #ifndef _synaps_solve_Small_degree_H_
00003 #define _synaps_solve_Small_degree_H_
00004 
00005 
00006 #include <synaps/init.h>
00007 #include <synaps/arithm/Interval.h>
00008 #include <synaps/arithm/traits.h>
00009 
00010 #include <synaps/upol/UPolDse.h>
00011 //#include <synaps/usolve.h>
00012 #include <synaps/usolve/solver_base.h>
00013 #include <synaps/usolve/algebraic/root_of.h>
00014 #include <synaps/usolve/sturm/solve_small.h>
00015 
00016 
00017 __BEGIN_NAMESPACE_SYNAPS
00018 
00019 template < class NT >
00020 struct Small_degree : public NumberTraits<NT>
00021 {
00022    typedef NumberTraits<NT>   NTR;
00023   
00024   typedef  RR      RL;
00025   typedef typename NTR::FT FT;
00026   typedef typename NTR::RT RT;
00027   typedef typename NTR::XT XT;
00028 
00029   typedef Interval<FT>             FIT;
00030   typedef Interval<XT>             XIT;
00031   typedef Interval<XT>             RIT;
00032   //  typedef typename NTR::RIT            RIT;
00033   
00034   
00035   typedef UPolDse<RT>       Poly;
00036   typedef UPolDse<RT>       RT_Poly;
00037   typedef UPolDse<FT>       FT_Poly;  
00038   typedef UPolDse<XT>       XT_Poly;  
00039   typedef UPolDse<RL>       RL_Poly;  
00040 
00041   //  typedef typename ALGEBRAIC::MPoly_2_2<RT>       MPoly_2_2;
00042   typedef UPolDse< UPolDse<RT> >                  Poly_2;
00043 
00044   typedef typename ALGEBRAIC::root_of<RT, Poly>   RO_t;
00045   typedef typename ALGEBRAIC::root_of<RT, Poly>   root_t;
00046   typedef typename ALGEBRAIC::root_of<RT, Poly>   solution_type;
00047 
00048 
00049   typedef Small_degree            self_t;
00050 };
00051 
00052 
00053 
00054 
00055 template < class NT >
00056 Seq< typename Small_degree<NT>::RO_t >
00057 solve( const typename Small_degree<NT>::Poly& f,
00058        Small_degree<NT>)
00059 {
00060     assert(UPOLDAR::degree(f) <= 4);
00061 
00062     typedef Small_degree<NT>   K;
00063     typedef typename K::RT            RT;
00064     typedef typename K::Poly          Poly;
00065     typedef typename K::RO_t          RO_t;
00066     
00067     Seq<RO_t> sol;
00068     ALGEBRAIC::solve_small_degree(f, 1, std::back_inserter(sol.rep()), K());
00069     return sol;
00070 }
00071 
00072 
00073 template < class NT,
00074            class OutputIterator>
00075 OutputIterator
00076 solve( const typename Small_degree<NT>::Poly& f,
00077        OutputIterator it,
00078        Small_degree<NT>)
00079 {
00080     assert(UPOLDAR::degree(f) <= 4);
00081 
00082     typedef Small_degree<NT>   K;
00083 
00084     return ALGEBRAIC::solve_small_degree(f, 1, it, K());
00085 }
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 __END_NAMESPACE_SYNAPS
00094 
00095 #endif // _synaps_solve_Small_degree_H_
00096 

SYNAPS DOCUMENTATION
logo