File DensityComputeTable.hpp

Compute table for caching results of density-matrix operations.

Self-contained copy of the MQT Core dd::ComputeTable that keeps the density-matrix specific hashing (accounting for the temporary flags encoded in the node pointer) and the useDensityMatrix discrimination on lookup. Both are required for the correctness of the reduced density-matrix representation.

namespace dd
namespace ddsim
template<class LeftOperandType, class RightOperandType, class ResultType>
class DensityComputeTable
#include <DensityComputeTable.hpp>

Data structure for caching computed results of binary operations on density-matrix DDs.

Public Functions

inline explicit DensityComputeTable(const std::size_t numBuckets = DEFAULT_NUM_BUCKETS)
inline std::size_t hash(const LeftOperandType &leftOperand, const RightOperandType &rightOperand) const
inline const auto &getTable() const
inline const auto &getStats() const noexcept
inline void insert(const LeftOperandType &leftOperand, const RightOperandType &rightOperand, const ResultType &result)
inline ResultType *lookup(const LeftOperandType &leftOperand, const RightOperandType &rightOperand, const bool useDensityMatrix = false)
inline void clear()
inline std::ostream &printStatistics(std::ostream &os = std::cout) const

Public Static Attributes

static constexpr std::size_t DEFAULT_NUM_BUCKETS = 16384U

Private Members

std::vector<Entry> table
std::vector<bool> valid
dd::TableStatistics stats = {}
struct Entry

Public Members

LeftOperandType leftOperand
RightOperandType rightOperand
ResultType result