Maestro 0.3.11
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
TensorNetworks::ForestContractor Class Reference

Greedy, memory-first contraction with incremental candidates and plan reuse. More...

#include <ForestContractor.h>

Inheritance diagram for TensorNetworks::ForestContractor:
Collaboration diagram for TensorNetworks::ForestContractor:

Public Types

using TensorsMap = ITensorContractor::TensorsMap

Public Member Functions

virtual ~ForestContractor ()=default
void ClearPlanCache ()
std::shared_ptr< ITensorContractor > Clone () const override
 Clone the tensor contractor.
double Contract (const TensorNetwork &network, Types::qubit_t qubit) override
 Contract the tensor network.
template<class PassedTensorsMap = TensorsMap>
Eigen::Index ContractNodes (Types::qubit_t qubit, PassedTensorsMap &tensors, Eigen::Index tensor1Id, Eigen::Index tensor2Id, Eigen::Index resultRank)
size_t GetCachedPlanBytes () const
size_t GetCachedPlanCount () const
size_t GetMaxTensorRank () const override
bool GetMultithreading () const override
 Get the multithreading flag.
size_t GetPlanCacheByteLimit () const
size_t GetPlanCacheHits () const
size_t GetPreparedPlanCount () const
size_t GetWorkspaceByteLimit () const
size_t GetWorkspaceBytes () const
TensorsMap InitializeTensors (const TensorNetwork &network, Types::qubit_t qubit, std::vector< Eigen::Index > &keys, std::unordered_map< Eigen::Index, Eigen::Index > &keysKeys, bool fillKeys=true, bool contract=true) override
void SetMultithreading (bool multithreading=true) override
 Enable/disable multithreading.
void SetPlanCacheByteLimit (size_t bytes)
void SetWorkspaceByteLimit (size_t bytes)

Static Public Member Functions

static size_t GetResultRank (const std::shared_ptr< TensorNode > &tensor1, const std::shared_ptr< TensorNode > &tensor2)

Protected Attributes

bool enableMultithreading = true
 A flag to indicate if multithreading should be enabled.
size_t maxTensorRank = 0
 The maximum rank of the tensors in the network.

Detailed Description

Greedy, memory-first contraction with incremental candidates and plan reuse.

Definition at line 35 of file ForestContractor.h.

Member Typedef Documentation

◆ TensorsMap

Constructor & Destructor Documentation

◆ ~ForestContractor()

virtual TensorNetworks::ForestContractor::~ForestContractor ( )
virtualdefault

Member Function Documentation

◆ ClearPlanCache()

void TensorNetworks::ForestContractor::ClearPlanCache ( )
inline

Definition at line 216 of file ForestContractor.h.

◆ Clone()

std::shared_ptr< ITensorContractor > TensorNetworks::ForestContractor::Clone ( ) const
inlineoverridevirtual

Clone the tensor contractor.

Returns
A shared pointer to the cloned tensor contractor.

Implements TensorNetworks::ITensorContractor.

Definition at line 224 of file ForestContractor.h.

References TensorNetworks::BaseContractor::enableMultithreading, and TensorNetworks::BaseContractor::maxTensorRank.

◆ Contract()

double TensorNetworks::ForestContractor::Contract ( const TensorNetwork & network,
Types::qubit_t qubit )
inlineoverridevirtual

Contract the tensor network.

Parameters
Distributed Quantum ComputingThe tensor network to contract.
Returns
The result of the contraction.

Implements TensorNetworks::ITensorContractor.

Definition at line 40 of file ForestContractor.h.

References TensorNetworks::BaseContractor::ContractNodes(), TensorNetworks::TensorNetwork::GetQubitGroup(), TensorNetworks::TensorNetwork::GetTensors(), and TensorNetworks::BaseContractor::maxTensorRank.

◆ ContractNodes()

template<class PassedTensorsMap = TensorsMap>
Eigen::Index TensorNetworks::BaseContractor::ContractNodes ( Types::qubit_t qubit,
PassedTensorsMap & tensors,
Eigen::Index tensor1Id,
Eigen::Index tensor2Id,
Eigen::Index resultRank )
inlineinherited

◆ GetCachedPlanBytes()

size_t TensorNetworks::ForestContractor::GetCachedPlanBytes ( ) const
inline

Definition at line 177 of file ForestContractor.h.

◆ GetCachedPlanCount()

size_t TensorNetworks::ForestContractor::GetCachedPlanCount ( ) const
inline

Definition at line 182 of file ForestContractor.h.

◆ GetMaxTensorRank()

size_t TensorNetworks::BaseContractor::GetMaxTensorRank ( ) const
inlineoverridevirtualinherited

Implements TensorNetworks::ITensorContractor.

Definition at line 254 of file BaseContractor.h.

References maxTensorRank.

◆ GetMultithreading()

bool TensorNetworks::BaseContractor::GetMultithreading ( ) const
inlineoverridevirtualinherited

Get the multithreading flag.

Returns the multithreading flag.

Returns
The multithreading flag.

Implements TensorNetworks::ITensorContractor.

Definition at line 279 of file BaseContractor.h.

References enableMultithreading.

◆ GetPlanCacheByteLimit()

size_t TensorNetworks::ForestContractor::GetPlanCacheByteLimit ( ) const
inline

Definition at line 172 of file ForestContractor.h.

◆ GetPlanCacheHits()

size_t TensorNetworks::ForestContractor::GetPlanCacheHits ( ) const
inline

Definition at line 187 of file ForestContractor.h.

◆ GetPreparedPlanCount()

size_t TensorNetworks::ForestContractor::GetPreparedPlanCount ( ) const
inline

Definition at line 192 of file ForestContractor.h.

◆ GetResultRank()

size_t TensorNetworks::BaseContractor::GetResultRank ( const std::shared_ptr< TensorNode > & tensor1,
const std::shared_ptr< TensorNode > & tensor2 )
inlinestaticinherited

◆ GetWorkspaceByteLimit()

size_t TensorNetworks::ForestContractor::GetWorkspaceByteLimit ( ) const
inline

Definition at line 206 of file ForestContractor.h.

◆ GetWorkspaceBytes()

size_t TensorNetworks::ForestContractor::GetWorkspaceBytes ( ) const
inline

Definition at line 211 of file ForestContractor.h.

Referenced by SetWorkspaceByteLimit().

◆ InitializeTensors()

TensorsMap TensorNetworks::BaseContractor::InitializeTensors ( const TensorNetwork & network,
Types::qubit_t qubit,
std::vector< Eigen::Index > & keys,
std::unordered_map< Eigen::Index, Eigen::Index > & keysKeys,
bool fillKeys = true,
bool contract = true )
inlineoverridevirtualinherited

◆ SetMultithreading()

void TensorNetworks::BaseContractor::SetMultithreading ( bool multithreading = true)
inlineoverridevirtualinherited

Enable/disable multithreading.

Enable/disable multithreading. Default is enabled.

Parameters
multithreadingA flag to indicate if multithreading should be enabled.

Implements TensorNetworks::ITensorContractor.

Definition at line 267 of file BaseContractor.h.

References enableMultithreading.

◆ SetPlanCacheByteLimit()

void TensorNetworks::ForestContractor::SetPlanCacheByteLimit ( size_t bytes)
inline

Definition at line 159 of file ForestContractor.h.

◆ SetWorkspaceByteLimit()

void TensorNetworks::ForestContractor::SetWorkspaceByteLimit ( size_t bytes)
inline

Definition at line 199 of file ForestContractor.h.

References GetWorkspaceBytes().

Member Data Documentation

◆ enableMultithreading

bool TensorNetworks::BaseContractor::enableMultithreading = true
protectedinherited

◆ maxTensorRank


The documentation for this class was generated from the following file: