MINT2
Public Member Functions | Private Member Functions | List of all members
symMultiPolyTerm Class Reference

#include <symMultiPolyTerm.h>

Inheritance diagram for symMultiPolyTerm:
MINT::PolymorphVector< symPolyTerm >

Public Member Functions

 symMultiPolyTerm (int dimension, int order=0)
 
 symMultiPolyTerm (const symMultiPolyTerm &other)
 
virtual ~symMultiPolyTerm ()
 
void print (std::ostream &os=std::cout) const
 
- Public Member Functions inherited from MINT::PolymorphVector< symPolyTerm >
 PolymorphVector ()
 
 PolymorphVector (unsigned int N)
 
 PolymorphVector (unsigned int N, const symPolyTerm &c)
 
 PolymorphVector (const PolymorphVector &other)
 
 PolymorphVector (const typename std::vector< symPolyTerm > &other)
 
virtual ~PolymorphVector ()
 
std::vector< symPolyTerm > & theVector ()
 
const std::vector< symPolyTerm > & theVector () const
 
symPolyTermoperator[] (unsigned int i)
 
const symPolyTermoperator[] (unsigned int i) const
 
symPolyTermat (unsigned int i)
 
const symPolyTermat (unsigned int i) const
 
std::vector< symPolyTerm >::iterator begin ()
 
std::vector< symPolyTerm >::const_iterator begin () const
 
std::vector< symPolyTerm >::iterator end ()
 
std::vector< symPolyTerm >::const_iterator end () const
 
std::vector< symPolyTerm >::iterator find (const symPolyTerm &c)
 
std::vector< symPolyTerm >::const_iterator find (const symPolyTerm &c) const
 
symPolyTermfront ()
 
const symPolyTermfront () const
 
symPolyTermback ()
 
const symPolyTermback () const
 
unsigned int size () const
 
bool empty () const
 
void push_back (const symPolyTerm &c)
 
void pop_back ()
 
void erase (typename std::vector< symPolyTerm >::iterator pos)
 
void erase (typename std::vector< symPolyTerm >::iterator first, typename std::vector< symPolyTerm >::iterator last)
 
PolymorphVector< symPolyTerm > & operator= (const PolymorphVector< symPolyTerm > &other)
 
void clear ()
 
void resize (unsigned int N)
 
void resize (unsigned int N, const symPolyTerm &c)
 
 operator const typename std::vector< symPolyTerm > & () const
 
 operator typename std::vector< symPolyTerm > & ()
 
bool operator== (const MINT::PolymorphVector< symPolyTerm > &v2) const
 
bool operator!= (const MINT::PolymorphVector< symPolyTerm > &v2) const
 
bool operator< (const MINT::PolymorphVector< symPolyTerm > &v2) const
 
bool operator> (const MINT::PolymorphVector< symPolyTerm > &v2) const
 

Private Member Functions

bool createTerms (int dimension, int order)
 
bool createTerms (int dimension, int order, std::vector< std::vector< int > > &v)
 
bool init (int dimension, int order)
 

Additional Inherited Members

- Protected Attributes inherited from MINT::PolymorphVector< symPolyTerm >
std::vector< symPolyTerm_vec
 

Detailed Description

Definition at line 10 of file symMultiPolyTerm.h.

Constructor & Destructor Documentation

◆ symMultiPolyTerm() [1/2]

symMultiPolyTerm::symMultiPolyTerm ( int  dimension,
int  order = 0 
)

Definition at line 8 of file symMultiPolyTerm.cpp.

10 {
11  init(dimension, order);
12 }
bool init(int dimension, int order)

◆ symMultiPolyTerm() [2/2]

symMultiPolyTerm::symMultiPolyTerm ( const symMultiPolyTerm other)

◆ ~symMultiPolyTerm()

virtual symMultiPolyTerm::~symMultiPolyTerm ( )
inlinevirtual

Definition at line 21 of file symMultiPolyTerm.h.

21 {}

Member Function Documentation

◆ createTerms() [1/2]

bool symMultiPolyTerm::createTerms ( int  dimension,
int  order 
)
private

Definition at line 22 of file symMultiPolyTerm.cpp.

22  {
23  bool dbThis=false;
24 
25  std::vector<std::vector<int> > v;
26  createTerms(dimension, order, v);
27 
28  // next: remove duplicates, where we treat e.g. 32 as 23, i.e. order
29  // does not matter. The symPolyTerm then implements 32 as 32, 23, etc
30  // so what we "contract" here is expanded again there - efficient?
31  // ... probably not, but it follows the logic of the setup better.
32  for(unsigned int i=0; i < v.size(); i++) sort((v[i]).rbegin(), (v[i]).rend());
33  sort(v.rbegin(), v.rend());
34  std::vector< std::vector<int> >::iterator
35  lastUnique = unique(v.begin(), v.end());
36  v.erase(lastUnique, v.end());
37 
38  for(unsigned int j=0; j < v.size(); j++){
39  if(dbThis)cout << v[j] << endl;
40  symPolyTerm spt(v[j]);
41  this->push_back(spt);
42  }
43 
44  return true;
45 
46 }
void push_back(const symPolyTerm &c)
bool createTerms(int dimension, int order)

◆ createTerms() [2/2]

bool symMultiPolyTerm::createTerms ( int  dimension,
int  order,
std::vector< std::vector< int > > &  v 
)
private

Definition at line 47 of file symMultiPolyTerm.cpp.

48  {
49  if(dimension <=0) return true;
50 
51  std::vector<int> p(dimension,0);
52  p[0]=order;
53  v.push_back(p);
54 
55  for(int od = order-1; od > 0; od--){
56  std::vector<int> p(dimension,0);
57  p[0]=od;
58  std::vector<std::vector<int> > v2;
59  createTerms(dimension-1, order - od, v2);
60  for(unsigned int i=0; i < v2.size(); i++){
61  std::vector<int>& p2(p);
62  std::vector<int>& tv2(v2[i]);
63  for(unsigned int k=0; k < tv2.size() && k + 1 < p2.size(); k++){
64  p2[k+1] = tv2[k];
65  }
66  v.push_back(p2);
67  }
68  }
69  return true;
70 }
bool createTerms(int dimension, int order)

◆ init()

bool symMultiPolyTerm::init ( int  dimension,
int  order 
)
private

Definition at line 18 of file symMultiPolyTerm.cpp.

18  {
19  return createTerms(dimension, order);
20 }
bool createTerms(int dimension, int order)

◆ print()

void symMultiPolyTerm::print ( std::ostream &  os = std::cout) const

Definition at line 72 of file symMultiPolyTerm.cpp.

72  {
73  for(unsigned int i=0; i < this->size(); i++){
74  if(0 != i) os << "\n\t + ";
75  else os << "\t";
76 
77  os << (*this)[i];
78  }
79 }

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