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

The Stochastic Tensor Contractor. More...

#include <StochasticContractor.h>

Inheritance diagram for TensorNetworks::StochasticContractor:
TensorNetworks::BaseContractor TensorNetworks::ITensorContractor

Public Member Functions

 StochasticContractor ()
 Constructor.
double Contract (const TensorNetwork &network, Types::qubit_t qubit) override
 Contract the tensor network.
size_t GetMaxRejections () const
void SetMaxRejections (size_t maxRejections)
std::shared_ptr< ITensorContractorClone () const override
 Clone the tensor contractor.
Public Member Functions inherited from TensorNetworks::BaseContractor
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
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
void SetMultithreading (bool multithreading=true) override
 Enable/disable multithreading.
bool GetMultithreading () const override
 Get the multithreading flag.

Protected Attributes

std::mt19937 gen
size_t MaxRejections = 15
Protected Attributes inherited from TensorNetworks::BaseContractor
size_t maxTensorRank
 The maximum rank of the tensors in the network.
bool enableMultithreading
 A flag to indicate if multithreading should be enabled.

Additional Inherited Members

Public Types inherited from TensorNetworks::BaseContractor
using TensorsMap = ITensorContractor::TensorsMap
Public Types inherited from TensorNetworks::ITensorContractor
using TensorsMap
Static Public Member Functions inherited from TensorNetworks::BaseContractor
static size_t GetResultRank (const std::shared_ptr< TensorNode > &tensor1, const std::shared_ptr< TensorNode > &tensor2)

Detailed Description

The Stochastic Tensor Contractor.

Tensor contractions using a stochastic method.

Definition at line 31 of file StochasticContractor.h.

Constructor & Destructor Documentation

◆ StochasticContractor()

TensorNetworks::StochasticContractor::StochasticContractor ( )
inline

Constructor.

Constructs the Stochastic Tensor Contractor. Initializes the random number generator.

Definition at line 39 of file StochasticContractor.h.

Member Function Documentation

◆ Clone()

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

Clone the tensor contractor.

Returns
A shared pointer to the cloned tensor contractor.

Implements TensorNetworks::ITensorContractor.

Definition at line 162 of file StochasticContractor.h.

◆ Contract()

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

Contract the tensor network.

Parameters
networkThe tensor network to contract.
Returns
The result of the contraction.

Implements TensorNetworks::ITensorContractor.

Definition at line 47 of file StochasticContractor.h.

◆ GetMaxRejections()

size_t TensorNetworks::StochasticContractor::GetMaxRejections ( ) const
inline

Definition at line 153 of file StochasticContractor.h.

◆ SetMaxRejections()

void TensorNetworks::StochasticContractor::SetMaxRejections ( size_t maxRejections)
inline

Definition at line 155 of file StochasticContractor.h.

Member Data Documentation

◆ gen

std::mt19937 TensorNetworks::StochasticContractor::gen
protected

Definition at line 173 of file StochasticContractor.h.

◆ MaxRejections

size_t TensorNetworks::StochasticContractor::MaxRejections = 15
protected

Definition at line 174 of file StochasticContractor.h.


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