| 1 | // -*- c++ -*-cxx . . $ `<file>/libbrial/include/polybori/routines/pbori_routines_dd.h`/ |
| 2 | //***************************************************************************** |
| 3 | /** @file pbori_routines_dd.h |
| 4 | * |
| 5 | * @author Alexander Dreyer |
| 6 | * @date 2006-08-23 |
| 7 | * |
| 8 | * This file includes files, which define function templates related to |
| 9 | * decision diagrams. It should be loaded from pbori_routines.h only |
| 10 | * |
| 11 | * @par Copyright: |
| 12 | * (c) 2006 by The PolyBoRi Team |
| 13 | **/ |
| 14 | //***************************************************************************** |
| 15 | |
| 16 | #ifndef polybori_routines_pbori_routines_dd_h_ |
| 17 | #define polybori_routines_pbori_routines_dd_h_cxx . . $ `libbrial/include/polybori/routines/pbori_routines_dd.h:17:9`! |
| 18 | |
| 19 | // include basic definitions |
| 20 | #include <polybori/pbori_defs.h>cxx . . $ `<file>/libbrial/include/polybori/pbori_defs.h`/ |
| 21 | |
| 22 | // get addition definitions |
| 23 | #include <polybori/iterators/CTermIter.h>cxx . . $ `<file>/libbrial/include/polybori/iterators/CTermIter.h`/ |
| 24 | #include <polybori/iterators/PBoRiOutIter.h>cxx . . $ `<file>/libbrial/include/polybori/iterators/PBoRiOutIter.h`/ |
| 25 | #include <set> |
| 26 | #include <vector> |
| 27 | |
| 28 | BEGIN_NAMESPACE_PBORIcxx . . $ `libbrial/include/polybori/pbori_defs.h:74:11`! |
| 29 | |
| 30 | /// Get last term (wrt. lexicographical order). |
| 31 | template<class DDType, class OutputType> |
| 32 | OutputType |
| 33 | dd_last_lexicographical_termcxx . . $ polybori/dd_last_lexicographical_term(13656a65dc3d6573).(const DDType& dd, type_tagcxx . . $ polybori/type_tag#<OutputType>) { |
| 34 | |
| 35 | typedef typename DDType::idx_type idx_typecxx . . $ polybori/dd_last_lexicographical_term(13656a65dc3d6573).idx_type#; |
| 36 | typedef typename DDType::size_type size_typecxx . . $ polybori/dd_last_lexicographical_term(13656a65dc3d6573).size_type#; |
| 37 | typedef OutputType term_typecxx . . $ polybori/dd_last_lexicographical_term(13656a65dc3d6573).term_type#; |
| 38 | |
| 39 | term_typecxx . . $ polybori/dd_last_lexicographical_term(13656a65dc3d6573).term_type# result(dd.ring()); |
| 40 | |
| 41 | PBORI_ASSERTcxx . . $ `libbrial/include/polybori/pbori_defs.h:118:9`!(!dd.isZero()); |
| 42 | |
| 43 | size_typecxx . . $ polybori/dd_last_lexicographical_term(13656a65dc3d6573).size_type# nlen = stdcxx . . $ std/::distancecxx . . $ std/distance(4883b9d540cf40e9).(dd.lastBegin(), dd.lastEnd()); |
| 44 | |
| 45 | // store indices in list |
| 46 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<idx_typecxx . . $ polybori/dd_last_lexicographical_term(13656a65dc3d6573).idx_type#> indices(nlen); |
| 47 | |
| 48 | // iterator, which uses changeAssign to insert variable |
| 49 | // wrt. given indices to a monomial |
| 50 | PBoRiOutItercxx . . $ polybori/PBoRiOutIter#<term_typecxx . . $ polybori/dd_last_lexicographical_term(13656a65dc3d6573).term_type#, idx_typecxx . . $ polybori/dd_last_lexicographical_term(13656a65dc3d6573).idx_type#, change_assigncxx . . $ polybori/change_assign#<term_typecxx . . $ polybori/dd_last_lexicographical_term(13656a65dc3d6573).term_type#> > |
| 51 | outiter(result); |
| 52 | |
| 53 | // insert backward (for efficiency reasons) |
| 54 | reversed_inter_copycxx . . $ polybori/reversed_inter_copy(21170c508d3a9395).(dd.lastBegin(), dd.lastEnd(), indices, outiter); |
| 55 | |
| 56 | return result; |
| 57 | } |
| 58 | |
| 59 | |
| 60 | END_NAMESPACE_PBORIcxx . . $ `libbrial/include/polybori/pbori_defs.h:77:11`! |
| 61 | |
| 62 | #endif |