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

#include <TensorNetwork.h>

+ Collaboration diagram for TensorNetworks::TensorNetwork:

Public Types

using Index = Eigen::Index
 

Public Member Functions

 TensorNetwork ()=delete
 
 TensorNetwork (size_t numQubits)
 Constructor.
 
void AddGate (const QC::Gates::QuantumGateWithOp< TensorNode::MatrixClass > &gate, Types::qubit_t q1, Types::qubit_t q2=0)
 
void AddProjector (Types::qubit_t qubit, bool zero=true)
 
void AddProjectorOp (Types::qubit_t qubit, bool zero=true, double prob=1.)
 
void Clear ()
 
void ClearSavedState ()
 
void ClearSavedStateMinimal ()
 
std::unique_ptr< TensorNetworkClone () const
 
void Connect ()
 
void Disconnect ()
 
double ExpectationValue (const std::string &pauliString)
 Returns the expected value of a Pauli string.
 
double getBasisStateProbability (size_t outcome)
 
std::shared_ptr< ITensorContractorGetContractor () const
 
bool GetMultithreading () const
 Get the multithreading flag.
 
size_t GetNumQubits () const
 
const std::unordered_set< Types::qubit_t > & GetQubitGroup (Types::qubit_t q) const
 
const std::vector< std::shared_ptr< TensorNode > > & GetTensors () const
 
bool Measure (Types::qubit_t qubit)
 
double Probability (Types::qubit_t qubit, bool zero=true)
 
void RestoreSavedStateDestructive ()
 
void RestoreSavedStateMinimalDestructive ()
 
void RestoreState ()
 
void RestoreStateMinimal ()
 
void SaveState ()
 
void SaveStateMinimal ()
 
void SetContractor (const std::shared_ptr< ITensorContractor > &c)
 
void SetMultithreading (bool multithreading=true)
 Enable/disable multithreading.
 

Detailed Description

Definition at line 27 of file TensorNetwork.h.

Member Typedef Documentation

◆ Index

Definition at line 29 of file TensorNetwork.h.

Constructor & Destructor Documentation

◆ TensorNetwork() [1/2]

TensorNetworks::TensorNetwork::TensorNetwork ( )
delete

◆ TensorNetwork() [2/2]

TensorNetworks::TensorNetwork::TensorNetwork ( size_t  numQubits)
inline

Constructor.

Parameters
numQubitsThe number of qubits in the network.

Definition at line 38 of file TensorNetwork.h.

Member Function Documentation

◆ AddGate()

void TensorNetworks::TensorNetwork::AddGate ( const QC::Gates::QuantumGateWithOp< TensorNode::MatrixClass > &  gate,
Types::qubit_t  q1,
Types::qubit_t  q2 = 0 
)
inline

Definition at line 66 of file TensorNetwork.h.

Referenced by AddProjectorOp().

◆ AddProjector()

void TensorNetworks::TensorNetwork::AddProjector ( Types::qubit_t  qubit,
bool  zero = true 
)
inline

Definition at line 208 of file TensorNetwork.h.

Referenced by getBasisStateProbability(), and Probability().

◆ AddProjectorOp()

void TensorNetworks::TensorNetwork::AddProjectorOp ( Types::qubit_t  qubit,
bool  zero = true,
double  prob = 1. 
)
inline

Definition at line 245 of file TensorNetwork.h.

References AddGate().

Referenced by Measure().

◆ Clear()

void TensorNetworks::TensorNetwork::Clear ( )
inline

Definition at line 50 of file TensorNetwork.h.

References GetNumQubits().

◆ ClearSavedState()

void TensorNetworks::TensorNetwork::ClearSavedState ( )
inline

Definition at line 339 of file TensorNetwork.h.

References ClearSavedStateMinimal().

Referenced by RestoreSavedStateDestructive().

◆ ClearSavedStateMinimal()

void TensorNetworks::TensorNetwork::ClearSavedStateMinimal ( )
inline

Definition at line 348 of file TensorNetwork.h.

Referenced by ClearSavedState(), and RestoreSavedStateMinimalDestructive().

◆ Clone()

std::unique_ptr< TensorNetwork > TensorNetworks::TensorNetwork::Clone ( ) const
inline

< A map between qubits (as identified from outside) and the qubits group ids

< A map between qubits group ids and the qubits in that group

< A map between qubits (as identified from outside) and the qubits group ids

< A map between qubits group ids and the qubits in that group

Definition at line 423 of file TensorNetwork.h.

◆ Connect()

void TensorNetworks::TensorNetwork::Connect ( )
inline

Definition at line 356 of file TensorNetwork.h.

References GetNumQubits().

Referenced by Probability().

◆ Disconnect()

void TensorNetworks::TensorNetwork::Disconnect ( )
inline

Definition at line 379 of file TensorNetwork.h.

References GetNumQubits(), and TensorNetworks::TensorNode::NotConnected.

Referenced by ExpectationValue().

◆ ExpectationValue()

double TensorNetworks::TensorNetwork::ExpectationValue ( const std::string &  pauliString)
inline

Returns the expected value of a Pauli string.

Use it to obtain the expected value of a Pauli string. The Pauli string is a string of characters representing the Pauli operators, e.g. "XIZY". The length of the string should be less or equal to the number of qubits (if it's less, it's completed with I).

Parameters
pauliStringThe Pauli string to obtain the expected value for.
Returns
The expected value of the specified Pauli string.

Definition at line 122 of file TensorNetwork.h.

References Disconnect().

◆ getBasisStateProbability()

double TensorNetworks::TensorNetwork::getBasisStateProbability ( size_t  outcome)
inline

◆ GetContractor()

std::shared_ptr< ITensorContractor > TensorNetworks::TensorNetwork::GetContractor ( ) const
inline

Definition at line 266 of file TensorNetwork.h.

◆ GetMultithreading()

bool TensorNetworks::TensorNetwork::GetMultithreading ( ) const
inline

Get the multithreading flag.

Returns the multithreading flag.

Returns
The multithreading flag.

Definition at line 421 of file TensorNetwork.h.

◆ GetNumQubits()

size_t TensorNetworks::TensorNetwork::GetNumQubits ( ) const
inline

Definition at line 260 of file TensorNetwork.h.

Referenced by Clear(), Connect(), Disconnect(), and getBasisStateProbability().

◆ GetQubitGroup()

const std::unordered_set< Types::qubit_t > & TensorNetworks::TensorNetwork::GetQubitGroup ( Types::qubit_t  q) const
inline

◆ GetTensors()

const std::vector< std::shared_ptr< TensorNode > > & TensorNetworks::TensorNetwork::GetTensors ( ) const
inline

Definition at line 270 of file TensorNetwork.h.

Referenced by TensorNetworks::BaseContractor::InitializeTensors().

◆ Measure()

bool TensorNetworks::TensorNetwork::Measure ( Types::qubit_t  qubit)
inline

Definition at line 194 of file TensorNetwork.h.

References AddProjectorOp(), and Probability().

◆ Probability()

double TensorNetworks::TensorNetwork::Probability ( Types::qubit_t  qubit,
bool  zero = true 
)
inline

Definition at line 76 of file TensorNetwork.h.

References AddProjector(), and Connect().

Referenced by Measure().

◆ RestoreSavedStateDestructive()

void TensorNetworks::TensorNetwork::RestoreSavedStateDestructive ( )
inline

Definition at line 317 of file TensorNetwork.h.

References ClearSavedState(), and RestoreSavedStateMinimalDestructive().

◆ RestoreSavedStateMinimalDestructive()

void TensorNetworks::TensorNetwork::RestoreSavedStateMinimalDestructive ( )
inline

Definition at line 328 of file TensorNetwork.h.

References ClearSavedStateMinimal().

Referenced by getBasisStateProbability(), and RestoreSavedStateDestructive().

◆ RestoreState()

void TensorNetworks::TensorNetwork::RestoreState ( )
inline

Definition at line 298 of file TensorNetwork.h.

References RestoreStateMinimal().

◆ RestoreStateMinimal()

void TensorNetworks::TensorNetwork::RestoreStateMinimal ( )
inline

Definition at line 309 of file TensorNetwork.h.

Referenced by RestoreState().

◆ SaveState()

void TensorNetworks::TensorNetwork::SaveState ( )
inline

Definition at line 279 of file TensorNetwork.h.

References SaveStateMinimal().

◆ SaveStateMinimal()

void TensorNetworks::TensorNetwork::SaveStateMinimal ( )
inline

Definition at line 290 of file TensorNetwork.h.

Referenced by getBasisStateProbability(), and SaveState().

◆ SetContractor()

void TensorNetworks::TensorNetwork::SetContractor ( const std::shared_ptr< ITensorContractor > &  c)
inline

Definition at line 262 of file TensorNetwork.h.

◆ SetMultithreading()

void TensorNetworks::TensorNetwork::SetMultithreading ( bool  multithreading = true)
inline

Enable/disable multithreading.

Enable/disable multithreading. Default is enabled.

Parameters
multithreadingA flag to indicate if multithreading should be enabled.

Definition at line 410 of file TensorNetwork.h.


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