pbori_routines_cuddext.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_routines_pbori_routines_cuddext_h_
#define polybori_routines_pbori_routines_cuddext_h_
// include basic definitions
#include <polybori/pbori_defs.h>
#include <map>
BEGIN_NAMESPACE_PBORI
template<class MapType, class NaviType>
inline typename MapType::mapped_type
dd_long_count_step(MapType& cache, NaviType navi) {
if(navi.isConstant())
return navi.terminalValue();
{
typename MapType::iterator iter = cache.find(navi);
if (iter != cache.end())
return iter->second;
}
return cache[navi] =
dd_long_count_step(cache, navi.thenBranch()) +
dd_long_count_step(cache, navi.elseBranch());
}
template <class IntType, class NaviType>
inline IntType
dd_long_count(NaviType navi) {
std::map<NaviType, IntType> local_cache;
return dd_long_count_step(local_cache, navi);
}
template <class IntType, class NaviType>
inline IntType
dd_long_count_without_cache(NaviType navi) {
if(navi.isConstant())
return navi.terminalValue();
return dd_long_count<IntType, NaviType>(navi.thenBranch()) +
dd_long_count<IntType, NaviType>(navi.elseBranch());
}
END_NAMESPACE_PBORI
#endif
END_NAMESPACE_PBORI
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
polybori::dd_long_count_without_cache
IntType dd_long_count_without_cache(NaviType navi)
Definition: pbori_routines_cuddext.h:58
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::dd_long_count
IntType dd_long_count(NaviType navi)
Function template for generically computing number of terms.
Definition: pbori_routines_cuddext.h:51
pbori_defs.h
polybori::dd_long_count_step
MapType::mapped_type dd_long_count_step(MapType &cache, NaviType navi)
Other routines currently at external public header file pbori_algo.h.
Definition: pbori_routines_cuddext.h:32