Maestro 0.2.11
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Interface.cpp File Reference
#include "Interface.h"
#include "../Simulators/Factory.h"
#include "Maestro.h"
#include "Json.h"
#include <atomic>
#include <memory>
#include "../Utils/LogFile.h"
#include "../qasm/QasmCirc.h"
Include dependency graph for Interface.cpp:

Go to the source code of this file.

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)
unsigned long int CreateSimpleSimulator (int nrQubits)
unsigned long int CreateSimulator (int simType, int simExecType)
void DestroySimpleSimulator (unsigned long int simHandle)
void DestroySimulator (unsigned long int simHandle)
int FlushSimulator (void *sim)
void FreeDoubleVector (double *vec)
void FreeResult (char *result)
void FreeULLIVector (unsigned long long int *vec)
char * GetConfiguration (void *sim, const char *key)
void * GetMaestroObject ()
void * GetMaestroObjectWithMute ()
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)
int IsQcsim (void *sim)
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)
char * SimpleEstimate (unsigned long int simpleSim, const char *circuitStr, const char *observableStr, const char *jsonConfig)
char * SimpleExecute (unsigned long int simpleSim, const char *circuitStr, const char *jsonConfig)

Variables

static std::atomic_bool isInitialized {false}
static std::unique_ptr< MaestromaestroInstance

Function Documentation

◆ AddOptimizationSimulator()

int AddOptimizationSimulator ( unsigned long int simHandle,
int simType,
int simExecType )

Definition at line 103 of file Interface.cpp.

References maestroInstance.

◆ AllocateQubits()

unsigned long int AllocateQubits ( void * sim,
unsigned long int nrQubits )

Definition at line 884 of file Interface.cpp.

References Simulators::IState::AllocateQubits().

◆ AllProbabilities()

double * AllProbabilities ( void * sim)

Definition at line 977 of file Interface.cpp.

References Simulators::IState::AllProbabilities().

◆ Amplitude()

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

Definition at line 963 of file Interface.cpp.

References Simulators::IState::Amplitude().

◆ ApplyCCX()

int ApplyCCX ( void * sim,
int controlQubit1,
int controlQubit2,
int targetQubit )

Definition at line 791 of file Interface.cpp.

References Simulators::ISimulator::ApplyCCX().

◆ ApplyCH()

int ApplyCH ( void * sim,
int controlQubit,
int targetQubit )

Definition at line 714 of file Interface.cpp.

References Simulators::ISimulator::ApplyCH().

◆ ApplyCP()

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

Definition at line 747 of file Interface.cpp.

References Simulators::ISimulator::ApplyCP().

◆ ApplyCRx()

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

Definition at line 758 of file Interface.cpp.

References Simulators::ISimulator::ApplyCRx().

◆ ApplyCRy()

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

Definition at line 769 of file Interface.cpp.

References Simulators::ISimulator::ApplyCRy().

◆ ApplyCRz()

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

Definition at line 780 of file Interface.cpp.

References Simulators::ISimulator::ApplyCRz().

◆ ApplyCSwap()

int ApplyCSwap ( void * sim,
int controlQubit,
int qubit1,
int qubit2 )

Definition at line 814 of file Interface.cpp.

References Simulators::ISimulator::ApplyCSwap().

◆ ApplyCSX()

int ApplyCSX ( void * sim,
int controlQubit,
int targetQubit )

Definition at line 725 of file Interface.cpp.

References Simulators::ISimulator::ApplyCSx().

◆ ApplyCSXDG()

int ApplyCSXDG ( void * sim,
int controlQubit,
int targetQubit )

Definition at line 736 of file Interface.cpp.

References Simulators::ISimulator::ApplyCSxDAG().

◆ ApplyCU()

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

Definition at line 825 of file Interface.cpp.

References Simulators::ISimulator::ApplyCU().

◆ ApplyCX()

◆ ApplyCY()

int ApplyCY ( void * sim,
int controlQubit,
int targetQubit )

Definition at line 692 of file Interface.cpp.

References Simulators::ISimulator::ApplyCY().

◆ ApplyCZ()

int ApplyCZ ( void * sim,
int controlQubit,
int targetQubit )

Definition at line 703 of file Interface.cpp.

References Simulators::ISimulator::ApplyCZ().

◆ ApplyH()

◆ ApplyK()

int ApplyK ( void * sim,
int qubit )

Definition at line 614 of file Interface.cpp.

References Simulators::ISimulator::ApplyK().

◆ ApplyP()

int ApplyP ( void * sim,
int qubit,
double theta )

Definition at line 625 of file Interface.cpp.

References Simulators::ISimulator::ApplyP().

◆ ApplyReset()

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

Definition at line 927 of file Interface.cpp.

◆ ApplyRx()

int ApplyRx ( void * sim,
int qubit,
double theta )

Definition at line 636 of file Interface.cpp.

References Simulators::ISimulator::ApplyRx().

◆ ApplyRy()

int ApplyRy ( void * sim,
int qubit,
double theta )

Definition at line 647 of file Interface.cpp.

References Simulators::ISimulator::ApplyRy().

◆ ApplyRz()

int ApplyRz ( void * sim,
int qubit,
double theta )

Definition at line 658 of file Interface.cpp.

References Simulators::ISimulator::ApplyRz().

◆ ApplyS()

int ApplyS ( void * sim,
int qubit )

◆ ApplySDG()

int ApplySDG ( void * sim,
int qubit )

◆ ApplySwap()

int ApplySwap ( void * sim,
int qubit1,
int qubit2 )

Definition at line 803 of file Interface.cpp.

References Simulators::ISimulator::ApplySwap().

◆ ApplySX()

int ApplySX ( void * sim,
int qubit )

Definition at line 592 of file Interface.cpp.

References Simulators::ISimulator::ApplySx().

◆ ApplySXDG()

int ApplySXDG ( void * sim,
int qubit )

Definition at line 603 of file Interface.cpp.

References Simulators::ISimulator::ApplySxDAG().

◆ ApplyT()

int ApplyT ( void * sim,
int qubit )

Definition at line 570 of file Interface.cpp.

References Simulators::ISimulator::ApplyT().

◆ ApplyTDG()

int ApplyTDG ( void * sim,
int qubit )

Definition at line 581 of file Interface.cpp.

References Simulators::ISimulator::ApplyTDG().

◆ ApplyU()

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

Definition at line 669 of file Interface.cpp.

References Simulators::ISimulator::ApplyU().

◆ ApplyX()

int ApplyX ( void * sim,
int qubit )

◆ ApplyY()

int ApplyY ( void * sim,
int qubit )

Definition at line 515 of file Interface.cpp.

References Simulators::ISimulator::ApplyY().

◆ ApplyZ()

int ApplyZ ( void * sim,
int qubit )

Definition at line 526 of file Interface.cpp.

References Simulators::ISimulator::ApplyZ().

◆ ClearSimulator()

int ClearSimulator ( void * sim)

Definition at line 905 of file Interface.cpp.

References Simulators::IState::Clear().

◆ ConfigureSimulator()

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

Definition at line 857 of file Interface.cpp.

References Simulators::IState::Configure().

◆ CreateSimpleSimulator()

unsigned long int CreateSimpleSimulator ( int nrQubits)

Definition at line 73 of file Interface.cpp.

References maestroInstance.

◆ CreateSimulator()

unsigned long int CreateSimulator ( int simType,
int simExecType )

Definition at line 476 of file Interface.cpp.

References maestroInstance.

◆ DestroySimpleSimulator()

void DestroySimpleSimulator ( unsigned long int simHandle)

Definition at line 82 of file Interface.cpp.

References maestroInstance.

◆ DestroySimulator()

void DestroySimulator ( unsigned long int simHandle)

Definition at line 495 of file Interface.cpp.

References maestroInstance.

◆ FlushSimulator()

int FlushSimulator ( void * sim)

Definition at line 1048 of file Interface.cpp.

References Simulators::IState::Flush().

◆ FreeDoubleVector()

void FreeDoubleVector ( double * vec)

Definition at line 949 of file Interface.cpp.

◆ FreeResult()

void FreeResult ( char * result)

Definition at line 469 of file Interface.cpp.

◆ FreeULLIVector()

void FreeULLIVector ( unsigned long long int * vec)

Definition at line 956 of file Interface.cpp.

◆ GetConfiguration()

char * GetConfiguration ( void * sim,
const char * key )

Definition at line 867 of file Interface.cpp.

References Simulators::IState::GetConfiguration().

◆ GetMaestroObject()

◆ GetMaestroObjectWithMute()

void * GetMaestroObjectWithMute ( )

Definition at line 54 of file Interface.cpp.

References isInitialized, and maestroInstance.

◆ GetMultithreading()

int GetMultithreading ( void * sim)

Definition at line 1108 of file Interface.cpp.

References Simulators::IState::GetMultithreading().

◆ GetNumberOfQubits()

unsigned long int GetNumberOfQubits ( void * sim)

Definition at line 895 of file Interface.cpp.

References Simulators::IState::GetNumberOfQubits().

◆ GetSimulationType()

int GetSimulationType ( void * sim)

◆ GetSimulator()

void * GetSimulator ( unsigned long int simHandle)

Definition at line 487 of file Interface.cpp.

References maestroInstance.

◆ GetSimulatorType()

int GetSimulatorType ( void * sim)

Definition at line 1030 of file Interface.cpp.

◆ InitializeSimulator()

int InitializeSimulator ( void * sim)

Definition at line 837 of file Interface.cpp.

References Simulators::IState::Initialize().

◆ IsQcsim()

int IsQcsim ( void * sim)

Definition at line 1117 of file Interface.cpp.

References Simulators::IState::IsQcsim().

◆ Measure()

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

Definition at line 915 of file Interface.cpp.

◆ MeasureNoCollapse()

unsigned long long int MeasureNoCollapse ( void * sim)

Definition at line 1126 of file Interface.cpp.

◆ Probabilities()

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

Definition at line 990 of file Interface.cpp.

◆ Probability()

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

Definition at line 939 of file Interface.cpp.

References Simulators::IState::Probability().

◆ RemoveAllOptimizationSimulatorsAndAdd()

int RemoveAllOptimizationSimulatorsAndAdd ( unsigned long int simHandle,
int simType,
int simExecType )

Definition at line 91 of file Interface.cpp.

References maestroInstance.

◆ ResetSimulator()

int ResetSimulator ( void * sim)

Definition at line 847 of file Interface.cpp.

References Simulators::IState::Reset().

◆ RestoreInternalDestructiveSavedState()

int RestoreInternalDestructiveSavedState ( void * sim)

◆ RestoreState()

int RestoreState ( void * sim)

Definition at line 1088 of file Interface.cpp.

References Simulators::IState::RestoreState().

◆ SampleCounts()

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

Definition at line 1005 of file Interface.cpp.

◆ SaveState()

int SaveState ( void * sim)

Definition at line 1078 of file Interface.cpp.

References Simulators::IState::SaveState().

◆ SaveStateToInternalDestructive()

int SaveStateToInternalDestructive ( void * sim)

◆ SetMultithreading()

int SetMultithreading ( void * sim,
int multithreading )

Definition at line 1098 of file Interface.cpp.

References Simulators::IState::SetMultithreading().

◆ SimpleEstimate()

◆ SimpleExecute()

Variable Documentation

◆ isInitialized

std::atomic_bool isInitialized {false}
static

Definition at line 27 of file Interface.cpp.

Referenced by GetMaestroObject(), and GetMaestroObjectWithMute().

◆ maestroInstance