monomials< C > Struct Template Reference

#include <vector_monomials.hpp>

List of all members.

Public Types

Public Member Functions

Public Attributes


Detailed Description

template<class C>
struct mmx::univariate::monomials< C >

Array polynomial representation, as a subclass of linalg::rep1d<C>.

Definition at line 54 of file vector_monomials.hpp.


Member Typedef Documentation

typedef C coeff_t

Definition at line 62 of file vector_monomials.hpp.

Definition at line 59 of file vector_monomials.hpp.

typedef std::reverse_iterator<const_iterator> const_reverse_iterator

Definition at line 60 of file vector_monomials.hpp.

typedef C* iterator

Definition at line 58 of file vector_monomials.hpp.

typedef std::reverse_iterator<iterator> reverse_iterator

Definition at line 61 of file vector_monomials.hpp.

typedef unsigned int size_type

Definition at line 57 of file vector_monomials.hpp.

typedef C value_type

Definition at line 56 of file vector_monomials.hpp.


Constructor & Destructor Documentation

monomials (  )  [inline]

Definition at line 68 of file vector_monomials.hpp.

00068 : tab_(0), size_(0), degree_(-1) {}

monomials ( const C &  c  )  [inline]

Definition at line 116 of file vector_monomials.hpp.

References C, and monomials< C >::tab_.

00116                                  : size_(1), degree_(0) {
00117     tab_ = new C[1];
00118     tab_[0]=c;
00119   }

monomials ( const C &  c,
size_type  d,
int  v = 0 
) [inline]

Definition at line 121 of file vector_monomials.hpp.

References C, and monomials< C >::tab_.

00121                                                      : size_(l+1), degree_(l) {
00122     tab_ = new C[l+1];
00123     for (size_type i = 0; i < l; i++) tab_[i]=C(0);
00124     tab_[l]=c;
00125   }

monomials ( const size_type s,
C *  t 
) [inline]

Definition at line 128 of file vector_monomials.hpp.

References C, mmx::univariate::check_degree(), and monomials< C >::tab_.

00128                                                : size_(i), degree_(i-1) {
00129     tab_ = new C[i];
00130     for(size_type l=0;l<i;l++) tab_[l] = t[l];
00131     check_degree(*this);
00132   }

monomials ( const size_type s,
const char *  t 
) [inline]

Definition at line 146 of file vector_monomials.hpp.

References C, mmx::univariate::check_degree(), monomials< C >::degree_, monomials< C >::size_, and monomials< C >::tab_.

00146                                                            {
00147     std::istringstream ins(nm);
00148     size_=l;
00149     tab_ = new C[size_];
00150     for(size_type i=0; i< size_; i++) ins >>tab_[i];
00151     degree_=l-1;
00152     check_degree(*this);
00153   }

monomials ( C *  b,
C *  e 
) [inline]

Definition at line 135 of file vector_monomials.hpp.

References C, mmx::univariate::check_degree(), monomials< C >::degree_, monomials< C >::size_, and monomials< C >::tab_.

00135                                   {
00136     size_=0; C* p;
00137     for(p=b;p!=e;p++,size_++) ;
00138     tab_ = new C[size_];
00139     degree_=0;
00140     for(p=b; p!=e; p++,degree_++) {tab_[degree_]=(*p);}
00141     check_degree(*this);
00142   }

monomials ( const monomials< C > &  p  )  [inline]

Definition at line 110 of file vector_monomials.hpp.

References C, and monomials< C >::tab_.

00110                                             : size_(v.size_), degree_(v.degree_) {
00111     tab_ = new C[v.size_]; 
00112     for(size_type i=0;i<v.size_;i++) {tab_[i] = v[i];}
00113   }

~monomials (  )  [inline]

Definition at line 77 of file vector_monomials.hpp.

References monomials< C >::tab_.

00077 { delete[] tab_;}


Member Function Documentation

const_iterator begin (  )  const [inline]

Definition at line 80 of file vector_monomials.hpp.

References monomials< C >::tab_.

00080 {return const_iterator(tab_); }

iterator begin (  )  [inline]

Definition at line 79 of file vector_monomials.hpp.

References monomials< C >::tab_.

00079 {return iterator(tab_); }

unsigned degree (  )  const [inline]

Definition at line 95 of file vector_monomials.hpp.

References monomials< C >::degree_.

Referenced by monomials< C >::operator==().

00095 { return degree_;}

const_iterator end (  )  const [inline]

Definition at line 82 of file vector_monomials.hpp.

References monomials< C >::degree_, and monomials< C >::tab_.

00082 {return const_iterator(this->tab_+degree_+1); }

iterator end (  )  [inline]

Definition at line 81 of file vector_monomials.hpp.

References monomials< C >::degree_, and monomials< C >::tab_.

00081 {return iterator(this->tab_+degree_+1); }

monomials< C > & operator= ( const monomials< C > &  v  )  [inline]

Definition at line 174 of file vector_monomials.hpp.

References C, monomials< C >::degree_, monomials< C >::size_, and monomials< C >::tab_.

00174                                             {
00175     if (size_ != v.size_) {
00176       if (size_ !=0) delete [] tab_;
00177       tab_ = new C[v.size_];
00178       size_ = v.size_;
00179     }
00180     degree_=v.degree_;
00181     for(size_type i=0;i<size_;i++) tab_[i] = v[i];
00182     return *this;
00183   }

bool operator== ( const C &  c  )  const [inline]

Definition at line 186 of file vector_monomials.hpp.

References monomials< C >::degree(), and monomials< C >::tab_.

00186                                           {
00187     if(c==0)
00188       return (this->degree()<0);
00189     else
00190       return (this->degree()==0 && tab_[0]== c);
00191   }

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

Definition at line 100 of file vector_monomials.hpp.

References C, and monomials< C >::tab_.

00100 {return tab_[i];}

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

Definition at line 99 of file vector_monomials.hpp.

References C, and monomials< C >::tab_.

00099 {return tab_[i];}

const_reverse_iterator rbegin (  )  const [inline]

Definition at line 90 of file vector_monomials.hpp.

References monomials< C >::degree_, and monomials< C >::tab_.

00090                                           {
00091       return const_reverse_iterator(this->tab_+degree_+1); 
00092     }

reverse_iterator rbegin (  )  [inline]

Definition at line 87 of file vector_monomials.hpp.

References monomials< C >::degree_, and monomials< C >::tab_.

00087                                     {
00088       return reverse_iterator(this->tab_+degree_+1); 
00089     }

const_reverse_iterator rend (  )  const [inline]

Definition at line 85 of file vector_monomials.hpp.

References monomials< C >::tab_.

00085 {return reverse_iterator(tab_); }

reverse_iterator rend (  )  [inline]

Definition at line 84 of file vector_monomials.hpp.

References monomials< C >::tab_.

00084 {return reverse_iterator(tab_); }

void resize ( const size_type n  )  [inline]

Definition at line 156 of file vector_monomials.hpp.

References C, monomials< C >::degree_, mmx::min(), monomials< C >::size_, and monomials< C >::tab_.

00156                                         {
00157     if(size_!=i){
00158       if (size_ != 0) {
00159         C* tmp = tab_;
00160         tab_ = new C[i];
00161         for(size_type j=0;j<std::min(i,size_);j++) tab_[j]=tmp[j];
00162         for(size_type j=std::min(i,size_);j<i;j++) tab_[j]=value_type();
00163         size_=i;
00164         delete [] tmp;      
00165       } else {
00166         size_=i; tab_= new C[i];
00167         for(size_type j=0;j<size_;j++) tab_[j]=value_type();
00168       }
00169     }
00170     degree_=i-1;
00171   }

unsigned size ( void   )  const [inline]

Definition at line 94 of file vector_monomials.hpp.

References monomials< C >::size_.

00094 { return size_;}


Member Data Documentation

int degree_
C* tab_

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

Generated on 6 Dec 2012 for realroot by  doxygen 1.6.1