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

#include <TensorNetwork.h>

Public Types

using Index = Eigen::Index

Public Member Functions

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

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

◆ AddProjector()

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

Definition at line 210 of file TensorNetwork.h.

◆ AddProjectorOp()

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

Definition at line 247 of file TensorNetwork.h.

◆ Clear()

void TensorNetworks::TensorNetwork::Clear ( )
inline

Definition at line 50 of file TensorNetwork.h.

◆ ClearSavedState()

void TensorNetworks::TensorNetwork::ClearSavedState ( )
inline

Definition at line 341 of file TensorNetwork.h.

◆ ClearSavedStateMinimal()

void TensorNetworks::TensorNetwork::ClearSavedStateMinimal ( )
inline

Definition at line 350 of file TensorNetwork.h.

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

◆ Connect()

void TensorNetworks::TensorNetwork::Connect ( )
inline

Definition at line 358 of file TensorNetwork.h.

◆ Disconnect()

void TensorNetworks::TensorNetwork::Disconnect ( )
inline

Definition at line 381 of file TensorNetwork.h.

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

◆ getBasisStateProbability()

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

Definition at line 176 of file TensorNetwork.h.

◆ GetContractor()

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

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

◆ GetNumQubits()

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

Definition at line 262 of file TensorNetwork.h.

◆ GetQubitGroup()

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

Definition at line 277 of file TensorNetwork.h.

◆ GetTensors()

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

Definition at line 272 of file TensorNetwork.h.

◆ Measure()

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

Definition at line 196 of file TensorNetwork.h.

◆ Probability()

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

Definition at line 76 of file TensorNetwork.h.

◆ RestoreSavedStateDestructive()

void TensorNetworks::TensorNetwork::RestoreSavedStateDestructive ( )
inline

Definition at line 319 of file TensorNetwork.h.

◆ RestoreSavedStateMinimalDestructive()

void TensorNetworks::TensorNetwork::RestoreSavedStateMinimalDestructive ( )
inline

Definition at line 330 of file TensorNetwork.h.

◆ RestoreState()

void TensorNetworks::TensorNetwork::RestoreState ( )
inline

Definition at line 300 of file TensorNetwork.h.

◆ RestoreStateMinimal()

void TensorNetworks::TensorNetwork::RestoreStateMinimal ( )
inline

Definition at line 311 of file TensorNetwork.h.

◆ SaveState()

void TensorNetworks::TensorNetwork::SaveState ( )
inline

Definition at line 281 of file TensorNetwork.h.

◆ SaveStateMinimal()

void TensorNetworks::TensorNetwork::SaveStateMinimal ( )
inline

Definition at line 292 of file TensorNetwork.h.

◆ SetContractor()

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

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


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