Seq< C, R > Struct Template Reference

Sequence of terms with reference counter. More...

#include <Seq.hpp>

List of all members.

Public Types

Public Member Functions

Public Attributes


Detailed Description

template<class C, class R = std::vector<C>>
struct mmx::Seq< C, R >

Sequence of terms with reference counter.

It allows to use it as output of other functions. The container R should have the following signatures:

  typename R::size_type;
  typename R::iterator;
  typename R::const_iterator;
  typename R::reverse_iterator;
  typename R::const_reverse_iterator;

        C begin();
        C end();
  
        C rbegin();
        C rend();

        C& operator[] (size_type);
  const C& operator[] (size_type) const;

Definition at line 59 of file Seq.hpp.


Member Typedef Documentation

typedef R::const_iterator const_iterator

Definition at line 69 of file Seq.hpp.

typedef R::const_reverse_iterator const_reverse_iterator

Definition at line 71 of file Seq.hpp.

typedef R::iterator iterator

Definition at line 68 of file Seq.hpp.

typedef R::reverse_iterator reverse_iterator

Definition at line 70 of file Seq.hpp.

typedef Seq<C,R> self_t

Definition at line 72 of file Seq.hpp.

typedef R::size_type size_type

Definition at line 65 of file Seq.hpp.

typedef C value_t

Definition at line 67 of file Seq.hpp.

typedef C value_type

Definition at line 66 of file Seq.hpp.


Constructor & Destructor Documentation

Seq (  )  [inline]

Definition at line 74 of file Seq.hpp.

00074 : data() {}

Seq ( const R &  r  )  [inline]

Definition at line 75 of file Seq.hpp.

00075 :data(r){}

Seq ( size_type  s  )  [inline]

Definition at line 76 of file Seq.hpp.

00076 {rep().resize(s);}

Seq ( size_type  s,
value_type t 
) [inline]

Definition at line 77 of file Seq.hpp.

00077 {rep()=R(t,t+s);}

Seq ( iterator  b,
iterator  e 
) [inline]

Definition at line 78 of file Seq.hpp.

00078 {rep()=R(b,e);}

Seq ( size_type  m,
const char *  str 
)
Seq ( char *  str  )  [inline]

Definition at line 348 of file Seq.hpp.

References mmx::assign(), BLIST, C, ELIST, Seq< C, R >::push_back(), Seq< C, R >::rep(), mmx::shift(), synaps_input, synaps_inputlim, mmx::synaps_inputptr, yylex(), and yylval.

00348                       : data()
00349 {
00350   rep().resize(0);
00351   synaps_input = s;
00352   synaps_inputptr = synaps_input;
00353   synaps_inputlim = s + strlen(s);
00354   C term;
00355   bool shift = true;
00356   int Ask;
00357 
00358   for (;;) {
00359     Ask = yylex();
00360     if (shift && Ask == BLIST) {
00361       shift = false ;
00362     }
00363     else if (Ask == ELIST) {
00364       break;
00365     }
00366     else {
00367       let::assign(term,yylval);
00368       this->push_back(term);
00369     }
00370   }
00371 }

Seq ( const self_t r  )  [inline]

Definition at line 83 of file Seq.hpp.

00083 : data(r.data) {}

Seq ( const Seq< X, S > &  P  )  [inline]

Definition at line 85 of file Seq.hpp.

00085 {using namespace let;   assign(*this,P);}

~Seq (  )  [inline]

Definition at line 185 of file Seq.hpp.

00185 {}


Member Function Documentation

const_iterator begin (  )  const [inline]

Definition at line 89 of file Seq.hpp.

00089 {return rep().begin();}

iterator begin (  )  [inline]
self_t& clear (  )  [inline]

Definition at line 117 of file Seq.hpp.

Referenced by box_rep< C >::max_eval().

00117                     { rep().clear();
00118                                         return *this; }

bool empty (  )  const [inline]

Definition at line 165 of file Seq.hpp.

00165 {return (rep().size()==0);}

const_iterator end (  )  const [inline]

Definition at line 90 of file Seq.hpp.

00090 {return rep().end();}

iterator end (  )  [inline]
self_t& erase ( size_type  i  )  [inline]

Definition at line 112 of file Seq.hpp.

Referenced by solver_mv_monomial< FT, POL >::solve_system().

00112                                 { 
00113     //if (i>size_type(-1) && i< this->size() )
00114       rep().erase(rep().begin()+i);
00115     return *this; }

const value_type& front (  )  const [inline]

Definition at line 109 of file Seq.hpp.

00109 { assert(this->size()>0); return rep()[0];}

C max ( Compare  comp  )  [inline]

Definition at line 159 of file Seq.hpp.

00159                        {
00160    return *std::max_element( this->rep().begin(), this->rep().end(),comp);
00161   }

C max (  )  [inline]

Definition at line 144 of file Seq.hpp.

00144            {
00145     return *std::max_element( this->rep().begin(), this->rep().end());
00146   }

bool member ( const C &  x  )  [inline]

Definition at line 129 of file Seq.hpp.

00129                            {
00130                         for (size_type i=0;i< this->size();++i)
00131                                         if ( this->rep()[i]== x) 
00132                                                         return true;
00133       return false;
00134                         }

C min ( Compare  comp  )  [inline]

Definition at line 154 of file Seq.hpp.

00154                       {
00155   return *std::min_element( this->rep().begin(), this->rep().end(),comp);
00156   }

C min (  )  [inline]

Definition at line 140 of file Seq.hpp.

00140           {
00141     return *std::min_element( this->rep().begin(), this->rep().end());
00142   }

Seq< C, R > operator, ( const C &  x  )  const [inline]

Concatenate an element at the end of the sequence.

Definition at line 223 of file Seq.hpp.

References Seq< C, R >::push_back(), and Seq< C, R >::rep().

00224 {
00225   self_t r(rep());
00226   r.push_back(x);
00227   return r;
00228 }

Seq< C, R > operator, ( const self_t x  )  const [inline]

Concatenate two sequences.

Definition at line 214 of file Seq.hpp.

References Seq< C, R >::begin(), Seq< C, R >::end(), Seq< C, R >::push_back(), and Seq< C, R >::rep().

00215 {
00216   self_t r(rep());
00217   for(const_iterator it=x.begin(); it!=x.end();++it)
00218     r.push_back(*it);
00219   return r;
00220 }

self_t operator<< ( const self_t s  )  [inline]

Definition at line 178 of file Seq.hpp.

00179   {
00180     for(const_iterator it=s.begin(); it!=s.end();++it) 
00181       this->push_back(*it);
00182     return *this;
00183   }

self_t& operator= ( const Seq< X, S > &  V  )  [inline]

Definition at line 100 of file Seq.hpp.

00100                                            {
00101       using namespace let;
00102      assign(*this,V); 
00103       return *this;}

self_t& operator= ( const self_t V  )  [inline]

Definition at line 98 of file Seq.hpp.

00098 {data=V.data; return *this;}

const value_type& operator[] ( size_type  i  )  const [inline]

Definition at line 107 of file Seq.hpp.

00107 {return rep()[i];}

value_type& operator[] ( size_type  i  )  [inline]

Definition at line 106 of file Seq.hpp.

00106 {return rep()[i];}

self_t& push_back ( const C &  x  )  [inline]
const_reverse_iterator rbegin (  )  const [inline]

Definition at line 93 of file Seq.hpp.

00093 {return rep().rbegin();}

reverse_iterator rbegin (  )  [inline]

Definition at line 91 of file Seq.hpp.

00091 {return rep().rbegin();}

const_reverse_iterator rend (  )  const [inline]

Definition at line 94 of file Seq.hpp.

00094 {return rep().rbegin();}

reverse_iterator rend (  )  [inline]

Definition at line 92 of file Seq.hpp.

00092 {return rep().rend();}

const R& rep (  )  const [inline]

Definition at line 63 of file Seq.hpp.

00063 {return (*data);}

R& rep (  )  [inline]
void resize ( size_type  i  )  [inline]

Definition at line 166 of file Seq.hpp.

Referenced by sub_resultant< PREM >::sequence(), and box_rep< POL >::subdiv_center().

00166 { rep().resize(i); }

void reverse (  )  [inline]

Reverse list.

Definition at line 169 of file Seq.hpp.

Referenced by Seq< Interval< C > >::reverse(), and Seq< Interval< C > >::reversed().

00169 { std::reverse (rep().begin( ), rep().end( ) );  }

self_t reversed (  )  const [inline]

Definition at line 170 of file Seq.hpp.

00170 { self_t s(*this); s.reverse(); return s; }

size_type search ( const C &  x  )  [inline]

Definition at line 120 of file Seq.hpp.

00120                                 {
00121                         for (size_type i=0;i< this->size();++i) {
00122                                         if ( this->rep()[i]== x) 
00123                                                         return i;
00124                         }
00125       //std::cout<<"Seq: "<<x<<" not found"<<std::endl;
00126                         return (size_type(-1) );  
00127   }

size_type size ( void   )  const [inline]

Definition at line 163 of file Seq.hpp.

Referenced by solver_cffirst< Real, POL >::all_roots_isolate(), solver_cffirst< Real, POL >::all_roots_separate(), solver_mv_monomial< FT, POL >::approximate(), solver_mv_fatarcs< C >::box_gen(), cell_mv_bernstein< C >::cell_mv_bernstein(), domain< coeff_t >::center(), mmx::CF_solve(), solver_mv_monomial< FT, POL >::check_root(), mmx::sparse::coefficients(), homography_mv< C >::colapse(), box_rep< POL >::contract_box(), domain< coeff_t >::delta(), domain< coeff_t >::diam(), domain< coeff_t >::dim(), Seq< Interval< C > >::empty(), box_rep< POL >::eval(), mmx::realroot::eval_poly_matrix(), extpts(), Seq< Interval< C > >::front(), mmx::hash(), box_rep< POL >::is_root(), sub_resultant< PREM >::is_zero_seq(), solver_mv_monomial< FT, POL >::isolate(), mmx::realroot::jacobian(), box_rep< POL >::l_bound(), domain< coeff_t >::llc(), Seq< Interval< C > >::member(), cell_mv_bernstein< C >::nbeq(), box_rep< POL >::nbpol(), cell_mv_bernstein< C >::nbvar(), arc_rep< C >::offset(), box_rep< POL >::point(), mmx::polynomial_bernstein_tensor_coefficients(), mmx::polynomial_dual_coefficients(), mmx::polynomial_sparse_coefficients(), mmx::polynomial_sturm_sequence(), mmx::polynomial_tensor_coefficients(), mmx::realroot::precondition(), box_rep< POL >::restrict(), sub_resultant< PREM >::resultant(), box_rep< POL >::reverse_and_shift_box(), box_rep< POL >::reverse_box(), Seq< Interval< C > >::search(), seq2b(), sub_resultant< PREM >::sequence(), box_rep< POL >::shift_box(), mmx::realroot::signof(), homography_mv< C >::size(), cell_mv_bernstein< C >::size(), continued_fraction_subdivision< K >::solve_polynomial(), solver_mv_monomial< FT, POL >::solve_system(), sub_resultant< PREM >::subres_gcd(), mmx::realroot::topological_degree_2d(), box_rep< POL >::update_data(), domain< coeff_t >::urc(), box_rep< POL >::volume(), and box_rep< POL >::width().

00163 {return rep().size();}

void sort ( Compare  comp  )  [inline]

Definition at line 149 of file Seq.hpp.

00149                           {
00150    std::sort( this->rep().begin(), this->rep().end(),comp);
00151   }

void sort (  )  [inline]

Definition at line 136 of file Seq.hpp.

Referenced by Seq< Interval< C > >::sort().

00136                 {
00137         std::sort( this->rep().begin(), this->rep().end() );
00138     }


Member Data Documentation

Definition at line 61 of file Seq.hpp.

Referenced by Seq< Interval< C > >::operator=(), and Seq< Interval< C > >::rep().


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

Generated on 6 Dec 2012 for realroot by  doxygen 1.6.1