PolyBoRi
pbori_routines_dd.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_routines_pbori_routines_dd_h_
17 #define polybori_routines_pbori_routines_dd_h_
18 
19 // include basic definitions
20 #include <polybori/pbori_defs.h>
21 
22 // get addition definitions
25 #include <set>
26 #include <vector>
27 
29 
31 template<class DDType, class OutputType>
32 OutputType
34 
35  typedef typename DDType::idx_type idx_type;
36  typedef typename DDType::size_type size_type;
37  typedef OutputType term_type;
38 
39  term_type result(dd.ring());
40 
41  PBORI_ASSERT(!dd.isZero());
42 
43  size_type nlen = std::distance(dd.lastBegin(), dd.lastEnd());
44 
45  // store indices in list
46  std::vector<idx_type> indices(nlen);
47 
48  // iterator, which uses changeAssign to insert variable
49  // wrt. given indices to a monomial
51  outiter(result);
52 
53  // insert backward (for efficiency reasons)
54  reversed_inter_copy(dd.lastBegin(), dd.lastEnd(), indices, outiter);
55 
56  return result;
57 }
58 
59 
61 
62 #endif