Maestro 0.3.11
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Simulator.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "MaestroLib.hpp"
4
6{
7 public:
10
11 SimpleSimulator() noexcept
12 {
13 }
14
16 {
17 if (handle)
19 }
20
21 bool Init(const char *libName) noexcept override
22 {
23 if (MaestroLibrary::Init(libName))
24 return true;
25
26 return false;
27 }
28
29 unsigned long int CreateSimpleSimulator(int nrQubits) override
30 {
31 if (handle)
33
35
36 return handle;
37 }
38
39 bool RemoveAllOptimizationSimulatorsAndAdd(int simType, int simExecType)
40 {
41 if (handle)
42 return MaestroLibrary::RemoveAllOptimizationSimulatorsAndAdd(handle, simType, simExecType) == 1;
43
44 return false;
45 }
46
47 bool AddOptimizationSimulator(int simType, int simExecType)
48 {
49 if (handle)
50 return MaestroLibrary::AddOptimizationSimulator(handle, simType, simExecType) == 1;
51
52 return false;
53 }
54
55 char *SimpleExecute(const char *jsonCircuit, const char *jsonConfig)
56 {
57 return MaestroLibrary::SimpleExecute(handle, jsonCircuit, jsonConfig);
58 }
59
60 char *SimpleEstimate(const char *jsonCircuit, const char *observableStr, const char *jsonConfig)
61 {
62 return MaestroLibrary::SimpleEstimate(handle, jsonCircuit, observableStr, jsonConfig);
63 }
64
65 void FreeResult(char *result) override
66 {
68 }
69
70 private:
71 unsigned long int handle = 0;
72};
73
74class Simulator : protected MaestroLibrary
75{
76 public:
79
80 Simulator() noexcept
81 {
82 }
83
84 virtual ~Simulator()
85 {
86 if (handle)
87 DestroySimulator(handle);
88 }
89
90 bool Init(const char *libName) noexcept override
91 {
92 if (MaestroLibrary::Init(libName))
93 return true;
94
95 return false;
96 }
97
98 unsigned long int CreateSimulator(int simType, int simExecType) override
99 {
100 if (handle)
101 DestroySimulator(handle);
102
103 handle = MaestroLibrary::CreateSimulator(simType, simExecType);
104
105 if (handle)
106 simulatorPtr = MaestroLibrary::GetSimulator(handle);
107
108 return handle;
109 }
110
112 {
113 return MaestroLibrary::GetSimulator(handle);
114 }
115
116 std::vector<double> ExpectationValues(const std::vector<std::string> &paulis)
117 {
118 return MaestroLibrary::ExpectationValues(simulatorPtr, paulis);
119 }
120
121 std::vector<std::complex<double>> GetStateVector()
122 {
123 return MaestroLibrary::GetStateVector(simulatorPtr);
124 }
125
126 std::complex<double> ExpectationValueOperators(const std::vector<unsigned long> &qubits, const std::vector<std::array<std::complex<double>, 4>> &matrices)
127 {
128 return MaestroLibrary::ExpectationValueOperators(simulatorPtr, qubits, matrices);
129 }
130
131 void MoveAtBeginningOfChain(const std::vector<unsigned long> &qubits)
132 {
133 MaestroLibrary::MoveAtBeginningOfChain(simulatorPtr, qubits);
134 }
135
136 std::vector<std::complex<double>> ExpectationValuesComplex(const std::vector<std::string> &paulis, bool normalized = true)
137 {
138 return MaestroLibrary::ExpectationValuesComplex(simulatorPtr, paulis, normalized);
139 }
140
141 void FreeResult(char *result) override
142 {
144 }
145
147 {
148 if (simulatorPtr)
149 return MaestroLibrary::InitializeSimulator(simulatorPtr);
150 return 0;
151 }
152
154 {
155 if (simulatorPtr)
156 return MaestroLibrary::ResetSimulator(simulatorPtr);
157 return 0;
158 }
159
160 int ConfigureSimulator(const char *key, const char *value)
161 {
162 if (simulatorPtr)
163 return MaestroLibrary::ConfigureSimulator(simulatorPtr, key, value);
164 return 0;
165 }
166
167 char *GetConfiguration(const char *key)
168 {
169 if (simulatorPtr)
170 return MaestroLibrary::GetConfiguration(simulatorPtr, key);
171 return nullptr;
172 }
173
174 unsigned long int AllocateQubits(unsigned long int nrQubits)
175 {
176 if (simulatorPtr)
177 return MaestroLibrary::AllocateQubits(simulatorPtr, nrQubits);
178 return 0;
179 }
180
181 unsigned long int GetNumberOfQubits()
182 {
183 if (simulatorPtr)
184 return MaestroLibrary::GetNumberOfQubits(simulatorPtr);
185 return 0;
186 }
187
189 {
190 if (simulatorPtr)
191 return MaestroLibrary::ClearSimulator(simulatorPtr);
192 return 0;
193 }
194
195 unsigned long long int Measure(const unsigned long int *qubits, unsigned long int nrQubits)
196 {
197 if (simulatorPtr)
198 return MaestroLibrary::Measure(simulatorPtr, qubits, nrQubits);
199
200 return 0;
201 }
202
203 int ApplyReset(const unsigned long int *qubits, unsigned long int nrQubits)
204 {
205 if (simulatorPtr)
206 return MaestroLibrary::ApplyReset(simulatorPtr, qubits, nrQubits);
207 return 0;
208 }
209
210 double Probability(unsigned long long int outcome)
211 {
212 if (simulatorPtr)
213 return MaestroLibrary::Probability(simulatorPtr, outcome);
214
215 return 0.0;
216 }
217
218 void FreeDoubleVector(double *vec) override
219 {
221 }
222
223 void FreeULLIVector(unsigned long long int *vec) override
224 {
226 }
227
228 double *Amplitude(unsigned long long int outcome)
229 {
230 if (simulatorPtr)
231 return MaestroLibrary::Amplitude(simulatorPtr, outcome);
232 return nullptr;
233 }
234
236 {
237 if (simulatorPtr)
238 return MaestroLibrary::AllProbabilities(simulatorPtr);
239 return nullptr;
240 }
241
242 double *Probabilities(const unsigned long long int *qubits, unsigned long int nrQubits)
243 {
244 if (simulatorPtr)
245 return MaestroLibrary::Probabilities(simulatorPtr, qubits, nrQubits);
246 return nullptr;
247 }
248
249 unsigned long long int *SampleCounts(const unsigned long long int *qubits, unsigned long int nrQubits, unsigned long int shots)
250 {
251 if (simulatorPtr)
252 return MaestroLibrary::SampleCounts(simulatorPtr, qubits, nrQubits, shots);
253 return nullptr;
254 }
255
257 {
258 if (simulatorPtr)
259 return MaestroLibrary::GetSimulatorType(simulatorPtr);
260 return -1;
261 }
262
264 {
265 if (simulatorPtr)
266 return MaestroLibrary::GetSimulationType(simulatorPtr);
267 return -1;
268 }
269
271 {
272 return simulatorPtr ? MaestroLibrary::GetGateFusionMaxQubits(simulatorPtr) : 0;
273 }
274
276 {
277 return simulatorPtr ? MaestroLibrary::IsGateFusionEnabled(simulatorPtr) : 0;
278 }
279
281 {
282 return simulatorPtr ? MaestroLibrary::GetGateFusionStatistics(simulatorPtr, statistics) : 0;
283 }
284
285 int ApplyGenericOneQubitGate(unsigned long q0, const double *matrix)
286 {
287 return simulatorPtr ? MaestroLibrary::ApplyGenericOneQubitGate(simulatorPtr, q0, matrix) : 0;
288 }
289
290 int ApplyGenericTwoQubitGate(unsigned long q0, unsigned long q1, const double *matrix)
291 {
292 return simulatorPtr ? MaestroLibrary::ApplyGenericTwoQubitGate(simulatorPtr, q0, q1, matrix) : 0;
293 }
294
295 int ApplyGenericThreeQubitGate(unsigned long q0, unsigned long q1, unsigned long q2, const double *matrix)
296 {
297 return simulatorPtr ? MaestroLibrary::ApplyGenericThreeQubitGate(simulatorPtr, q0, q1, q2, matrix) : 0;
298 }
299
301 {
302 if (simulatorPtr)
303 return MaestroLibrary::FlushSimulator(simulatorPtr);
304 return 0;
305 }
306
308 {
309 if (simulatorPtr)
311 return 0;
312 }
313
315 {
316 if (simulatorPtr)
318 return 0;
319 }
320
322 {
323 if (simulatorPtr)
324 return MaestroLibrary::SaveState(simulatorPtr);
325 return 0;
326 }
327
329 {
330 if (simulatorPtr)
331 return MaestroLibrary::RestoreState(simulatorPtr);
332 return 0;
333 }
334
335 int SetMultithreading(int multithreading)
336 {
337 if (simulatorPtr)
338 return MaestroLibrary::SetMultithreading(simulatorPtr, multithreading);
339 return 0;
340 }
341
343 {
344 if (simulatorPtr)
345 return MaestroLibrary::GetMultithreading(simulatorPtr);
346 return 0;
347 }
348
350 {
351 if (simulatorPtr)
352 return MaestroLibrary::IsQcsim(simulatorPtr);
353 return 0;
354 }
355
356 unsigned long long int MeasureNoCollapse()
357 {
358 if (simulatorPtr)
359 return MaestroLibrary::MeasureNoCollapse(simulatorPtr);
360 return 0;
361 }
362
363 int ApplyX(int qubit)
364 {
365 if (simulatorPtr)
366 return MaestroLibrary::ApplyX(simulatorPtr, qubit);
367 return 0;
368 }
369
370 int ApplyY(int qubit)
371 {
372 if (simulatorPtr)
373 return MaestroLibrary::ApplyY(simulatorPtr, qubit);
374 return 0;
375 }
376
377 int ApplyZ(int qubit)
378 {
379 if (simulatorPtr)
380 return MaestroLibrary::ApplyZ(simulatorPtr, qubit);
381 return 0;
382 }
383
384 int ApplyH(int qubit)
385 {
386 if (simulatorPtr)
387 return MaestroLibrary::ApplyH(simulatorPtr, qubit);
388 return 0;
389 }
390
391 int ApplyS(int qubit)
392 {
393 if (simulatorPtr)
394 return MaestroLibrary::ApplyS(simulatorPtr, qubit);
395 return 0;
396 }
397
398 int ApplySDG(int qubit)
399 {
400 if (simulatorPtr)
401 return MaestroLibrary::ApplySDG(simulatorPtr, qubit);
402 return 0;
403 }
404
405 int ApplyT(int qubit)
406 {
407 if (simulatorPtr)
408 return MaestroLibrary::ApplyT(simulatorPtr, qubit);
409 return 0;
410 }
411
412 int ApplyTDG(int qubit)
413 {
414 if (simulatorPtr)
415 return MaestroLibrary::ApplyTDG(simulatorPtr, qubit);
416 return 0;
417 }
418
419 int ApplySX(int qubit)
420 {
421 if (simulatorPtr)
422 return MaestroLibrary::ApplySX(simulatorPtr, qubit);
423 return 0;
424 }
425
426 int ApplySXDG(int qubit)
427 {
428 if (simulatorPtr)
429 return MaestroLibrary::ApplySXDG(simulatorPtr, qubit);
430 return 0;
431 }
432
433 int ApplyK(int qubit)
434 {
435 if (simulatorPtr)
436 return MaestroLibrary::ApplyK(simulatorPtr, qubit);
437 return 0;
438 }
439
440 int ApplyP(int qubit, double theta)
441 {
442 if (simulatorPtr)
443 return MaestroLibrary::ApplyP(simulatorPtr, qubit, theta);
444 return 0;
445 }
446
447 int ApplyRx(int qubit, double theta)
448 {
449 if (simulatorPtr)
450 return MaestroLibrary::ApplyRx(simulatorPtr, qubit, theta);
451 return 0;
452 }
453
454 int ApplyRy(int qubit, double theta)
455 {
456 if (simulatorPtr)
457 return MaestroLibrary::ApplyRy(simulatorPtr, qubit, theta);
458 return 0;
459 }
460
461 int ApplyRz(int qubit, double theta)
462 {
463 if (simulatorPtr)
464 return MaestroLibrary::ApplyRz(simulatorPtr, qubit, theta);
465 return 0;
466 }
467
468 int ApplyU(int qubit, double theta, double phi, double lambda, double gamma)
469 {
470 if (simulatorPtr)
471 return MaestroLibrary::ApplyU(simulatorPtr, qubit, theta, phi, lambda, gamma);
472 return 0;
473 }
474
475 int ApplyCX(int controlQubit, int targetQubit)
476 {
477 if (simulatorPtr)
478 return MaestroLibrary::ApplyCX(simulatorPtr, controlQubit, targetQubit);
479 return 0;
480 }
481
482 int ApplyCY(int controlQubit, int targetQubit)
483 {
484 if (simulatorPtr)
485 return MaestroLibrary::ApplyCY(simulatorPtr, controlQubit, targetQubit);
486 return 0;
487 }
488
489 int ApplyCZ(int controlQubit, int targetQubit)
490 {
491 if (simulatorPtr)
492 return MaestroLibrary::ApplyCZ(simulatorPtr, controlQubit, targetQubit);
493 return 0;
494 }
495
496 int ApplyCH(int controlQubit, int targetQubit)
497 {
498 if (simulatorPtr)
499 return MaestroLibrary::ApplyCH(simulatorPtr, controlQubit, targetQubit);
500 return 0;
501 }
502
503 int ApplyCSX(int controlQubit, int targetQubit)
504 {
505 if (simulatorPtr)
506 return MaestroLibrary::ApplyCSX(simulatorPtr, controlQubit, targetQubit);
507 return 0;
508 }
509
510 int ApplyCSXDG(int controlQubit, int targetQubit)
511 {
512 if (simulatorPtr)
513 return MaestroLibrary::ApplyCSXDG(simulatorPtr, controlQubit, targetQubit);
514 return 0;
515 }
516
517 int ApplyCP(int controlQubit, int targetQubit, double theta)
518 {
519 if (simulatorPtr)
520 return MaestroLibrary::ApplyCP(simulatorPtr, controlQubit, targetQubit, theta);
521 return 0;
522 }
523
524 int ApplyCRx(int controlQubit, int targetQubit, double theta)
525 {
526 if (simulatorPtr)
527 return MaestroLibrary::ApplyCRx(simulatorPtr, controlQubit, targetQubit, theta);
528 return 0;
529 }
530
531 int ApplyCRy(int controlQubit, int targetQubit, double theta)
532 {
533 if (simulatorPtr)
534 return MaestroLibrary::ApplyCRy(simulatorPtr, controlQubit, targetQubit, theta);
535 return 0;
536 }
537
538 int ApplyCRz(int controlQubit, int targetQubit, double theta)
539 {
540 if (simulatorPtr)
541 return MaestroLibrary::ApplyCRz(simulatorPtr, controlQubit, targetQubit, theta);
542 return 0;
543 }
544
545 int ApplyCCX(int controlQubit1, int controlQubit2, int targetQubit)
546 {
547 if (simulatorPtr)
548 return MaestroLibrary::ApplyCCX(simulatorPtr, controlQubit1, controlQubit2, targetQubit);
549 return 0;
550 }
551
552 int ApplySwap(int qubit1, int qubit2)
553 {
554 if (simulatorPtr)
555 return MaestroLibrary::ApplySwap(simulatorPtr, qubit1, qubit2);
556 return 0;
557 }
558
559 int ApplyCSwap(int controlQubit, int qubit1, int qubit2)
560 {
561 if (simulatorPtr)
562 return MaestroLibrary::ApplyCSwap(simulatorPtr, controlQubit, qubit1, qubit2);
563 return 0;
564 }
565
566 int ApplyCU(int controlQubit, int targetQubit, double theta, double phi, double lambda, double gamma)
567 {
568 if (simulatorPtr)
569 return MaestroLibrary::ApplyCU(simulatorPtr, controlQubit, targetQubit, theta, phi, lambda, gamma);
570 return 0;
571 }
572
573 private:
574 unsigned long int handle = 0;
575 void *simulatorPtr = nullptr;
576};
int ApplyCCX(void *sim, int controlQubit1, int controlQubit2, int targetQubit)
int ResetSimulator(void *sim)
void * GetSimulator(unsigned long int simHandle)
int ApplyGenericThreeQubitGate(void *sim, unsigned long q0, unsigned long q1, unsigned long q2, const double *matrix)
int IsGateFusionEnabled(void *sim)
int ApplyCZ(void *sim, int controlQubit, int targetQubit)
unsigned long int AllocateQubits(void *sim, unsigned long int nrQubits)
int ConfigureSimulator(void *sim, const char *key, const char *value)
int ApplyGenericTwoQubitGate(void *sim, unsigned long q0, unsigned long q1, const double *matrix)
unsigned long long int * SampleCounts(void *sim, const unsigned long long int *qubits, unsigned long int nrQubits, unsigned long int shots)
int ApplySXDG(void *sim, int qubit)
int ApplyS(void *sim, int qubit)
int GetSimulationType(void *sim)
std::string ValidateRequestJson(const std::string &request)
int GetSimulatorType(void *sim)
int ApplyH(void *sim, int qubit)
double * AllProbabilities(void *sim)
unsigned long long int Measure(void *sim, const unsigned long int *qubits, unsigned long int nrQubits)
int ApplySDG(void *sim, int qubit)
int RemoveAllOptimizationSimulatorsAndAdd(unsigned long int simHandle, int simType, int simExecType)
int ApplyT(void *sim, int qubit)
int ApplyY(void *sim, int qubit)
int ApplySX(void *sim, int qubit)
int SaveState(void *sim)
int ApplyX(void *sim, int qubit)
int ApplyCY(void *sim, int controlQubit, int targetQubit)
int ApplyCX(void *sim, int controlQubit, int targetQubit)
void DestroySimpleSimulator(unsigned long int simHandle)
int ApplyCRx(void *sim, int controlQubit, int targetQubit, double theta)
int ApplyGenericOneQubitGate(void *sim, unsigned long q0, const double *matrix)
int ClearSimulator(void *sim)
int ApplyCSX(void *sim, int controlQubit, int targetQubit)
int ApplyK(void *sim, int qubit)
char * SimpleExecute(unsigned long int simpleSim, const char *jsonCircuit, const char *jsonConfig)
int RestoreState(void *sim)
std::complex< double > ExpectationValueOperators(void *sim, const std::vector< unsigned long > &qubits, const std::vector< std::array< std::complex< double >, 4 > > &matrices)
int ApplyCRz(void *sim, int controlQubit, int targetQubit, double theta)
unsigned GetGateFusionMaxQubits(void *sim)
double * Amplitude(void *sim, unsigned long long int outcome)
std::vector< std::complex< double > > ExpectationValuesComplex(void *sim, const std::vector< std::string > &paulis, bool normalized=true)
int AddOptimizationSimulator(unsigned long int simHandle, int simType, int simExecType)
virtual unsigned long int CreateSimpleSimulator(int nrQubits)
char * SimpleEstimate(unsigned long int simpleSim, const char *jsonCircuit, const char *observableStr, const char *jsonConfig)
double Probability(void *sim, unsigned long long int outcome)
int ApplyCH(void *sim, int controlQubit, int targetQubit)
int GetGateFusionStatistics(void *sim, MaestroGateFusionStatistics *statistics)
int ApplyCSwap(void *sim, int controlQubit, int qubit1, int qubit2)
virtual void FreeULLIVector(unsigned long long int *vec)
int IsQcsim(void *sim)
virtual unsigned long int CreateSimulator(int simType, int simExecType)
int ApplyCSXDG(void *sim, int controlQubit, int targetQubit)
int SaveStateToInternalDestructive(void *sim)
virtual void FreeDoubleVector(double *vec)
int ApplyCRy(void *sim, int controlQubit, int targetQubit, double theta)
double * Probabilities(void *sim, const unsigned long long int *qubits, unsigned long int nrQubits)
int ApplyRz(void *sim, int qubit, double theta)
MaestroLibrary(const MaestroLibrary &)=delete
int ApplySwap(void *sim, int qubit1, int qubit2)
void DestroySimulator(unsigned long int simHandle)
int ApplyU(void *sim, int qubit, double theta, double phi, double lambda, double gamma)
int ApplyZ(void *sim, int qubit)
std::string RunRequestJson(const std::string &request)
int RestoreInternalDestructiveSavedState(void *sim)
int ApplyCU(void *sim, int controlQubit, int targetQubit, double theta, double phi, double lambda, double gamma)
int ApplyReset(void *sim, const unsigned long int *qubits, unsigned long int nrQubits)
int InitializeSimulator(void *sim)
int ApplyP(void *sim, int qubit, double theta)
int ApplyRy(void *sim, int qubit, double theta)
bool Init(const char *libName) noexcept override
int ApplyCP(void *sim, int controlQubit, int targetQubit, double theta)
int FlushSimulator(void *sim)
int GetMultithreading(void *sim)
void MoveAtBeginningOfChain(void *sim, const std::vector< unsigned long > &qubits)
virtual void FreeResult(char *result)
std::vector< std::complex< double > > GetStateVector(void *sim)
int ApplyRx(void *sim, int qubit, double theta)
unsigned long int GetNumberOfQubits(void *sim)
char * GetConfiguration(void *sim, const char *key)
int ApplyTDG(void *sim, int qubit)
std::vector< double > ExpectationValues(void *sim, const std::vector< std::string > &paulis)
unsigned long long int MeasureNoCollapse(void *sim)
int SetMultithreading(void *sim, int multithreading)
SimpleSimulator() noexcept
Definition Simulator.hpp:11
bool AddOptimizationSimulator(int simType, int simExecType)
Definition Simulator.hpp:47
virtual ~SimpleSimulator()
Definition Simulator.hpp:15
char * SimpleEstimate(const char *jsonCircuit, const char *observableStr, const char *jsonConfig)
Definition Simulator.hpp:60
unsigned long int CreateSimpleSimulator(int nrQubits) override
Definition Simulator.hpp:29
char * SimpleExecute(const char *jsonCircuit, const char *jsonConfig)
Definition Simulator.hpp:55
void FreeResult(char *result) override
Definition Simulator.hpp:65
bool Init(const char *libName) noexcept override
Definition Simulator.hpp:21
bool RemoveAllOptimizationSimulatorsAndAdd(int simType, int simExecType)
Definition Simulator.hpp:39
int ApplySXDG(int qubit)
int ApplyCSXDG(int controlQubit, int targetQubit)
int ApplyS(int qubit)
std::vector< std::complex< double > > ExpectationValuesComplex(const std::vector< std::string > &paulis, bool normalized=true)
bool Init(const char *libName) noexcept override
Definition Simulator.hpp:90
int ApplyTDG(int qubit)
int ApplyZ(int qubit)
unsigned long int AllocateQubits(unsigned long int nrQubits)
int ApplyCH(int controlQubit, int targetQubit)
int IsQcsim()
int ApplyCSwap(int controlQubit, int qubit1, int qubit2)
int ApplyCY(int controlQubit, int targetQubit)
int ApplyCZ(int controlQubit, int targetQubit)
int ApplyGenericThreeQubitGate(unsigned long q0, unsigned long q1, unsigned long q2, const double *matrix)
int SaveStateToInternalDestructive()
unsigned long int CreateSimulator(int simType, int simExecType) override
Definition Simulator.hpp:98
double * Probabilities(const unsigned long long int *qubits, unsigned long int nrQubits)
double * AllProbabilities()
int ApplyT(int qubit)
int ApplyCRy(int controlQubit, int targetQubit, double theta)
std::vector< std::complex< double > > GetStateVector()
int ApplyP(int qubit, double theta)
void FreeULLIVector(unsigned long long int *vec) override
int GetSimulationType()
int RestoreState()
int InitializeSimulator()
int ApplyCP(int controlQubit, int targetQubit, double theta)
double * Amplitude(unsigned long long int outcome)
std::complex< double > ExpectationValueOperators(const std::vector< unsigned long > &qubits, const std::vector< std::array< std::complex< double >, 4 > > &matrices)
char * GetConfiguration(const char *key)
int ApplyCRz(int controlQubit, int targetQubit, double theta)
int ApplyGenericTwoQubitGate(unsigned long q0, unsigned long q1, const double *matrix)
Simulator() noexcept
Definition Simulator.hpp:80
void FreeResult(char *result) override
void FreeDoubleVector(double *vec) override
void MoveAtBeginningOfChain(const std::vector< unsigned long > &qubits)
int ApplySwap(int qubit1, int qubit2)
int ApplyRy(int qubit, double theta)
int RestoreInternalDestructiveSavedState()
int ApplyRz(int qubit, double theta)
double Probability(unsigned long long int outcome)
int ApplyY(int qubit)
int ApplyCX(int controlQubit, int targetQubit)
int ApplySX(int qubit)
int ApplyCSX(int controlQubit, int targetQubit)
int ApplyH(int qubit)
int GetSimulatorType()
void * GetSimulator()
int ApplyCRx(int controlQubit, int targetQubit, double theta)
int IsGateFusionEnabled()
virtual ~Simulator()
Definition Simulator.hpp:84
int ResetSimulator()
int GetGateFusionStatistics(MaestroGateFusionStatistics *statistics)
int GetMultithreading()
std::vector< double > ExpectationValues(const std::vector< std::string > &paulis)
int ApplySDG(int qubit)
int SaveState()
unsigned GetGateFusionMaxQubits()
unsigned long long int MeasureNoCollapse()
int ConfigureSimulator(const char *key, const char *value)
unsigned long long int Measure(const unsigned long int *qubits, unsigned long int nrQubits)
unsigned long long int * SampleCounts(const unsigned long long int *qubits, unsigned long int nrQubits, unsigned long int shots)
int ApplyU(int qubit, double theta, double phi, double lambda, double gamma)
int ApplyGenericOneQubitGate(unsigned long q0, const double *matrix)
int ApplyRx(int qubit, double theta)
int ApplyX(int qubit)
int ApplyK(int qubit)
int ApplyReset(const unsigned long int *qubits, unsigned long int nrQubits)
int ClearSimulator()
unsigned long int GetNumberOfQubits()
int FlushSimulator()
int SetMultithreading(int multithreading)
int ApplyCCX(int controlQubit1, int controlQubit2, int targetQubit)
int ApplyCU(int controlQubit, int targetQubit, double theta, double phi, double lambda, double gamma)