The Quantum Exact Simulation Toolkit v4.3.0
Loading...
Searching...
No Matches
debug.cpp
1/** @file
2 * Unit tests of the debug module.
3 *
4 * @author Tyson Jones
5 *
6 * @defgroup unitdebug Debug
7 * @ingroup unittests
8 */
9
10#include "quest.h"
11
12#include <catch2/catch_test_macros.hpp>
13#include <catch2/matchers/catch_matchers_string.hpp>
14#include <catch2/generators/catch_generators_range.hpp>
15
16#include "tests/utils/macros.hpp"
17#include "tests/utils/cache.hpp"
18#include "tests/utils/convert.hpp"
19#include "tests/utils/compare.hpp"
20#include "tests/utils/random.hpp"
21
22#include <string>
23#include <vector>
24#include <sstream>
25#include <iostream>
26
27using Catch::Matchers::ContainsSubstring;
28using std::vector;
29
30
31
32/*
33 * UTILITIES
34 */
35
36#define TEST_CATEGORY \
37 LABEL_UNIT_TAG "[debug]"
38
39
40
41/**
42 * TESTS
43 *
44 * @ingroup unitdebug
45 * @{
46 */
47
48
49TEST_CASE( "setQuESTInputErrorHandler", TEST_CATEGORY ) {
50
51 /// @todo
52 /// We can test this by saving the current handler,
53 /// overwriting it to local handlers of our choosing
54 /// and verifying e.g. their error messages are detected,
55 /// then restoring the original handler. Alas, this
56 /// requires exposing the handler in main, else adding
57 /// a quest function for obtaining the user-set handler.
58 /// Both are annoying - I forego them presently! This
59 /// function has anyway been manually tested via examples.
60
61 SUCCEED( );
62}
63
64
65TEST_CASE( "setQuESTMaxNumReportedSigFigs", TEST_CATEGORY ) {
66
67 SECTION( LABEL_CORRECTNESS ) {
68
69 qcomp scalar = getQcomp(0.12345, 0.12345);
70
71 vector<std::string> refs = {
72 "0.1+0.1i",
73 "0.12+0.12i",
74 "0.123+0.123i",
75 "0.1235+0.1235i", // rounded
76 "0.12345+0.12345i"
77 };
78
79 // disable auto \n after lines
81
82 for (size_t numSigFigs=1; numSigFigs<=refs.size(); numSigFigs++) {
83
85
86 // redirect stdout to buffer
87 std::stringstream buffer;
88 std::streambuf * old = std::cout.rdbuf(buffer.rdbuf());
89 reportScalar("", scalar);
90 std::cout.rdbuf(old);
91 std::string out = buffer.str();
92
93 std::string ref = refs[numSigFigs-1];
94
95 CAPTURE( numSigFigs, ref );
96 REQUIRE( out == ref );
97 }
98 }
99
100 SECTION( LABEL_VALIDATION ) {
101
102 SECTION( "number" ) {
103
104 int num = GENERATE( -1, 0 );
105
106 REQUIRE_THROWS_WITH( setQuESTMaxNumReportedSigFigs(num), ContainsSubstring("Cannot be less than one") );
107 }
108 }
109
110 // restore to QuEST default for future tests
112}
113
114
115TEST_CASE( "setQuESTNumReportedNewlines", TEST_CATEGORY ) {
116
117 SECTION( LABEL_CORRECTNESS ) {
118
119 for (int numNewlines=0; numNewlines<3; numNewlines++) {
120
121 setQuESTNumReportedNewlines(numNewlines);
122
123 // redirect stdout to buffer
124 std::stringstream buffer;
125 std::streambuf * old = std::cout.rdbuf(buffer.rdbuf());
126 reportStr("x");
127 std::cout.rdbuf(old);
128 std::string out = buffer.str();
129
130 std::string ref = "x" + std::string(numNewlines, '\n');
131
132 CAPTURE( numNewlines, ref );
133 REQUIRE( out == ref );
134 }
135 }
136
137 SECTION( LABEL_VALIDATION ) {
138
139 SECTION( "number" ) {
140
141 REQUIRE_THROWS_WITH( setQuESTNumReportedNewlines(-1), ContainsSubstring("Cannot generally be less than zero") );
142 }
143
144 SECTION( "multine number" ) {
145
147
148 REQUIRE_THROWS_WITH( reportQuESTEnv(), ContainsSubstring("zero") && ContainsSubstring("not permitted when calling multi-line") );
149 }
150 }
151
152 // restore to QuEST default for future tests
154}
155
156
157TEST_CASE( "setQuESTSeeds", TEST_CATEGORY ) {
158
159 SECTION( LABEL_CORRECTNESS ) {
160
161 // perform the below test for every combination
162 // of deployments, since their RNGs differ
163
164 for (auto& [label, qureg]: getCachedDensmatrs()) {
165
166 DYNAMIC_SECTION( label ) {
167
168 SECTION( "same seed consistency" ) {
169
170 unsigned seeds[] = {123, 543, 755};
171 const int numSeeds = 3;
172 const int numMixedStates = 10;
173 const int numReps = 5;
174
175 // set an arbitrary fixed seed...
176 setQuESTSeeds(seeds, numSeeds);
177
178 // generate and remember a random state
179 initRandomMixedState(qureg, numMixedStates);
180 qmatrix ref = getMatrix(qureg);
181
182 // get a set of random measurement outcomes
183 vector<int> outcomes(qureg.numQubits);
184 for (int i=0; i<qureg.numQubits; i++)
185 outcomes[i] = applyQubitMeasurement(qureg, i);
186
187 // repeatedly...
188 for (int r=0; r<numReps; r++) {
189
190 // reset the seed
191 setQuESTSeeds(seeds, numSeeds);
192
193 // and confirm all random states are re-produced
194 initRandomMixedState(qureg, numMixedStates);
195 REQUIRE_AGREE( qureg, ref);
196
197 // as are all measurement outcomes
198 for (int i=0; i<qureg.numQubits; i++)
199 REQUIRE( outcomes[i] == applyQubitMeasurement(qureg,i) );
200 }
201 }
202
203 SECTION( "different key inconsistency" ) {
204
205 unsigned seeds[] = {123, 543, 755};
206 const int numSeeds = 3;
207 const int ampInd = 0;
208
209 // set arbitrary seed and collect random-state amp
210 setQuESTSeeds(seeds, numSeeds);
211 initRandomPureState(qureg);
212 qcomp amp1 = getDensityQuregAmp(qureg, ampInd, ampInd);
213
214 // change one passed seed and re-collect random-state amp
215 int i = GENERATE_COPY( range(0,numSeeds) );
216 seeds[i] = 987654321;
217 setQuESTSeeds(seeds, numSeeds);
218 initRandomPureState(qureg);
219 qcomp amp2 = getDensityQuregAmp(qureg, ampInd, ampInd);
220
221 // amps differ if seed successfully impacts outcomes
222 REQUIRE( amp1 != amp2 );
223 }
224 }
225 }
226 }
227
228 SECTION( LABEL_VALIDATION ) {
229
230 SECTION( "env not initialised" ) {
231
232 // no way to test this
233 SUCCEED( );
234 }
235
236 SECTION( "number of seeds" ) {
237
238 unsigned seeds[] = { 0 };
239 int numSeeds = GENERATE( -1, 0 );
240
241 REQUIRE_THROWS_WITH( setQuESTSeeds(seeds, numSeeds), ContainsSubstring("Invalid number of random seeds") );
242 }
243
244 SECTION( "invalid pointer" ) {
245
246 int numSeeds = GENERATE( 1, 2 );
247
248 REQUIRE_THROWS_WITH( setQuESTSeeds(nullptr, numSeeds), ContainsSubstring("The given seeds list pointer is NULL") );
249 }
250
251 // inconsistency between nodes is permitted
252 }
253
254 // re-randomise seeds for remaining tests
256}
257
258
259TEST_CASE( "setQuESTSeedsToDefault", TEST_CATEGORY ) {
260
261 SECTION( LABEL_CORRECTNESS ) {
262
263 // perform the below test for every combination
264 // of deployments, since their RNGs differ
265
266 for (auto& [label, qureg]: getCachedDensmatrs()) {
267
268 DYNAMIC_SECTION( label ) {
269
270 SECTION( "different key inconsistency" ) {
271
272 const int ampInd = 0;
273
274 // randomise seed and collect random-state amp
276 initRandomPureState(qureg);
277 qcomp amp1 = getDensityQuregAmp(qureg, ampInd, ampInd);
278
279 // re-randomise seed and collect new random-state amp
281 initRandomPureState(qureg);
282 qcomp amp2 = getDensityQuregAmp(qureg, ampInd, ampInd);
283
284 // amps differ if seed re-randomisation impacts outcomes
285 REQUIRE( amp1 != amp2 );
286 }
287 }
288 }
289 }
290
291 SECTION( LABEL_VALIDATION ) {
292
293 SECTION( "env not initialised" ) {
294
295 // no way to test this
296 SUCCEED( );
297 }
298 }
299
300 // re-randomise seeds for remaining tests
302}
303
304
305TEST_CASE( "getQuESTSeeds", TEST_CATEGORY ) {
306
307 SECTION( LABEL_CORRECTNESS ) {
308
309 SECTION( "can be called immediately" ) {
310
311 REQUIRE_NOTHROW( getQuESTNumSeeds() );
312
313 int numSeeds = getQuESTNumSeeds();
314 vector<unsigned> out(numSeeds);
315
316 REQUIRE_NOTHROW( getQuESTSeeds(out.data()) );
317 }
318
319 SECTION( "correct output" ) {
320
321 GENERATE( range(0,10) );
322
323 // prepare random seeds (using test utils RNG, not QuEST's)
324 int numSeeds = getRandomInt(1, 10);
325 vector<unsigned> in(numSeeds);
326 for (int i=0; i<numSeeds; i++)
327 in[i] = static_cast<unsigned>(getRandomInt(0, 99999));
328
329 // pass seeds to QuEST
330 setQuESTSeeds(in.data(), numSeeds);
331
332 // check we get them back
333 vector<unsigned> out(numSeeds);
334 getQuESTSeeds(out.data());
335 for (int i=0; i<numSeeds; i++)
336 REQUIRE( in[i] == out[i] );
337 }
338 }
339
340 SECTION( LABEL_VALIDATION ) {
341
342 SECTION( "env not initialised" ) {
343
344 // no way to test this
345 SUCCEED( );
346 }
347 }
348
349 // re-randomise seeds for remaining tests
351}
352
353
354TEST_CASE( "getQuESTNumSeeds", TEST_CATEGORY ) {
355
356 SECTION( LABEL_CORRECTNESS ) {
357
358 SECTION( "can be called immediately" ) {
359
360 REQUIRE_NOTHROW( getQuESTNumSeeds() );
361 }
362
363 SECTION( "correct output" ) {
364
365 GENERATE( range(0,10) );
366
367 // prepare random seeds (using test utils RNG, not QuEST's)
368 int numSeeds = getRandomInt(1, 10);
369 vector<unsigned> in(numSeeds);
370 for (int i=0; i<numSeeds; i++)
371 in[i] = static_cast<unsigned>(getRandomInt(0, 99999));
372
373 // pass seeds to QuEST
374 setQuESTSeeds(in.data(), numSeeds);
375
376 // confirm we get out correct number
377 REQUIRE( getQuESTNumSeeds() == numSeeds );
378 }
379 }
380
381 SECTION( LABEL_VALIDATION ) {
382
383 SECTION( "env not initialised" ) {
384
385 // no way to test this
386 SUCCEED( );
387 }
388 }
389
390 // re-randomise seeds for remaining tests
392}
393
394
395TEST_CASE( "setQuESTValidationOn", TEST_CATEGORY ) {
396
397 SECTION( LABEL_CORRECTNESS ) {
398
399 // always safe to call
400 for (int i=0; i<3; i++)
401 REQUIRE_NOTHROW( setQuESTValidationOn() );
402
403 // illegal and caught
404 REQUIRE_THROWS( setQuESTSeeds(nullptr, -99) );
405 }
406
407 SECTION( LABEL_VALIDATION ) {
408
409 // has no validation
410 SUCCEED( );
411 }
412}
413
414
415TEST_CASE( "setQuESTValidationOff", TEST_CATEGORY ) {
416
417 SECTION( LABEL_CORRECTNESS ) {
418
419 // confirm always safe to call
420 for (int i=0; i<3; i++)
421 REQUIRE_NOTHROW( setQuESTValidationOff() );
422
423 // prepare non-unitary matrix
424 CompMatr1 m = getCompMatr1({{1,2},{3,4}});
425 Qureg qureg = createQureg(1);
426
427 // confirm not-unitary error suppressed...
428 REQUIRE_NOTHROW( applyCompMatr1(qureg, 0, m) );
429
430 // which otherwise triggers
432 REQUIRE_THROWS( applyCompMatr1(qureg, 0, m) );
433
434 destroyQureg(qureg);
435 }
436
437 SECTION( LABEL_VALIDATION ) {
438
439 // has no validation
440 SUCCEED( );
441 }
442
443 // ensure validation is on for remaining tests
445}
446
447
448TEST_CASE( "setQuESTValidationEpsilon", TEST_CATEGORY ) {
449
450 SECTION( LABEL_CORRECTNESS ) {
451
452 SECTION( "affects validation" ) {
453
454 Qureg qureg = createQureg(5);
455
456 SECTION( "unitarity" ) {
457
458 // prepare non-unitary matrix
459 CompMatr1 m = getCompMatr1({{1,2},{3,4}});
460
461 // confirm it throws non-unitary error
462 REQUIRE_THROWS( applyCompMatr1(qureg, 0, m) );
463
464 // confirm setting = 0 disables epsilon errors...
466 REQUIRE_NOTHROW( applyCompMatr1(qureg, 0, m) );
467
468 // but does not disable absolute errors
469 REQUIRE_THROWS( applyCompMatr1(qureg, -1, m) );
470
471 // confirm non-zero (forgive all) works
472 setQuESTValidationEpsilon(9999); // bigger than dist of m*conj(m) from identity squared
473 REQUIRE_NOTHROW( applyCompMatr1(qureg, 0, m) );
474 }
475
476 /// @todo
477 /// to be completely rigorous, we should test
478 /// that unitarity, hermiticity, CPTPness and
479 /// non-zero-ness of all of CompMatr, DiagMatr
480 /// and FullStateDiagMatr are affected! This
481 /// is quite a chore of course
482
483 destroyQureg(qureg);
484 }
485
486 SECTION( "affects struct fields" ) {
487
488 SECTION( "CompMatr" ) {
489
491 *(m.isApproxUnitary) = 1;
492 *(m.isApproxHermitian) = 1;
493
495 REQUIRE( *(m.isApproxUnitary) == -1 );
496 REQUIRE( *(m.isApproxHermitian) == -1 );
497
499 }
500
501 SECTION( "DiagMatr" ) {
502
504 *(m.isApproxUnitary) = 1;
505 *(m.isApproxHermitian) = 0;
506 *(m.isApproxNonZero) = 1;
507
509 REQUIRE( *(m.isApproxUnitary) == -1 );
510 REQUIRE( *(m.isApproxHermitian) == -1 );
511 REQUIRE( *(m.isApproxNonZero) == -1 );
512
514 }
515
516 SECTION( "FullStateDiagMatr" ) {
517
519 *(m.isApproxUnitary) = 1;
520 *(m.isApproxHermitian) = 0;
521 *(m.isApproxNonZero) = 1;
522
524 REQUIRE( *(m.isApproxUnitary) == -1 );
525 REQUIRE( *(m.isApproxHermitian) == -1 );
526 REQUIRE( *(m.isApproxNonZero) == -1 );
527
529 }
530
531 SECTION( "KrausMap" ) {
532
533 KrausMap k = createKrausMap(1, 3);
534 *(k.isApproxCPTP) = 1;
535
537 REQUIRE( *(k.isApproxCPTP) == -1 );
538
540 }
541 }
542 }
543
544 SECTION( LABEL_VALIDATION ) {
545
546 SECTION( "negative epsilon" ) {
547
548 qreal eps = GENERATE( -0.5, -1, -100 );
549
550 REQUIRE_THROWS_WITH( setQuESTValidationEpsilon(eps), ContainsSubstring("positive number") );
551 }
552 }
553
554 // ensure validation epsilon is default for remaining tests
556}
557
558
559TEST_CASE( "getQuESTValidationEpsilon", TEST_CATEGORY ) {
560
561 SECTION( LABEL_CORRECTNESS ) {
562
563 // confirm always safe to call
564 for (int i=0; i<3; i++)
565 REQUIRE_NOTHROW( getQuESTValidationEpsilon() ); // ignores output
566
567 GENERATE( range(0,10) );
568
569 // confirm set correctly
570 qreal eps = getRandomReal(0, 99999);
572
573 REQUIRE( getQuESTValidationEpsilon() == eps );
574 }
575
576 SECTION( LABEL_VALIDATION ) {
577
578 // has no validation
579 SUCCEED( );
580 }
581
582 // ensure validation epsilon is default for remaining tests
584}
585
586
587TEST_CASE( "setQuESTValidationEpsilonToDefault", TEST_CATEGORY ) {
588
589 SECTION( LABEL_CORRECTNESS ) {
590
591 SECTION( "always safe to call" ) {
592
593 for (int i=0; i<3; i++)
594 REQUIRE_NOTHROW( setQuESTValidationEpsilonToDefault() );
595 }
596
597 SECTION( "affects validation" ) {
598
599 // prepare non-unitary matrix
600 CompMatr1 m = getCompMatr1({{1,2},{3,4}});
601 Qureg qureg = createQureg(1);
602
603 // confirm it throws non-unitary error
604 REQUIRE_THROWS( applyCompMatr1(qureg, 0, m) );
605
606 // confirm setting = 0 disables epsilon errors...
608 REQUIRE_NOTHROW( applyCompMatr1(qureg, 0, m) );
609
610 // which returns when stored to default
612 REQUIRE_THROWS( applyCompMatr1(qureg, 0, m) );
613
614 destroyQureg(qureg);
615 }
616
617 SECTION( "affects struct fields" ) {
618
619 SECTION( "CompMatr" ) {
620
622 *(m.isApproxUnitary) = 1;
623 *(m.isApproxHermitian) = 1;
624
626 REQUIRE( *(m.isApproxUnitary) == -1 );
627 REQUIRE( *(m.isApproxHermitian) == -1 );
628
630 }
631
632 SECTION( "DiagMatr" ) {
633
635 *(m.isApproxUnitary) = 1;
636 *(m.isApproxHermitian) = 0;
637 *(m.isApproxNonZero) = 1;
638
640 REQUIRE( *(m.isApproxUnitary) == -1 );
641 REQUIRE( *(m.isApproxHermitian) == -1 );
642 REQUIRE( *(m.isApproxNonZero) == -1 );
643
645 }
646
647 SECTION( "FullStateDiagMatr" ) {
648
650 *(m.isApproxUnitary) = 1;
651 *(m.isApproxHermitian) = 0;
652 *(m.isApproxNonZero) = 1;
653
655 REQUIRE( *(m.isApproxUnitary) == -1 );
656 REQUIRE( *(m.isApproxHermitian) == -1 );
657 REQUIRE( *(m.isApproxNonZero) == -1 );
658
660 }
661
662 SECTION( "KrausMap" ) {
663
664 KrausMap k = createKrausMap(1, 3);
665 *(k.isApproxCPTP) = 1;
666
668 REQUIRE( *(k.isApproxCPTP) == -1 );
669
671 }
672 }
673 }
674
675 SECTION( LABEL_VALIDATION ) {
676
677 SECTION( LABEL_VALIDATION ) {
678
679 // performs no validation
680 SUCCEED( );
681 }
682 }
683
684 // ensure validation epsilon is default for remaining tests
686}
687
688
689TEST_CASE( "getQuESTGpuCacheSize", TEST_CATEGORY ) {
690
691 SECTION( LABEL_CORRECTNESS ) {
692
693 // confirm cache begins empty
695 REQUIRE( getQuESTGpuCacheSize() == 0 );
696
697 // hackily detect cuQuantum
698 char envStr[200];
700 bool usingCuQuantum = std::string(envStr).find("cuQuantum=0") == std::string::npos;
701
702 // proceed only if we're ever using our own GPU cache
703 if (getQuESTEnv().isGpuAccelerated && !usingCuQuantum) {
704
705 // GPU cache created for >= 6 qubit matrices
706 Qureg qureg = createCustomQureg(10, 0, 0,1,0); // gpu only
707 CompMatr matr = createCompMatr(6); // always in gpu
708 for (qindex i=0; i<matr.numRows; i++)
709 matr.cpuElems[i][i] = 1;
710 syncCompMatr(matr);
711
712 // each control qubit halves the necessary cache size;
713 // so we start with many controls and remove each in-turn,
714 // expanding the GPU cache in every call
715 int targs[] = {0,1,2,3,4,5};
716 int ctrls[] = {6,7,8,9};
717 qindex cacheSize = 0;
718
719 for (int numCtrls=4; numCtrls>=0; numCtrls--) {
720
721 // expand the cache
722 applyMultiControlledCompMatr(qureg, ctrls, numCtrls, targs, 6, matr);
723
724 // confirm it expanded, OR stayed the same, which happens when
725 // the total number of simultaneous threads needed hits/exceeds
726 // the number available in the hardware
727 qindex newSize = getQuESTGpuCacheSize();
728 CAPTURE( cacheSize, newSize );
729 REQUIRE( newSize >= cacheSize );
730
731 cacheSize = newSize;
732 }
733
734 destroyQureg(qureg);
735 destroyCompMatr(matr);
736 }
737 }
738
739 SECTION( LABEL_VALIDATION ) {
740
741 // performs no validation
742 SUCCEED( );
743 }
744}
745
746
747/** @} (end defgroup) */
748
749
750
751/**
752 * @todo
753 * UNTESTED FUNCTIONS
754 */
755
756
757void setQuESTMaxNumReportedItems(qindex numRows, qindex numCols);
758
759void getQuESTEnvironmentString(char str[200]);
760
761void setQuESTReportedPauliChars(const char* paulis);
762
763void setQuESTReportedPauliStrStyle(int style);
KrausMap createKrausMap(int numQubits, int numOperators)
Definition channels.cpp:176
void destroyKrausMap(KrausMap map)
Definition channels.cpp:210
qindex getQuESTGpuCacheSize()
Definition debug.cpp:180
void clearQuESTGpuCache()
Definition debug.cpp:191
void getQuESTEnvironmentString(char str[200])
void setQuESTReportedPauliChars(const char *paulis)
Definition debug.cpp:158
void setQuESTMaxNumReportedItems(qindex numRows, qindex numCols)
Definition debug.cpp:128
void setQuESTMaxNumReportedSigFigs(int numSigFigs)
Definition debug.cpp:142
void setQuESTReportedPauliStrStyle(int style)
Definition debug.cpp:166
void setQuESTNumReportedNewlines(int numNewlines)
Definition debug.cpp:150
int getQuESTNumSeeds()
Definition debug.cpp:52
void setQuESTSeeds(unsigned *seeds, int numSeeds)
Definition debug.cpp:37
void setQuESTSeedsToDefault()
Definition debug.cpp:45
void getQuESTSeeds(unsigned *seeds)
Definition debug.cpp:58
void setQuESTValidationOff()
Definition debug.cpp:86
void setQuESTValidationEpsilonToDefault()
Definition debug.cpp:108
qreal getQuESTValidationEpsilon()
Definition debug.cpp:115
void setQuESTValidationEpsilon(qreal eps)
Definition debug.cpp:100
void setQuESTValidationOn()
Definition debug.cpp:80
void reportQuESTEnv()
QuESTEnv getQuESTEnv()
void initRandomPureState(Qureg qureg)
void initRandomMixedState(Qureg qureg, qindex numPureStates)
FullStateDiagMatr createFullStateDiagMatr(int numQubits)
Definition matrices.cpp:323
CompMatr createCompMatr(int numQubits)
Definition matrices.cpp:213
DiagMatr createDiagMatr(int numQubits)
Definition matrices.cpp:248
void destroyDiagMatr(DiagMatr matrix)
Definition matrices.cpp:399
void destroyFullStateDiagMatr(FullStateDiagMatr matrix)
Definition matrices.cpp:400
void destroyCompMatr(CompMatr matrix)
Definition matrices.cpp:398
static CompMatr1 getCompMatr1(qcomp **in)
Definition matrices.h:811
void syncCompMatr(CompMatr matr)
Definition matrices.cpp:373
void applyCompMatr1(Qureg qureg, int target, CompMatr1 matrix)
void applyMultiControlledCompMatr(Qureg qureg, int *controls, int numControls, int *targets, int numTargets, CompMatr matrix)
int applyQubitMeasurement(Qureg qureg, int target)
Qureg createCustomQureg(int numQubits, int isDensMatr, int useDistrib, int useGpuAccel, int useMultithread)
Definition qureg.cpp:283
Qureg createQureg(int numQubits)
Definition qureg.cpp:289
void destroyQureg(Qureg qureg)
Definition qureg.cpp:340
qcomp getDensityQuregAmp(Qureg qureg, qindex row, qindex column)
Definition qureg.cpp:514
qreal getRandomReal(qreal min, qreal maxExcl)
Definition random.cpp:63
int getRandomInt(int min, int maxExcl)
Definition random.cpp:90
void reportStr(const char *str)
Definition types.cpp:33
static qcomp getQcomp(qreal re, qreal im)
Definition types.h:91
void reportScalar(const char *label, qcomp num)
Definition types.cpp:55
TEST_CASE("setQuESTInputErrorHandler", TEST_CATEGORY)
Definition debug.cpp:49
qindex numRows
Definition matrices.h:179
int * isApproxHermitian
Definition matrices.h:221
int * isApproxUnitary
Definition matrices.h:198
qcomp ** cpuElems
Definition matrices.h:261
int * isApproxNonZero
Definition matrices.h:460
int * isApproxUnitary
Definition matrices.h:438
int * isApproxHermitian
Definition matrices.h:449
int * isApproxUnitary
Definition matrices.h:628
int * isApproxHermitian
Definition matrices.h:636
int * isApproxNonZero
Definition matrices.h:647
int * isApproxCPTP
Definition channels.h:301
Definition qureg.h:49