File DensityUniqueTable.hpp

Unique table for density-matrix DD nodes.

Self-contained copy of the relevant parts of the MQT Core dd::UniqueTable, specialized for the density-matrix node type dd::ddsim::dNode. Unlike the (post-removal) Core unique table, the node equality check accounts for the persistent density-matrix flag, which is required for the correctness of the reduced density-matrix representation.

namespace dd
namespace ddsim
class DensityUniqueTable
#include <DensityUniqueTable.hpp>

Data structure for uniquely storing density-matrix DD nodes.

Public Functions

DensityUniqueTable(dd::MemoryManager &manager, const UniqueTableConfig &config)
void resize(std::size_t nVars)
inline std::size_t hash(const dNode &p) const
inline dNode *lookup(dNode *p)
inline const auto &getTables() const
inline const auto &getStats() const noexcept
const dd::UniqueTableStatistics &getStats(std::size_t idx) const noexcept
std::size_t getNumEntries() const noexcept
std::size_t countMarkedEntries() const noexcept
bool possiblyNeedsCollection() const
std::size_t garbageCollect(bool force = false)
void clear()

Public Static Functions

static inline bool nodesAreEqual(const dNode &p, const dNode &q)

Public Static Attributes

static constexpr std::size_t INITIAL_GC_LIMIT = 131072U

Private Types

using Bucket = dd::NodeBase*
using Table = std::vector<Bucket>

Private Functions

inline dNode *searchTable(dNode &p, const std::size_t &key)

Private Members

UniqueTableConfig cfg
std::size_t gcLimit
dd::MemoryManager *memoryManager
std::vector<Table> tables
std::vector<dd::UniqueTableStatistics> stats
struct UniqueTableConfig

Public Members

std::size_t nVars = 0U
std::size_t nBuckets = 32768
std::size_t initialGCLimit = INITIAL_GC_LIMIT