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

The Lookahead Tensor Contractor. More...

#include <LookaheadContractor.h>

Inheritance diagram for TensorNetworks::LookaheadContractor:
Collaboration diagram for TensorNetworks::LookaheadContractor:

Public Types

using DummyTensorsMap = std::map<Eigen::Index, std::shared_ptr<TensorNode>>
using TensorPair = std::pair<Eigen::Index, Eigen::Index>
using TensorsMap = ITensorContractor::TensorsMap
using VisitedPairType

Public Member Functions

std::shared_ptr< ITensorContractorClone () 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 GetMaxTensorRank () const override
bool GetMultithreading () const override
 Get the multithreading flag.
size_t GetNumberOfLevels () const
bool GetUseMaxRankCost () 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 SetNumberOfLevels (size_t levels)
void SetUseMaxRankCost (bool val=true)

Static Public Member Functions

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

Protected Attributes

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

Detailed Description

The Lookahead Tensor Contractor.

Tensor contractions using the Lookahead contraction method.

Definition at line 30 of file LookaheadContractor.h.

Member Typedef Documentation

◆ DummyTensorsMap

using TensorNetworks::LookaheadContractor::DummyTensorsMap = std::map<Eigen::Index, std::shared_ptr<TensorNode>>

Definition at line 35 of file LookaheadContractor.h.

◆ TensorPair

using TensorNetworks::LookaheadContractor::TensorPair = std::pair<Eigen::Index, Eigen::Index>

Definition at line 32 of file LookaheadContractor.h.

◆ TensorsMap

◆ VisitedPairType

Initial value:
std::unordered_set<TensorPair, boost::hash<TensorPair>>

Definition at line 33 of file LookaheadContractor.h.

Member Function Documentation

◆ Clone()

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

Clone the tensor contractor.

Returns
A shared pointer to the cloned tensor contractor.

Implements TensorNetworks::ITensorContractor.

Definition at line 103 of file LookaheadContractor.h.

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

◆ Contract()

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

◆ 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

◆ GetMaxTensorRank()

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

Implements TensorNetworks::ITensorContractor.

Definition at line 236 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 257 of file BaseContractor.h.

References enableMultithreading.

◆ GetNumberOfLevels()

size_t TensorNetworks::LookaheadContractor::GetNumberOfLevels ( ) const
inline

Definition at line 90 of file LookaheadContractor.h.

◆ GetResultRank()

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

◆ GetUseMaxRankCost()

bool TensorNetworks::LookaheadContractor::GetUseMaxRankCost ( ) const
inline

Definition at line 94 of file LookaheadContractor.h.

◆ 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 246 of file BaseContractor.h.

References enableMultithreading.

◆ SetNumberOfLevels()

void TensorNetworks::LookaheadContractor::SetNumberOfLevels ( size_t levels)
inline

Definition at line 92 of file LookaheadContractor.h.

◆ SetUseMaxRankCost()

void TensorNetworks::LookaheadContractor::SetUseMaxRankCost ( bool val = true)
inline

Definition at line 96 of file LookaheadContractor.h.

Member Data Documentation

◆ enableMultithreading

bool TensorNetworks::BaseContractor::enableMultithreading
protectedinherited

◆ maxTensorRank


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