monomials< C > Struct Template Reference

#include <tensor_monomials.hpp>

Inheritance diagram for monomials< C >:
bernstein< C >

List of all members.

Public Types

Public Member Functions

Public Attributes

Static Public Attributes


Detailed Description

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

Definition at line 18 of file tensor_monomials.hpp.


Member Typedef Documentation

typedef C coeff_t

Definition at line 20 of file tensor_monomials.hpp.

typedef const C* const_iterator

Reimplemented in bernstein< C >.

Definition at line 25 of file tensor_monomials.hpp.

typedef std::reverse_iterator<const_iterator> const_reverse_iterator

Definition at line 27 of file tensor_monomials.hpp.

typedef C* iterator

Reimplemented in bernstein< C >.

Definition at line 23 of file tensor_monomials.hpp.

typedef std::reverse_iterator<iterator> reverse_iterator

Definition at line 26 of file tensor_monomials.hpp.

typedef vector_type::size_type size_type

Reimplemented in bernstein< C >.

Definition at line 28 of file tensor_monomials.hpp.

Reimplemented in bernstein< C >.

Definition at line 29 of file tensor_monomials.hpp.

typedef std::vector<C> vector_type

Reimplemented in bernstein< C >.

Definition at line 21 of file tensor_monomials.hpp.


Constructor & Destructor Documentation

monomials (  )  [inline]

Definition at line 22 of file tensor_monomials_fcts.hpp.

References C.

00022                               {
00023     //   int szs = 1; new (this) monomials (1, &szs); data[0] = (C)0; 
00024     int *szs = new int, *vrs= new int;
00025     szs[0] = 1;
00026     vrs[0] = 0;
00027     env = eenv(1, szs, vrs);
00028     data = vector_type (env.sz(),(C)0);
00029     data[0] = (C)0; 
00030   }

monomials ( const C &  x  )  [inline]

Definition at line 73 of file tensor_monomials_fcts.hpp.

References C.

00074   { int szs = 1; new (this) monomials (1, &szs); data[0] = x; }

monomials ( const C &  c,
int  d,
unsigned  v 
) [inline]

Definition at line 55 of file tensor_monomials_fcts.hpp.

References assert, and C.

00056   {
00057     assert(d>=0);
00058     int *szs = new int, *vrs= new int;
00059     szs[0] = d+1;
00060     vrs[0] = v;
00061     env = eenv(1, szs, vrs);
00062     data = vector_type (env.sz(),(C)0);
00063     data[env.sz()-1]= c;
00064   }

monomials ( int  v,
int  d 
) [inline]

Definition at line 44 of file tensor_monomials_fcts.hpp.

References C.

00045   {
00046     int *szs = new int, *vrs= new int;
00047     szs[0] = d+1;
00048     vrs[0] = v;
00049     env = eenv(1, szs, vrs);
00050     data = vector_type (env.sz(),(C)0);
00051     data[env.sz()-1]= 1;
00052   }

monomials ( const sparse::monomial_seq< X, O > &  imp  )  [inline]

Definition at line 380 of file tensor_monomials_fcts.hpp.

References C, and mmx::tensor::mpolfill().

00381   {
00382     env= eenv(imp);
00383     data= vector_type(env.sz (), (C)0);
00384     //    const int *vr = this->vrs ();
00385     //    const int *st = this->str ();
00386     //    const int  nvr = this->nvr();
00387     //    C *data = this->begin ();
00388     mpolfill(this->begin(),imp,env);
00389   };

monomials ( const eenv e  )  [inline]

Definition at line 32 of file tensor_monomials_fcts.hpp.

00032                                              :env (e), data (e.sz ()) {}
00033   {
00034     env = e;
00035     data = vector_type (e.sz());
00036   };

monomials ( const eenv e,
const C &  c 
) [inline]

Definition at line 38 of file tensor_monomials_fcts.hpp.

References C.

00038                                                           :env(e),data (e.sz (), c) {};
00039   {
00040     env = e;
00041     data = vector_type (e.sz(),c);
00042   };

monomials ( int  nvr,
const int *  szs,
const int *  vrs = 0 
) [inline]

Definition at line 67 of file tensor_monomials_fcts.hpp.

References C.

00067                                                                        :env (nvr, szs, vrs),data (env.sz(),(C)0)
00068   {
00069     env = eenv(nvr, szs, vrs);
00070     data = vector_type (env.sz(),(C)0);
00071   };


Member Function Documentation

const_iterator begin (  )  const [inline]

Definition at line 50 of file tensor_monomials.hpp.

References monomials< C >::data.

00050 { return &(data[0]); };

C* begin (  )  [inline]
const_iterator end (  )  const [inline]

Definition at line 51 of file tensor_monomials.hpp.

References monomials< C >::data, and monomials< C >::esz().

00051 { return &(data[esz()]); };

C* end (  )  [inline]

Definition at line 48 of file tensor_monomials.hpp.

References C, monomials< C >::data, and monomials< C >::esz().

Referenced by mmx::tensor::cfdump(), mmx::tensor::clear(), and mmx::tensor::eval().

00048 { return &(data[0])+esz(); };

const C entry ( std::vector< int >  deg  )  [inline]

Definition at line 479 of file tensor_monomials_fcts.hpp.

References C, monomials< C >::data, monomials< C >::nvr(), monomials< C >::str(), monomials< C >::szs(), and monomials< C >::vrs().

00480     {
00481         int * vvrs = vrs();
00482         int * sstr = str();
00483         int * sszs = szs() ;
00484 
00485         int i,pos=0;
00486         for (i = 0; i < nvr() ; ++i)
00487         {
00488             std::cout<<"entry:" <<deg[i] << std::endl;
00489             if (deg[i] >= sszs[ vvrs[i] ] || deg[i]<0 ) return C(0); 
00490             pos += deg[i]*sstr[ vvrs[i] ];
00491         }
00492         return data[pos];
00493     }

int esz (  )  const [inline]
bool hasvar ( int &  lv,
int  gv 
) const
int nbvar (  )  const [inline]

Definition at line 73 of file tensor_monomials.hpp.

References monomials< C >::env, and eenv::nvr().

Referenced by mmx::tensor::degree().

00073 { return env.nvr(); };

int nvr (  )  const [inline]
bool operator== ( const monomials< C > &  mpl  )  const [inline]

Reimplemented in bernstein< C >.

Definition at line 104 of file tensor_monomials_fcts.hpp.

References eenv::equal(), and eenv::oaddress().

00105   {
00106     if (!eenv::equal (env, mpl.env))
00107       return false;
00108     unsigned *oadd = new unsigned[esz ()];
00109     eenv::oaddress (env, oadd, mpl.env, 0, 0);
00110     for (int i = 0; i < esz (); i++)
00111       if (data[i] != mpl[oadd[i]])
00112         {
00113           delete[]oadd;
00114           return false;
00115         };
00116     delete[]oadd;
00117     return true;
00118   };

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

Reimplemented in bernstein< C >.

Definition at line 85 of file tensor_monomials.hpp.

References monomials< C >::data, and monomials< C >::esz().

00085                                         { 
00086       return esz() == 1 && data[0] == c; }

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

Reimplemented in bernstein< C >.

Definition at line 83 of file tensor_monomials.hpp.

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

00083 { return data[i]; };

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

Reimplemented in bernstein< C >.

Definition at line 82 of file tensor_monomials.hpp.

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

00082 { return data[i]; };

const_reverse_iterator rbegin (  )  const [inline]

Definition at line 58 of file tensor_monomials.hpp.

References monomials< C >::data, and monomials< C >::esz().

00058                    {
00059       return const_reverse_iterator(&(data[0])+esz()); 
00060     }

reverse_iterator rbegin (  )  [inline]

Definition at line 54 of file tensor_monomials.hpp.

References monomials< C >::data, and monomials< C >::esz().

00054                    {
00055       return reverse_iterator(&(data[0])+esz()); 
00056     }

const_reverse_iterator rend (  )  const [inline]

Definition at line 66 of file tensor_monomials.hpp.

References monomials< C >::data.

00066                    {
00067       return const_reverse_iterator(&(data[0])); 
00068     }

reverse_iterator rend (  )  [inline]

Definition at line 62 of file tensor_monomials.hpp.

References monomials< C >::data.

00062                    {
00063       return reverse_iterator(&(data[0])); 
00064     }

void resize ( int  l  )  [inline]

Definition at line 46 of file tensor_monomials.hpp.

00046 {};

int size ( void   )  const [inline]
const int* str (  )  const [inline]

Definition at line 80 of file tensor_monomials.hpp.

References monomials< C >::env, and eenv::str().

00080 { return env.str(); };

int* str (  )  [inline]
void swap ( monomials< C > &  a  )  [inline]

Definition at line 88 of file tensor_monomials.hpp.

References monomials< C >::data, and monomials< C >::env.

Referenced by mmx::tensor::clear(), mmx::tensor::extend(), mmx::tensor::mul(), and mmx::tensor::realloc().

00088 { std::swap(env,a.env); data.swap(a.data); };    

const int* szs (  )  const [inline]

Definition at line 78 of file tensor_monomials.hpp.

References monomials< C >::env, and eenv::szs().

00078 { return env.szs(); };

int* szs (  )  [inline]
const int* vrs (  )  const [inline]

Definition at line 79 of file tensor_monomials.hpp.

References monomials< C >::env, and eenv::vrs().

00079 { return env.vrs(); };

int* vrs (  )  [inline]

Member Data Documentation

binomials<C> binoms [static]

Definition at line 30 of file tensor_monomials.hpp.


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

Generated on 6 Dec 2012 for realroot by  doxygen 1.6.1