MQT Core
The Backbone of the Munich Quantum Toolkit (MQT)
Loading...
Searching...
No Matches
dd::CachedEdge< Node > Struct Template Reference

A DD node with a cached edge weight. More...

#include <CachedEdge.hpp>

Public Member Functions

 CachedEdge ()=default
 CachedEdge (Node *n, const ComplexValue &v)
 CachedEdge (Node *n, const Complex &c)
bool operator== (const CachedEdge &other) const
 Compares node pointers and approximately compares the weights.
bool operator!= (const CachedEdge &other) const
constexpr bool isTerminal () const
 Check whether this is a terminal.

Static Public Member Functions

static constexpr CachedEdge terminal (const ComplexValue &w)
 Create a terminal edge with the given weight.
static constexpr CachedEdge terminal (const std::complex< fp > &w)
 Create a terminal edge with the given weight.
static constexpr CachedEdge terminal (const Complex &w)
 Create a terminal edge with the given weight.
static constexpr CachedEdge zero ()
 Create a zero terminal edge.
static constexpr CachedEdge one ()
 Create a one terminal edge.

Public Attributes

Node * p {}
ComplexValue w

Detailed Description

template<typename Node>
struct dd::CachedEdge< Node >

A DD node with a cached edge weight.

Some DD operations create intermediate results that are not part of the final result. To avoid storing these intermediate results in the unique table, they are represented via cached numbers.

Template Parameters
NodeType of the DD node

Constructor & Destructor Documentation

◆ CachedEdge() [1/3]

template<typename Node>
dd::CachedEdge< Node >::CachedEdge ( )
default

◆ CachedEdge() [2/3]

template<typename Node>
dd::CachedEdge< Node >::CachedEdge ( Node * n,
const ComplexValue & v )
inline

◆ CachedEdge() [3/3]

template<typename Node>
dd::CachedEdge< Node >::CachedEdge ( Node * n,
const Complex & c )
inline

Member Function Documentation

◆ operator==()

template<typename Node>
bool dd::CachedEdge< Node >::operator== ( const CachedEdge< Node > & other) const
inline

Compares node pointers and approximately compares the weights.

Weight comparison uses a tolerance to account for floating-point error.

◆ operator!=()

template<typename Node>
bool dd::CachedEdge< Node >::operator!= ( const CachedEdge< Node > & other) const
inline

◆ terminal() [1/3]

template<typename Node>
constexpr CachedEdge dd::CachedEdge< Node >::terminal ( const ComplexValue & w)
inlinestaticnodiscardconstexpr

Create a terminal edge with the given weight.

Parameters
wThe weight of the terminal edge.
Returns
A terminal edge with the given weight.

◆ terminal() [2/3]

template<typename Node>
constexpr CachedEdge dd::CachedEdge< Node >::terminal ( const std::complex< fp > & w)
inlinestaticnodiscardconstexpr

Create a terminal edge with the given weight.

Parameters
wThe weight of the terminal edge.
Returns
A terminal edge with the given weight.

◆ terminal() [3/3]

template<typename Node>
constexpr CachedEdge dd::CachedEdge< Node >::terminal ( const Complex & w)
inlinestaticnodiscardconstexpr

Create a terminal edge with the given weight.

Parameters
wThe weight of the terminal edge.
Returns
A terminal edge with the given weight.

◆ zero()

template<typename Node>
constexpr CachedEdge dd::CachedEdge< Node >::zero ( )
inlinestaticnodiscardconstexpr

Create a zero terminal edge.

Returns
A zero terminal edge.

◆ one()

template<typename Node>
constexpr CachedEdge dd::CachedEdge< Node >::one ( )
inlinestaticnodiscardconstexpr

Create a one terminal edge.

Returns
A one terminal edge.

◆ isTerminal()

template<typename Node>
bool dd::CachedEdge< Node >::isTerminal ( ) const
inlinenodiscardconstexpr

Check whether this is a terminal.

Returns
whether this is a terminal

Member Data Documentation

◆ p

template<typename Node>
Node* dd::CachedEdge< Node >::p {}

◆ w

template<typename Node>
ComplexValue dd::CachedEdge< Node >::w