Maestro 0.3.11
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< TensorNetwork > Clone () 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< ITensorContractor > GetContractor () 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.
void SetSeed (uint64_t seed)

Detailed Description

Definition at line 28 of file TensorNetwork.h.

Member Typedef Documentation

◆ Index

Definition at line 36 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 45 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 74 of file TensorNetwork.h.

Referenced by AddProjectorOp().

◆ AddProjector()

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

Definition at line 240 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 277 of file TensorNetwork.h.

References AddGate().

Referenced by Measure().

◆ Clear()

void TensorNetworks::TensorNetwork::Clear ( )
inline

Definition at line 57 of file TensorNetwork.h.

References GetNumQubits().

◆ ClearSavedState()

void TensorNetworks::TensorNetwork::ClearSavedState ( )
inline

Definition at line 383 of file TensorNetwork.h.

References ClearSavedStateMinimal().

Referenced by RestoreSavedStateDestructive().

◆ ClearSavedStateMinimal()

void TensorNetworks::TensorNetwork::ClearSavedStateMinimal ( )
inline

Definition at line 393 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 472 of file TensorNetwork.h.

◆ Connect()

void TensorNetworks::TensorNetwork::Connect ( )
inline

Definition at line 402 of file TensorNetwork.h.

References GetNumQubits().

Referenced by Probability().

◆ Disconnect()

void TensorNetworks::TensorNetwork::Disconnect ( )
inline

◆ 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 131 of file TensorNetwork.h.

References Disconnect().

◆ getBasisStateProbability()

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

Definition at line 187 of file TensorNetwork.h.

References AddProjector(), Disconnect(), and GetNumQubits().

◆ GetContractor()

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

Definition at line 302 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 467 of file TensorNetwork.h.

◆ GetNumQubits()

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

Definition at line 292 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

◆ Measure()

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

Definition at line 224 of file TensorNetwork.h.

References AddProjectorOp(), and Probability().

◆ Probability()

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

Definition at line 83 of file TensorNetwork.h.

References AddProjector(), and Connect().

Referenced by Measure().

◆ RestoreSavedStateDestructive()

void TensorNetworks::TensorNetwork::RestoreSavedStateDestructive ( )
inline

Definition at line 359 of file TensorNetwork.h.

References ClearSavedState(), and RestoreSavedStateMinimalDestructive().

◆ RestoreSavedStateMinimalDestructive()

void TensorNetworks::TensorNetwork::RestoreSavedStateMinimalDestructive ( )
inline

Definition at line 371 of file TensorNetwork.h.

References ClearSavedStateMinimal().

Referenced by RestoreSavedStateDestructive().

◆ RestoreState()

void TensorNetworks::TensorNetwork::RestoreState ( )
inline

Definition at line 338 of file TensorNetwork.h.

References RestoreStateMinimal().

◆ RestoreStateMinimal()

void TensorNetworks::TensorNetwork::RestoreStateMinimal ( )
inline

Definition at line 350 of file TensorNetwork.h.

Referenced by RestoreState().

◆ SaveState()

void TensorNetworks::TensorNetwork::SaveState ( )
inline

Definition at line 317 of file TensorNetwork.h.

References SaveStateMinimal().

◆ SaveStateMinimal()

void TensorNetworks::TensorNetwork::SaveStateMinimal ( )
inline

Definition at line 329 of file TensorNetwork.h.

Referenced by SaveState().

◆ SetContractor()

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

Definition at line 297 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 455 of file TensorNetwork.h.

◆ SetSeed()

void TensorNetworks::TensorNetwork::SetSeed ( uint64_t seed)
inline

Definition at line 31 of file TensorNetwork.h.


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