realroot_doc 0.1.1
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.

{ }
interval_rep ( const POL  p) [inline]

Definition at line 58 of file solver_ucf.hpp.

        {
            f  = p;
            hg = homography<C>() ;
        }
interval_rep ( const POL  p,
homography< C >  h 
) [inline]

Definition at line 64 of file solver_ucf.hpp.

        {
            f  = p;
            hg = h;
        }
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().

        {
            f  = p;
            hg = homography<C>() ;

            shift_box           ( u );
            contract_box      ( v-u );
            reverse_and_shift_box (1);
            //print();
        }

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().

        {
            int s, sz= f.size();
            
            for ( s = 0 ; s < sz; ++s )
                f[s] *= pow(t,s) ;
            
            //update homography
            hg.contract_hom(t);
        };
Interval<Real> domain ( ) [inline]

Definition at line 89 of file solver_ucf.hpp.

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

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

        { 
            Real l, r;
            Interval<Real>  s ;
            //lim to 0
            if ( hg.b!=0 && hg.d!=0 )
                l= as<Real>(hg.b)/as<Real>(hg.d);
            else if ( hg.d==0 )
                l= 10000000;
            else if ( hg.b==0 )
                l= 0 ;
            else 
                l= as<Real>(hg.a)/as<Real>(hg.c) ;
            //lim to inf
            if ( hg.a!=0 && hg.c!=0 )
                r= as<Real>(hg.a)/as<Real>(hg.c);
            else if ( hg.c==0 )
                r=10000000;
            else if ( hg.a==0 )
                r= 0 ;
            else 
                r= as<Real>(hg.b)/as<Real>(hg.d);
            
            if ( l<=r ) s= Interval<Real>(l,r);
            else        s= Interval<Real>(r,l);
    
            return s; 
        }
homography<C> hom ( ) [inline]

Definition at line 85 of file solver_ucf.hpp.

{ return hg; }
C middle ( ) [inline]

Definition at line 133 of file solver_ucf.hpp.

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

        {
            C t(hg.d / hg.c);
            
            if (t>0)
                return ( t ) ;
            else
                return C(1);
        }
Real point ( C &  t) [inline]

Definition at line 127 of file solver_ucf.hpp.

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

        {
            return ( as<Real>(hg.a)*as<Real>(t) + as<Real>(hg.b) ) /
                   ( as<Real>(hg.c)*as<Real>(t) + as<Real>(hg.d) ) ;
        }
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().

{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().

        {
            std::cout << "----------Interval---------------"    << "\n" ;
            std::cout << poly() << "\n" ;
            std::cout<< "("<<hg.a <<"x + " << hg.b<<")/("<<hg.c<<"x+ "<<hg.d << ")"<<", sv:"<<sign_var() <<std::endl;
            std::cout << domain() << "\n" ;
            std::cout << "-------------------------------"    << "\n" ;
        }
void reverse_and_shift_box ( const C &  t = 1) [inline]
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().

        {
            unsigned s, l= f.size()-1;
            
            for (s = 0 ; s <= l/2; s++ )
                std::swap(f[s], f[l-s]);
            
            //update homography
            hg.reciprocal_hom(t);
        };
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().

        {
            int s, k,j, sz= f.size();
            
            for ( s = sz, j = 0; j <= s-2; j++ )
                for( k = s-2; k >= j; k-- ) 
                    f[k] += t*f[k+1];
            
            //update homography
            hg.shift_hom(t);
        };
unsigned sign_var ( ) [inline]

Definition at line 143 of file solver_ucf.hpp.

References mmx::sign_variation().

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

        {
            return sign_variation(f.begin(),f.end()) ;
        }
Real width ( ) [inline]

Definition at line 120 of file solver_ucf.hpp.

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

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