Maestro 0.2.11
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
SimpleSimulator Class Reference

#include <Simulator.hpp>

Inheritance diagram for SimpleSimulator:
Collaboration diagram for SimpleSimulator:

Public Member Functions

 SimpleSimulator () noexcept
virtual ~SimpleSimulator ()
bool AddOptimizationSimulator (int simType, int simExecType)
unsigned long int CreateSimpleSimulator (int nrQubits) override
void FreeResult (char *result) override
bool Init (const char *libName) noexcept override
bool RemoveAllOptimizationSimulatorsAndAdd (int simType, int simExecType)
char * SimpleEstimate (const char *jsonCircuit, const char *observableStr, const char *jsonConfig)
char * SimpleExecute (const char *jsonCircuit, const char *jsonConfig)

Protected Member Functions

int AddOptimizationSimulator (unsigned long int simHandle, int simType, int simExecType)
unsigned long int AllocateQubits (void *sim, unsigned long int nrQubits)
double * AllProbabilities (void *sim)
double * Amplitude (void *sim, unsigned long long int outcome)
int ApplyCCX (void *sim, int controlQubit1, int controlQubit2, int targetQubit)
int ApplyCH (void *sim, int controlQubit, int targetQubit)
int ApplyCP (void *sim, int controlQubit, int targetQubit, double theta)
int ApplyCRx (void *sim, int controlQubit, int targetQubit, double theta)
int ApplyCRy (void *sim, int controlQubit, int targetQubit, double theta)
int ApplyCRz (void *sim, int controlQubit, int targetQubit, double theta)
int ApplyCSwap (void *sim, int controlQubit, int qubit1, int qubit2)
int ApplyCSX (void *sim, int controlQubit, int targetQubit)
int ApplyCSXDG (void *sim, int controlQubit, int targetQubit)
int ApplyCU (void *sim, int controlQubit, int targetQubit, double theta, double phi, double lambda, double gamma)
int ApplyCX (void *sim, int controlQubit, int targetQubit)
int ApplyCY (void *sim, int controlQubit, int targetQubit)
int ApplyCZ (void *sim, int controlQubit, int targetQubit)
int ApplyH (void *sim, int qubit)
int ApplyK (void *sim, int qubit)
int ApplyP (void *sim, int qubit, double theta)
int ApplyReset (void *sim, const unsigned long int *qubits, unsigned long int nrQubits)
int ApplyRx (void *sim, int qubit, double theta)
int ApplyRy (void *sim, int qubit, double theta)
int ApplyRz (void *sim, int qubit, double theta)
int ApplyS (void *sim, int qubit)
int ApplySDG (void *sim, int qubit)
int ApplySwap (void *sim, int qubit1, int qubit2)
int ApplySX (void *sim, int qubit)
int ApplySXDG (void *sim, int qubit)
int ApplyT (void *sim, int qubit)
int ApplyTDG (void *sim, int qubit)
int ApplyU (void *sim, int qubit, double theta, double phi, double lambda, double gamma)
int ApplyX (void *sim, int qubit)
int ApplyY (void *sim, int qubit)
int ApplyZ (void *sim, int qubit)
int ClearSimulator (void *sim)
int ConfigureSimulator (void *sim, const char *key, const char *value)
virtual unsigned long int CreateSimulator (int simType, int simExecType)
void DestroySimpleSimulator (unsigned long int simHandle)
void DestroySimulator (unsigned long int simHandle)
int FlushSimulator (void *sim)
virtual void FreeDoubleVector (double *vec)
virtual void FreeULLIVector (unsigned long long int *vec)
char * GetConfiguration (void *sim, const char *key)
void * GetFunction (const char *funcName) noexcept
const void * GetHandle () const noexcept
int GetMultithreading (void *sim)
unsigned long int GetNumberOfQubits (void *sim)
int GetSimulationType (void *sim)
void * GetSimulator (unsigned long int simHandle)
int GetSimulatorType (void *sim)
int InitializeSimulator (void *sim)
bool IsMuted () const noexcept
int IsQcsim (void *sim)
bool IsValid () const
unsigned long long int Measure (void *sim, const unsigned long int *qubits, unsigned long int nrQubits)
unsigned long long int MeasureNoCollapse (void *sim)
double * Probabilities (void *sim, const unsigned long long int *qubits, unsigned long int nrQubits)
double Probability (void *sim, unsigned long long int outcome)
int RemoveAllOptimizationSimulatorsAndAdd (unsigned long int simHandle, int simType, int simExecType)
int ResetSimulator (void *sim)
int RestoreInternalDestructiveSavedState (void *sim)
int RestoreState (void *sim)
unsigned long long int * SampleCounts (void *sim, const unsigned long long int *qubits, unsigned long int nrQubits, unsigned long int shots)
int SaveState (void *sim)
int SaveStateToInternalDestructive (void *sim)
int SetMultithreading (void *sim, int multithreading)
void SetMute (bool m) noexcept
char * SimpleEstimate (unsigned long int simpleSim, const char *jsonCircuit, const char *observableStr, const char *jsonConfig)
char * SimpleExecute (unsigned long int simpleSim, const char *jsonCircuit, const char *jsonConfig)

Static Protected Member Functions

static void CheckFunction (void *func, int line) noexcept

Detailed Description

Definition at line 5 of file Simulator.hpp.

Constructor & Destructor Documentation

◆ SimpleSimulator()

SimpleSimulator::SimpleSimulator ( )
inlinenoexcept

Definition at line 7 of file Simulator.hpp.

◆ ~SimpleSimulator()

virtual SimpleSimulator::~SimpleSimulator ( )
inlinevirtual

Definition at line 9 of file Simulator.hpp.

References MaestroLibrary::DestroySimpleSimulator().

Member Function Documentation

◆ AddOptimizationSimulator() [1/2]

int MaestroLibrary::AddOptimizationSimulator ( unsigned long int simHandle,
int simType,
int simExecType )
inlineinherited

Definition at line 267 of file MaestroLib.hpp.

Referenced by SimpleSimulator::AddOptimizationSimulator().

◆ AddOptimizationSimulator() [2/2]

bool SimpleSimulator::AddOptimizationSimulator ( int simType,
int simExecType )
inline

Definition at line 35 of file Simulator.hpp.

References MaestroLibrary::AddOptimizationSimulator().

Referenced by main().

◆ AllocateQubits()

unsigned long int MaestroLibrary::AllocateQubits ( void * sim,
unsigned long int nrQubits )
inlineinherited

Definition at line 372 of file MaestroLib.hpp.

Referenced by Simulator::AllocateQubits().

◆ AllProbabilities()

double * MaestroLibrary::AllProbabilities ( void * sim)
inlineinherited

Definition at line 454 of file MaestroLib.hpp.

Referenced by Simulator::AllProbabilities().

◆ Amplitude()

double * MaestroLibrary::Amplitude ( void * sim,
unsigned long long int outcome )
inlineinherited

Definition at line 445 of file MaestroLib.hpp.

Referenced by Simulator::Amplitude().

◆ ApplyCCX()

int MaestroLibrary::ApplyCCX ( void * sim,
int controlQubit1,
int controlQubit2,
int targetQubit )
inlineinherited

Definition at line 792 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCCX().

◆ ApplyCH()

int MaestroLibrary::ApplyCH ( void * sim,
int controlQubit,
int targetQubit )
inlineinherited

Definition at line 736 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCH().

◆ ApplyCP()

int MaestroLibrary::ApplyCP ( void * sim,
int controlQubit,
int targetQubit,
double theta )
inlineinherited

Definition at line 760 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCP().

◆ ApplyCRx()

int MaestroLibrary::ApplyCRx ( void * sim,
int controlQubit,
int targetQubit,
double theta )
inlineinherited

Definition at line 768 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCRx().

◆ ApplyCRy()

int MaestroLibrary::ApplyCRy ( void * sim,
int controlQubit,
int targetQubit,
double theta )
inlineinherited

Definition at line 776 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCRy().

◆ ApplyCRz()

int MaestroLibrary::ApplyCRz ( void * sim,
int controlQubit,
int targetQubit,
double theta )
inlineinherited

Definition at line 784 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCRz().

◆ ApplyCSwap()

int MaestroLibrary::ApplyCSwap ( void * sim,
int controlQubit,
int qubit1,
int qubit2 )
inlineinherited

Definition at line 809 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCSwap().

◆ ApplyCSX()

int MaestroLibrary::ApplyCSX ( void * sim,
int controlQubit,
int targetQubit )
inlineinherited

Definition at line 744 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCSX().

◆ ApplyCSXDG()

int MaestroLibrary::ApplyCSXDG ( void * sim,
int controlQubit,
int targetQubit )
inlineinherited

Definition at line 752 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCSXDG().

◆ ApplyCU()

int MaestroLibrary::ApplyCU ( void * sim,
int controlQubit,
int targetQubit,
double theta,
double phi,
double lambda,
double gamma )
inlineinherited

Definition at line 817 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCU().

◆ ApplyCX()

int MaestroLibrary::ApplyCX ( void * sim,
int controlQubit,
int targetQubit )
inlineinherited

Definition at line 712 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCX().

◆ ApplyCY()

int MaestroLibrary::ApplyCY ( void * sim,
int controlQubit,
int targetQubit )
inlineinherited

Definition at line 720 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCY().

◆ ApplyCZ()

int MaestroLibrary::ApplyCZ ( void * sim,
int controlQubit,
int targetQubit )
inlineinherited

Definition at line 728 of file MaestroLib.hpp.

Referenced by Simulator::ApplyCZ().

◆ ApplyH()

int MaestroLibrary::ApplyH ( void * sim,
int qubit )
inlineinherited

Definition at line 607 of file MaestroLib.hpp.

Referenced by Simulator::ApplyH().

◆ ApplyK()

int MaestroLibrary::ApplyK ( void * sim,
int qubit )
inlineinherited

Definition at line 663 of file MaestroLib.hpp.

Referenced by Simulator::ApplyK().

◆ ApplyP()

int MaestroLibrary::ApplyP ( void * sim,
int qubit,
double theta )
inlineinherited

Definition at line 671 of file MaestroLib.hpp.

Referenced by Simulator::ApplyP().

◆ ApplyReset()

int MaestroLibrary::ApplyReset ( void * sim,
const unsigned long int * qubits,
unsigned long int nrQubits )
inlineinherited

Definition at line 410 of file MaestroLib.hpp.

Referenced by Simulator::ApplyReset().

◆ ApplyRx()

int MaestroLibrary::ApplyRx ( void * sim,
int qubit,
double theta )
inlineinherited

Definition at line 679 of file MaestroLib.hpp.

Referenced by Simulator::ApplyRx().

◆ ApplyRy()

int MaestroLibrary::ApplyRy ( void * sim,
int qubit,
double theta )
inlineinherited

Definition at line 687 of file MaestroLib.hpp.

Referenced by Simulator::ApplyRy().

◆ ApplyRz()

int MaestroLibrary::ApplyRz ( void * sim,
int qubit,
double theta )
inlineinherited

Definition at line 695 of file MaestroLib.hpp.

Referenced by Simulator::ApplyRz().

◆ ApplyS()

int MaestroLibrary::ApplyS ( void * sim,
int qubit )
inlineinherited

Definition at line 615 of file MaestroLib.hpp.

Referenced by Simulator::ApplyS().

◆ ApplySDG()

int MaestroLibrary::ApplySDG ( void * sim,
int qubit )
inlineinherited

Definition at line 623 of file MaestroLib.hpp.

Referenced by Simulator::ApplySDG().

◆ ApplySwap()

int MaestroLibrary::ApplySwap ( void * sim,
int qubit1,
int qubit2 )
inlineinherited

Definition at line 801 of file MaestroLib.hpp.

Referenced by Simulator::ApplySwap().

◆ ApplySX()

int MaestroLibrary::ApplySX ( void * sim,
int qubit )
inlineinherited

Definition at line 647 of file MaestroLib.hpp.

Referenced by Simulator::ApplySX().

◆ ApplySXDG()

int MaestroLibrary::ApplySXDG ( void * sim,
int qubit )
inlineinherited

Definition at line 655 of file MaestroLib.hpp.

Referenced by Simulator::ApplySXDG().

◆ ApplyT()

int MaestroLibrary::ApplyT ( void * sim,
int qubit )
inlineinherited

Definition at line 631 of file MaestroLib.hpp.

Referenced by Simulator::ApplyT().

◆ ApplyTDG()

int MaestroLibrary::ApplyTDG ( void * sim,
int qubit )
inlineinherited

Definition at line 639 of file MaestroLib.hpp.

Referenced by Simulator::ApplyTDG().

◆ ApplyU()

int MaestroLibrary::ApplyU ( void * sim,
int qubit,
double theta,
double phi,
double lambda,
double gamma )
inlineinherited

Definition at line 703 of file MaestroLib.hpp.

Referenced by Simulator::ApplyU().

◆ ApplyX()

int MaestroLibrary::ApplyX ( void * sim,
int qubit )
inlineinherited

Definition at line 583 of file MaestroLib.hpp.

Referenced by Simulator::ApplyX().

◆ ApplyY()

int MaestroLibrary::ApplyY ( void * sim,
int qubit )
inlineinherited

Definition at line 591 of file MaestroLib.hpp.

Referenced by Simulator::ApplyY().

◆ ApplyZ()

int MaestroLibrary::ApplyZ ( void * sim,
int qubit )
inlineinherited

Definition at line 599 of file MaestroLib.hpp.

Referenced by Simulator::ApplyZ().

◆ CheckFunction()

void MaestroLibrary::CheckFunction ( void * func,
int line )
inlinestaticnoexceptinherited

Definition at line 218 of file MaestroLib.hpp.

Referenced by Init().

◆ ClearSimulator()

int MaestroLibrary::ClearSimulator ( void * sim)
inlineinherited

Definition at line 391 of file MaestroLib.hpp.

Referenced by Simulator::ClearSimulator().

◆ ConfigureSimulator()

int MaestroLibrary::ConfigureSimulator ( void * sim,
const char * key,
const char * value )
inlineinherited

Definition at line 353 of file MaestroLib.hpp.

Referenced by Simulator::ConfigureSimulator().

◆ CreateSimpleSimulator()

unsigned long int SimpleSimulator::CreateSimpleSimulator ( int nrQubits)
inlineoverridevirtual

Reimplemented from MaestroLibrary.

Definition at line 19 of file Simulator.hpp.

References MaestroLibrary::CreateSimpleSimulator(), and MaestroLibrary::DestroySimpleSimulator().

Referenced by main().

◆ CreateSimulator()

virtual unsigned long int MaestroLibrary::CreateSimulator ( int simType,
int simExecType )
inlinevirtualinherited

Reimplemented in Simulator.

Definition at line 308 of file MaestroLib.hpp.

Referenced by Simulator::CreateSimulator().

◆ DestroySimpleSimulator()

void MaestroLibrary::DestroySimpleSimulator ( unsigned long int simHandle)
inlineinherited

◆ DestroySimulator()

void MaestroLibrary::DestroySimulator ( unsigned long int simHandle)
inlineinherited

Definition at line 325 of file MaestroLib.hpp.

Referenced by Simulator::~Simulator(), and Simulator::CreateSimulator().

◆ FlushSimulator()

int MaestroLibrary::FlushSimulator ( void * sim)
inlineinherited

Definition at line 503 of file MaestroLib.hpp.

Referenced by Simulator::FlushSimulator().

◆ FreeDoubleVector()

virtual void MaestroLibrary::FreeDoubleVector ( double * vec)
inlinevirtualinherited

Reimplemented in Simulator.

Definition at line 429 of file MaestroLib.hpp.

Referenced by Simulator::FreeDoubleVector().

◆ FreeResult()

void SimpleSimulator::FreeResult ( char * result)
inlineoverridevirtual

Reimplemented from MaestroLibrary.

Definition at line 53 of file Simulator.hpp.

References MaestroLibrary::FreeResult().

Referenced by main().

◆ FreeULLIVector()

virtual void MaestroLibrary::FreeULLIVector ( unsigned long long int * vec)
inlinevirtualinherited

Reimplemented in Simulator.

Definition at line 437 of file MaestroLib.hpp.

Referenced by Simulator::FreeULLIVector().

◆ GetConfiguration()

char * MaestroLibrary::GetConfiguration ( void * sim,
const char * key )
inlineinherited

Definition at line 363 of file MaestroLib.hpp.

Referenced by Simulator::GetConfiguration().

◆ GetFunction()

void * Utils::Library::GetFunction ( const char * funcName)
inlinenoexceptinherited

Definition at line 104 of file Library.h.

Referenced by MaestroLibrary::Init(), and Simulators::QuestLibSim::Init().

◆ GetHandle()

const void * Utils::Library::GetHandle ( ) const
inlinenoexceptinherited

Definition at line 112 of file Library.h.

◆ GetMultithreading()

int MaestroLibrary::GetMultithreading ( void * sim)
inlineinherited

Definition at line 556 of file MaestroLib.hpp.

Referenced by Simulator::GetMultithreading().

◆ GetNumberOfQubits()

unsigned long int MaestroLibrary::GetNumberOfQubits ( void * sim)
inlineinherited

Definition at line 381 of file MaestroLib.hpp.

Referenced by Simulator::GetNumberOfQubits().

◆ GetSimulationType()

int MaestroLibrary::GetSimulationType ( void * sim)
inlineinherited

Definition at line 494 of file MaestroLib.hpp.

Referenced by Simulator::GetSimulationType().

◆ GetSimulator()

void * MaestroLibrary::GetSimulator ( unsigned long int simHandle)
inlineinherited

Definition at line 318 of file MaestroLib.hpp.

Referenced by Simulator::CreateSimulator(), and Simulator::GetSimulator().

◆ GetSimulatorType()

int MaestroLibrary::GetSimulatorType ( void * sim)
inlineinherited

Definition at line 485 of file MaestroLib.hpp.

Referenced by Simulator::GetSimulatorType().

◆ Init()

bool SimpleSimulator::Init ( const char * libName)
inlineoverridevirtualnoexcept

Reimplemented from MaestroLibrary.

Definition at line 13 of file Simulator.hpp.

References MaestroLibrary::Init().

Referenced by main().

◆ InitializeSimulator()

int MaestroLibrary::InitializeSimulator ( void * sim)
inlineinherited

Definition at line 333 of file MaestroLib.hpp.

Referenced by Simulator::InitializeSimulator().

◆ IsMuted()

bool Utils::Library::IsMuted ( ) const
inlinenoexceptinherited

Definition at line 114 of file Library.h.

◆ IsQcsim()

int MaestroLibrary::IsQcsim ( void * sim)
inlineinherited

Definition at line 565 of file MaestroLib.hpp.

Referenced by Simulator::IsQcsim().

◆ IsValid()

bool MaestroLibrary::IsValid ( ) const
inlineinherited

Definition at line 234 of file MaestroLib.hpp.

◆ Measure()

unsigned long long int MaestroLibrary::Measure ( void * sim,
const unsigned long int * qubits,
unsigned long int nrQubits )
inlineinherited

Definition at line 400 of file MaestroLib.hpp.

Referenced by Simulator::Measure().

◆ MeasureNoCollapse()

unsigned long long int MaestroLibrary::MeasureNoCollapse ( void * sim)
inlineinherited

Definition at line 574 of file MaestroLib.hpp.

Referenced by Simulator::MeasureNoCollapse().

◆ Probabilities()

double * MaestroLibrary::Probabilities ( void * sim,
const unsigned long long int * qubits,
unsigned long int nrQubits )
inlineinherited

Definition at line 463 of file MaestroLib.hpp.

Referenced by Simulator::Probabilities().

◆ Probability()

double MaestroLibrary::Probability ( void * sim,
unsigned long long int outcome )
inlineinherited

Definition at line 420 of file MaestroLib.hpp.

Referenced by Simulator::Probability().

◆ RemoveAllOptimizationSimulatorsAndAdd() [1/2]

int MaestroLibrary::RemoveAllOptimizationSimulatorsAndAdd ( unsigned long int simHandle,
int simType,
int simExecType )
inlineinherited

◆ RemoveAllOptimizationSimulatorsAndAdd() [2/2]

bool SimpleSimulator::RemoveAllOptimizationSimulatorsAndAdd ( int simType,
int simExecType )
inline

Definition at line 27 of file Simulator.hpp.

References MaestroLibrary::RemoveAllOptimizationSimulatorsAndAdd().

Referenced by main().

◆ ResetSimulator()

int MaestroLibrary::ResetSimulator ( void * sim)
inlineinherited

Definition at line 343 of file MaestroLib.hpp.

Referenced by Simulator::ResetSimulator().

◆ RestoreInternalDestructiveSavedState()

int MaestroLibrary::RestoreInternalDestructiveSavedState ( void * sim)
inlineinherited

Definition at line 522 of file MaestroLib.hpp.

Referenced by Simulator::RestoreInternalDestructiveSavedState().

◆ RestoreState()

int MaestroLibrary::RestoreState ( void * sim)
inlineinherited

Definition at line 540 of file MaestroLib.hpp.

Referenced by Simulator::RestoreState().

◆ SampleCounts()

unsigned long long int * MaestroLibrary::SampleCounts ( void * sim,
const unsigned long long int * qubits,
unsigned long int nrQubits,
unsigned long int shots )
inlineinherited

Definition at line 473 of file MaestroLib.hpp.

Referenced by Simulator::SampleCounts().

◆ SaveState()

int MaestroLibrary::SaveState ( void * sim)
inlineinherited

Definition at line 532 of file MaestroLib.hpp.

Referenced by Simulator::SaveState().

◆ SaveStateToInternalDestructive()

int MaestroLibrary::SaveStateToInternalDestructive ( void * sim)
inlineinherited

Definition at line 512 of file MaestroLib.hpp.

Referenced by Simulator::SaveStateToInternalDestructive().

◆ SetMultithreading()

int MaestroLibrary::SetMultithreading ( void * sim,
int multithreading )
inlineinherited

Definition at line 548 of file MaestroLib.hpp.

Referenced by Simulator::SetMultithreading().

◆ SetMute()

void Utils::Library::SetMute ( bool m)
inlinenoexceptinherited

Definition at line 116 of file Library.h.

◆ SimpleEstimate() [1/2]

char * MaestroLibrary::SimpleEstimate ( unsigned long int simpleSim,
const char * jsonCircuit,
const char * observableStr,
const char * jsonConfig )
inlineinherited

Definition at line 289 of file MaestroLib.hpp.

Referenced by SimpleSimulator::SimpleEstimate().

◆ SimpleEstimate() [2/2]

char * SimpleSimulator::SimpleEstimate ( const char * jsonCircuit,
const char * observableStr,
const char * jsonConfig )
inline

Definition at line 47 of file Simulator.hpp.

References MaestroLibrary::SimpleEstimate().

Referenced by main().

◆ SimpleExecute() [1/2]

char * MaestroLibrary::SimpleExecute ( unsigned long int simpleSim,
const char * jsonCircuit,
const char * jsonConfig )
inlineinherited

Definition at line 278 of file MaestroLib.hpp.

Referenced by SimpleSimulator::SimpleExecute().

◆ SimpleExecute() [2/2]

char * SimpleSimulator::SimpleExecute ( const char * jsonCircuit,
const char * jsonConfig )
inline

Definition at line 43 of file Simulator.hpp.

References MaestroLibrary::SimpleExecute().

Referenced by main().


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