interval_rep< POL > Class Template Reference

#include <solver_ucf.hpp>

List of all members.

Public Member Functions


Detailed Description

template<class POL>
class mmx::interval_rep< POL >

Definition at line 47 of file solver_ucf.hpp.


Constructor & Destructor Documentation

interval_rep (  )  [inline]

Definition at line 56 of file solver_ucf.hpp.

00056 { }

interval_rep ( const POL  p  )  [inline]

Definition at line 58 of file solver_ucf.hpp.

00059         {
00060             f  = p;
00061             hg = homography<C>() ;
00062         }

interval_rep ( const POL  p,
homography< C >  h 
) [inline]

Definition at line 64 of file solver_ucf.hpp.

00065         {
00066             f  = p;
00067             hg = h;
00068         }

interval_rep ( const POL  p,
u,
v 
) [inline]

Definition at line 71 of file solver_ucf.hpp.

References interval_rep< POL >::contract_box(), interval_rep< POL >::reverse_and_shift_box(), and interval_rep< POL >::shift_box().

00072         {
00073             f  = p;
00074             hg = homography<C>() ;
00075 
00076             shift_box           ( u );
00077             contract_box      ( v-u );
00078             reverse_and_shift_box (1);
00079             //print();
00080         }


Member Function Documentation

void contract_box ( const C &  t  )  [inline]

Definition at line 163 of file solver_ucf.hpp.

References homography< real >::contract_hom(), and mmx::pow().

Referenced by interval_rep< POL >::interval_rep().

00164         {
00165             int s, sz= f.size();
00166             
00167             for ( s = 0 ; s < sz; ++s )
00168                 f[s] *= pow(t,s) ;
00169             
00170             //update homography
00171             hg.contract_hom(t);
00172         };

Interval<Real> domain (  )  [inline]

Definition at line 89 of file solver_ucf.hpp.

References homography< real >::a, homography< real >::b, homography< real >::c, homography< real >::d, and Real.

Referenced by interval_rep< POL >::print().

00090         { 
00091             Real l, r;
00092             Interval<Real>  s ;
00093             //lim to 0
00094             if ( hg.b!=0 && hg.d!=0 )
00095                 l= as<Real>(hg.b)/as<Real>(hg.d);
00096             else if ( hg.d==0 )
00097                 l= 10000000;
00098             else if ( hg.b==0 )
00099                 l= 0 ;
00100             else 
00101                 l= as<Real>(hg.a)/as<Real>(hg.c) ;
00102             //lim to inf
00103             if ( hg.a!=0 && hg.c!=0 )
00104                 r= as<Real>(hg.a)/as<Real>(hg.c);
00105             else if ( hg.c==0 )
00106                 r=10000000;
00107             else if ( hg.a==0 )
00108                 r= 0 ;
00109             else 
00110                 r= as<Real>(hg.b)/as<Real>(hg.d);
00111             
00112             if ( l<=r ) s= Interval<Real>(l,r);
00113             else        s= Interval<Real>(r,l);
00114     
00115             return s; 
00116         }

homography<C> hom (  )  [inline]

Definition at line 85 of file solver_ucf.hpp.

00085 { return hg; }

C middle (  )  [inline]

Definition at line 133 of file solver_ucf.hpp.

References homography< real >::c, and homography< real >::d.

00134         {
00135             C t(hg.d / hg.c);
00136             
00137             if (t>0)
00138                 return ( t ) ;
00139             else
00140                 return C(1);
00141         }

Real point ( C &  t  )  [inline]

Definition at line 127 of file solver_ucf.hpp.

References homography< real >::a, homography< real >::b, homography< real >::c, homography< real >::d, and Real.

00128         {
00129             return ( as<Real>(hg.a)*as<Real>(t) + as<Real>(hg.b) ) /
00130                    ( as<Real>(hg.c)*as<Real>(t) + as<Real>(hg.d) ) ;
00131         }

POL poly (  )  [inline]

Definition at line 83 of file solver_ucf.hpp.

Referenced by solver_cffirst< Real, POL >::first_root_isolate(), and interval_rep< POL >::print().

00083 {return f;};

void print (  )  [inline]

Definition at line 193 of file solver_ucf.hpp.

References homography< real >::a, homography< real >::b, homography< real >::c, homography< real >::d, interval_rep< POL >::domain(), interval_rep< POL >::poly(), and interval_rep< POL >::sign_var().

00194         {
00195             std::cout << "----------Interval---------------"    << "\n" ;
00196             std::cout << poly() << "\n" ;
00197             std::cout<< "("<<hg.a <<"x + " << hg.b<<")/("<<hg.c<<"x+ "<<hg.d << ")"<<", sv:"<<sign_var() <<std::endl;
00198             std::cout << domain() << "\n" ;
00199             std::cout << "-------------------------------"    << "\n" ;
00200         }

void reverse_and_shift_box ( const C &  t = 1  )  [inline]

Definition at line 187 of file solver_ucf.hpp.

References interval_rep< POL >::reverse_box(), and interval_rep< POL >::shift_box().

Referenced by interval_rep< POL >::interval_rep().

00188         {
00189             reverse_box(t);
00190             shift_box  (C(1));
00191         };

void reverse_box ( const C &  t = 1  )  [inline]

Definition at line 175 of file solver_ucf.hpp.

References homography< real >::reciprocal_hom(), and mmx::sparse::swap().

Referenced by interval_rep< POL >::reverse_and_shift_box().

00176         {
00177             unsigned s, l= f.size()-1;
00178             
00179             for (s = 0 ; s <= l/2; s++ )
00180                 std::swap(f[s], f[l-s]);
00181             
00182             //update homography
00183             hg.reciprocal_hom(t);
00184         };

void shift_box ( const C &  t  )  [inline]

Definition at line 150 of file solver_ucf.hpp.

References homography< real >::shift_hom().

Referenced by interval_rep< POL >::interval_rep(), and interval_rep< POL >::reverse_and_shift_box().

00151         {
00152             int s, k,j, sz= f.size();
00153             
00154             for ( s = sz, j = 0; j <= s-2; j++ )
00155                 for( k = s-2; k >= j; k-- ) 
00156                     f[k] += t*f[k+1];
00157             
00158             //update homography
00159             hg.shift_hom(t);
00160         };

unsigned sign_var (  )  [inline]

Definition at line 143 of file solver_ucf.hpp.

References mmx::sign_variation().

Referenced by interval_rep< POL >::print().

00144         {
00145             return sign_variation(f.begin(),f.end()) ;
00146         }

Real width (  )  [inline]

Definition at line 120 of file solver_ucf.hpp.

References Real.

00121         { 
00122             return this->template domain<Real>().width(); 
00123         }


The documentation for this class was generated from the following file:

Generated on 6 Dec 2012 for realroot by  doxygen 1.6.1