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

The Dumb Tensor Contractor. More...

#include <DumbContractor.h>

Inheritance diagram for TensorNetworks::DumbContractor:
Collaboration diagram for TensorNetworks::DumbContractor:

Public Types

using TensorsMap = ITensorContractor::TensorsMap

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)
bool GetContractTheLowestTensorId () const
size_t GetMaxTensorRank () const override
bool GetMultithreading () const override
 Get the multithreading flag.
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 SetContractTheLowestTensorId (bool c)
void SetMultithreading (bool multithreading=true) override
 Enable/disable multithreading.

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 Dumb Tensor Contractor.

Tensor contractions using the Dumb contraction method.

Definition at line 37 of file DumbContractor.h.

Member Typedef Documentation

◆ TensorsMap

Member Function Documentation

◆ Clone()

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

Clone the tensor contractor.

Returns
A shared pointer to the cloned tensor contractor.

Implements TensorNetworks::ITensorContractor.

Definition at line 145 of file DumbContractor.h.

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

◆ Contract()

double TensorNetworks::DumbContractor::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 45 of file DumbContractor.h.

References TensorNetworks::BaseContractor::ContractNodes(), TensorNetworks::BaseContractor::GetResultRank(), TensorNetworks::BaseContractor::InitializeTensors(), and TensorNetworks::TensorNode::NotConnected.

◆ 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

◆ GetContractTheLowestTensorId()

bool TensorNetworks::DumbContractor::GetContractTheLowestTensorId ( ) const
inline

Definition at line 136 of file DumbContractor.h.

◆ 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.

◆ GetResultRank()

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

◆ 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

◆ SetContractTheLowestTensorId()

void TensorNetworks::DumbContractor::SetContractTheLowestTensorId ( bool c)
inline

Definition at line 134 of file DumbContractor.h.

◆ 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.

Member Data Documentation

◆ enableMultithreading

bool TensorNetworks::BaseContractor::enableMultithreading
protectedinherited

◆ maxTensorRank


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