forked from QuEST-Kit/QuEST
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuEST__cpu__distributed_8c.html
3753 lines (3569 loc) · 420 KB
/
QuEST__cpu__distributed_8c.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- For Mobile Devices -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<title>QuEST: QuEST_cpu_distributed.c File Reference</title>
<!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css"/>
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="jquery.smartmenus.js"></script>
<!-- SmartMenus jQuery Bootstrap Addon -->
<script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
<!-- SmartMenus jQuery plugin -->
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand"><img alt="Logo" src="logo.png"/></a>
<a class="navbar-brand"><b>QuEST</b> v3.2.0<br>The Quantum Exact Simulation Toolkit</a>
</div>
</div>
</nav>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div class="content" id="content">
<div class="container">
<div class="row">
<div class="col-sm-12 panel " style="padding-bottom: 15px;">
<div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_d522931ffa1371640980b621734a4381.html">Users</a></li><li class="navelem"><a class="el" href="dir_70834f0dcd10de01d2e35ab402a2238e.html">tysonjones</a></li><li class="navelem"><a class="el" href="dir_1957401ef452be7528010ba0f4832a45.html">Desktop</a></li><li class="navelem"><a class="el" href="dir_dee4414d5d72b49a9429e079789ffd08.html">GithubRepos</a></li><li class="navelem"><a class="el" href="dir_a89b43d59316bb5045aa22bb53a67d29.html">QuEST</a></li><li class="navelem"><a class="el" href="dir_f1fe56bf5ef15ff22696c757278c6962.html">QuEST</a></li><li class="navelem"><a class="el" href="dir_757750313c878cfe3b7d1ade55b4b819.html">src</a></li><li class="navelem"><a class="el" href="dir_b42f528141150d9931abf34c4623dde5.html">CPU</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">QuEST_cpu_distributed.c File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include "<a class="el" href="QuEST_8h_source.html">QuEST.h</a>"</code><br />
<code>#include "<a class="el" href="QuEST__internal_8h_source.html">QuEST_internal.h</a>"</code><br />
<code>#include "<a class="el" href="QuEST__precision_8h_source.html">QuEST_precision.h</a>"</code><br />
<code>#include "<a class="el" href="QuEST__validation_8h_source.html">QuEST_validation.h</a>"</code><br />
<code>#include "<a class="el" href="mt19937ar_8h_source.html">mt19937ar.h</a>"</code><br />
<code>#include "<a class="el" href="QuEST__cpu__internal_8h_source.html">QuEST_cpu_internal.h</a>"</code><br />
<code>#include <unistd.h></code><br />
<code>#include <mpi.h></code><br />
<code>#include <stdlib.h></code><br />
<code>#include <stdio.h></code><br />
<code>#include <string.h></code><br />
<code>#include <math.h></code><br />
<code>#include <time.h></code><br />
<code>#include <sys/types.h></code><br />
</div>
<p><a href="QuEST__cpu__distributed_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ad3d8a3bd0c0b677acef144f2c2ef6d73"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ad3d8a3bd0c0b677acef144f2c2ef6d73">_BSD_SOURCE</a></td></tr>
<tr class="separator:ad3d8a3bd0c0b677acef144f2c2ef6d73"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a0552889d6f57d9e0ed8b209bf426482d"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a0552889d6f57d9e0ed8b209bf426482d">chunkIsUpper</a> (int chunkId, long long int chunkSize, int targetQubit)</td></tr>
<tr class="memdesc:a0552889d6f57d9e0ed8b209bf426482d"><td class="mdescLeft"> </td><td class="mdescRight">Returns whether a given chunk in position chunkId is in the upper or lower half of a block. <a href="QuEST__cpu__distributed_8c.html#a0552889d6f57d9e0ed8b209bf426482d">More...</a><br /></td></tr>
<tr class="separator:a0552889d6f57d9e0ed8b209bf426482d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa3c2d644a2be7f0d3aa9f757527d306f"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#aa3c2d644a2be7f0d3aa9f757527d306f">chunkIsUpperInOuterBlock</a> (int chunkId, long long int chunkSize, int targetQubit, int numQubits)</td></tr>
<tr class="memdesc:aa3c2d644a2be7f0d3aa9f757527d306f"><td class="mdescLeft"> </td><td class="mdescRight">fix – do with masking instead <a href="QuEST__cpu__distributed_8c.html#aa3c2d644a2be7f0d3aa9f757527d306f">More...</a><br /></td></tr>
<tr class="separator:aa3c2d644a2be7f0d3aa9f757527d306f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0eb14d48920ea469b0904ae63b47b589"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a0eb14d48920ea469b0904ae63b47b589">compressPairVectorForSingleQubitDepolarise</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="separator:a0eb14d48920ea469b0904ae63b47b589"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a373394db1bf71b0be63585c0e9a52abb"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a373394db1bf71b0be63585c0e9a52abb">compressPairVectorForTwoQubitDepolarise</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit, int qubit2)</td></tr>
<tr class="separator:a373394db1bf71b0be63585c0e9a52abb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aefba328e047e6ef4fd1ae4b56901aaa7"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#aefba328e047e6ef4fd1ae4b56901aaa7">copyDiagOpIntoMatrixPairState</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, <a class="el" href="structDiagonalOp.html">DiagonalOp</a> op)</td></tr>
<tr class="separator:aefba328e047e6ef4fd1ae4b56901aaa7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a95af772d87c461fc8abfd6d47b752ac2"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a95af772d87c461fc8abfd6d47b752ac2">copyVecIntoMatrixPairState</a> (<a class="el" href="structQureg.html">Qureg</a> matr, <a class="el" href="structQureg.html">Qureg</a> vec)</td></tr>
<tr class="memdesc:a95af772d87c461fc8abfd6d47b752ac2"><td class="mdescLeft"> </td><td class="mdescRight">This copies/clones vec (a statevector) into every node's matr pairState. <a href="QuEST__cpu__distributed_8c.html#a95af772d87c461fc8abfd6d47b752ac2">More...</a><br /></td></tr>
<tr class="separator:a95af772d87c461fc8abfd6d47b752ac2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga8ba2c3388dd64d9348c3b091852d36d4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structQuESTEnv.html">QuESTEnv</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__type.html#ga8ba2c3388dd64d9348c3b091852d36d4">createQuESTEnv</a> (void)</td></tr>
<tr class="memdesc:ga8ba2c3388dd64d9348c3b091852d36d4"><td class="mdescLeft"> </td><td class="mdescRight">Create the QuEST execution environment. <a href="group__type.html#ga8ba2c3388dd64d9348c3b091852d36d4">More...</a><br /></td></tr>
<tr class="separator:ga8ba2c3388dd64d9348c3b091852d36d4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a076fe6125da4d6037b8bc4d912df4015"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a076fe6125da4d6037b8bc4d912df4015">densityMatrixBlockFitsInChunk</a> (long long int chunkSize, int numQubits, int targetQubit)</td></tr>
<tr class="separator:a076fe6125da4d6037b8bc4d912df4015"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aedd7ecccf2f09dd2f1c5d191950b51e6"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#aedd7ecccf2f09dd2f1c5d191950b51e6">densmatr_applyDiagonalOp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, <a class="el" href="structDiagonalOp.html">DiagonalOp</a> op)</td></tr>
<tr class="separator:aedd7ecccf2f09dd2f1c5d191950b51e6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a70e3b0a2297c186d5c779af31459b4ca"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structComplex.html">Complex</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a70e3b0a2297c186d5c779af31459b4ca">densmatr_calcExpecDiagonalOp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, <a class="el" href="structDiagonalOp.html">DiagonalOp</a> op)</td></tr>
<tr class="separator:a70e3b0a2297c186d5c779af31459b4ca"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa6c3f86010ad398f42b0577ea3bb5bcf"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#aa6c3f86010ad398f42b0577ea3bb5bcf">densmatr_calcFidelity</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, <a class="el" href="structQureg.html">Qureg</a> pureState)</td></tr>
<tr class="separator:aa6c3f86010ad398f42b0577ea3bb5bcf"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8c9da88f734b0862f4cce7d819e6d3b5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a8c9da88f734b0862f4cce7d819e6d3b5">densmatr_calcHilbertSchmidtDistance</a> (<a class="el" href="structQureg.html">Qureg</a> a, <a class="el" href="structQureg.html">Qureg</a> b)</td></tr>
<tr class="separator:a8c9da88f734b0862f4cce7d819e6d3b5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6ff3dc624b5fafe8edae4fe327c255a0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a6ff3dc624b5fafe8edae4fe327c255a0">densmatr_calcInnerProduct</a> (<a class="el" href="structQureg.html">Qureg</a> a, <a class="el" href="structQureg.html">Qureg</a> b)</td></tr>
<tr class="separator:a6ff3dc624b5fafe8edae4fe327c255a0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae37b3eff5d3affbc1edfe216cabc1c53"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ae37b3eff5d3affbc1edfe216cabc1c53">densmatr_calcProbOfOutcome</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int measureQubit, int outcome)</td></tr>
<tr class="separator:ae37b3eff5d3affbc1edfe216cabc1c53"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae45eefa65f4ecd37bab84fade7cf7f1f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ae45eefa65f4ecd37bab84fade7cf7f1f">densmatr_calcPurity</a> (<a class="el" href="structQureg.html">Qureg</a> qureg)</td></tr>
<tr class="separator:ae45eefa65f4ecd37bab84fade7cf7f1f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6153547f245c05874161a105e9a2f02c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a6153547f245c05874161a105e9a2f02c">densmatr_calcTotalProb</a> (<a class="el" href="structQureg.html">Qureg</a> qureg)</td></tr>
<tr class="separator:a6153547f245c05874161a105e9a2f02c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae5ad68d054875913d0f7ec654840a9ec"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ae5ad68d054875913d0f7ec654840a9ec">densmatr_initPureState</a> (<a class="el" href="structQureg.html">Qureg</a> targetQureg, <a class="el" href="structQureg.html">Qureg</a> copyQureg)</td></tr>
<tr class="separator:ae5ad68d054875913d0f7ec654840a9ec"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac501fe7b9d331be48359ce1546348f97"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ac501fe7b9d331be48359ce1546348f97">densmatr_mixDamping</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> damping)</td></tr>
<tr class="separator:ac501fe7b9d331be48359ce1546348f97"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a398b60c4cb4fa2cf2ffc126de6c08da0"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a398b60c4cb4fa2cf2ffc126de6c08da0">densmatr_mixDepolarising</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> depolLevel)</td></tr>
<tr class="separator:a398b60c4cb4fa2cf2ffc126de6c08da0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a43afa97e300b87bce7f3eb1213eb05f6"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a43afa97e300b87bce7f3eb1213eb05f6">densmatr_mixTwoQubitDepolarising</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int qubit1, int qubit2, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> depolLevel)</td></tr>
<tr class="separator:a43afa97e300b87bce7f3eb1213eb05f6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaeff624226629d7063a8a776958a4f991"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__type.html#gaeff624226629d7063a8a776958a4f991">destroyQuESTEnv</a> (<a class="el" href="structQuESTEnv.html">QuESTEnv</a> env)</td></tr>
<tr class="memdesc:gaeff624226629d7063a8a776958a4f991"><td class="mdescLeft"> </td><td class="mdescRight">Destroy the QuEST environment. <a href="group__type.html#gaeff624226629d7063a8a776958a4f991">More...</a><br /></td></tr>
<tr class="separator:gaeff624226629d7063a8a776958a4f991"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a37dae401754961c9100b3c0907913c3e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a37dae401754961c9100b3c0907913c3e">exchangePairStateVectorHalves</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int pairRank)</td></tr>
<tr class="separator:a37dae401754961c9100b3c0907913c3e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae01c3eb75fd32de1a7e1dbc7a33a21e3"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ae01c3eb75fd32de1a7e1dbc7a33a21e3">exchangeStateVectors</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int pairRank)</td></tr>
<tr class="separator:ae01c3eb75fd32de1a7e1dbc7a33a21e3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a28be36627b2dd9a0da63dd6f60121b06"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a28be36627b2dd9a0da63dd6f60121b06">getChunkIdFromIndex</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int index)</td></tr>
<tr class="separator:a28be36627b2dd9a0da63dd6f60121b06"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae66dc6569c6e4008c33d6739db422c08"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ae66dc6569c6e4008c33d6739db422c08">getChunkOuterBlockPairId</a> (int <a class="el" href="QuEST__cpu__distributed_8c.html#a0552889d6f57d9e0ed8b209bf426482d">chunkIsUpper</a>, int chunkId, long long int chunkSize, int targetQubit, int numQubits)</td></tr>
<tr class="separator:ae66dc6569c6e4008c33d6739db422c08"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab1ec7f241b68b079c8e316d190af49ce"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ab1ec7f241b68b079c8e316d190af49ce">getChunkOuterBlockPairIdForPart3</a> (int chunkIsUpperSmallerQubit, int chunkIsUpperBiggerQubit, int chunkId, long long int chunkSize, int smallerQubit, int biggerQubit, int numQubits)</td></tr>
<tr class="separator:ab1ec7f241b68b079c8e316d190af49ce"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7dba097f23f5d48dfdc9f3250444e2e4"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a7dba097f23f5d48dfdc9f3250444e2e4">getChunkPairId</a> (int <a class="el" href="QuEST__cpu__distributed_8c.html#a0552889d6f57d9e0ed8b209bf426482d">chunkIsUpper</a>, int chunkId, long long int chunkSize, int targetQubit)</td></tr>
<tr class="memdesc:a7dba097f23f5d48dfdc9f3250444e2e4"><td class="mdescLeft"> </td><td class="mdescRight">get position of corresponding chunk, holding values required to update values in my chunk (with chunkId) when rotating targetQubit. <a href="QuEST__cpu__distributed_8c.html#a7dba097f23f5d48dfdc9f3250444e2e4">More...</a><br /></td></tr>
<tr class="separator:a7dba097f23f5d48dfdc9f3250444e2e4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4f243eb101c8e63f16cfd50300364cb7"><td class="memItemLeft" align="right" valign="top">long long int </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a4f243eb101c8e63f16cfd50300364cb7">getGlobalIndOfOddParityInChunk</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int qb1, int qb2)</td></tr>
<tr class="memdesc:a4f243eb101c8e63f16cfd50300364cb7"><td class="mdescLeft"> </td><td class="mdescRight">returns -1 if this node contains no amplitudes where qb1 and qb2 have opposite parity, otherwise returns the global index of one of such contained amplitudes (not necessarily the first) <a href="QuEST__cpu__distributed_8c.html#a4f243eb101c8e63f16cfd50300364cb7">More...</a><br /></td></tr>
<tr class="separator:a4f243eb101c8e63f16cfd50300364cb7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adb4b0373425b282abed27742d0ce0872"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#adb4b0373425b282abed27742d0ce0872">getRotAngle</a> (int <a class="el" href="QuEST__cpu__distributed_8c.html#a0552889d6f57d9e0ed8b209bf426482d">chunkIsUpper</a>, <a class="el" href="structComplex.html">Complex</a> *rot1, <a class="el" href="structComplex.html">Complex</a> *rot2, <a class="el" href="structComplex.html">Complex</a> alpha, <a class="el" href="structComplex.html">Complex</a> beta)</td></tr>
<tr class="memdesc:adb4b0373425b282abed27742d0ce0872"><td class="mdescLeft"> </td><td class="mdescRight">Get rotation values for a given chunk. <a href="QuEST__cpu__distributed_8c.html#adb4b0373425b282abed27742d0ce0872">More...</a><br /></td></tr>
<tr class="separator:adb4b0373425b282abed27742d0ce0872"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5c9b2f129bdffaaba9857f6eddecbb17"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a5c9b2f129bdffaaba9857f6eddecbb17">getRotAngleFromUnitaryMatrix</a> (int <a class="el" href="QuEST__cpu__distributed_8c.html#a0552889d6f57d9e0ed8b209bf426482d">chunkIsUpper</a>, <a class="el" href="structComplex.html">Complex</a> *rot1, <a class="el" href="structComplex.html">Complex</a> *rot2, <a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a> u)</td></tr>
<tr class="memdesc:a5c9b2f129bdffaaba9857f6eddecbb17"><td class="mdescLeft"> </td><td class="mdescRight">Get rotation values for a given chunk given a unitary matrix. <a href="QuEST__cpu__distributed_8c.html#a5c9b2f129bdffaaba9857f6eddecbb17">More...</a><br /></td></tr>
<tr class="separator:a5c9b2f129bdffaaba9857f6eddecbb17"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4d043bb0cee54a5f94faf3ffc34a6790"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a4d043bb0cee54a5f94faf3ffc34a6790">halfMatrixBlockFitsInChunk</a> (long long int chunkSize, int targetQubit)</td></tr>
<tr class="memdesc:a4d043bb0cee54a5f94faf3ffc34a6790"><td class="mdescLeft"> </td><td class="mdescRight">return whether the current qubit rotation will use blocks that fit within a single chunk. <a href="QuEST__cpu__distributed_8c.html#a4d043bb0cee54a5f94faf3ffc34a6790">More...</a><br /></td></tr>
<tr class="separator:a4d043bb0cee54a5f94faf3ffc34a6790"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af0ea25f00987af4c53f17c9cca62ab41"><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#af0ea25f00987af4c53f17c9cca62ab41">isChunkToSkipInFindPZero</a> (int chunkId, long long int chunkSize, int measureQubit)</td></tr>
<tr class="memdesc:af0ea25f00987af4c53f17c9cca62ab41"><td class="mdescLeft"> </td><td class="mdescRight">Find chunks to skip when calculating probability of qubit being zero. <a href="QuEST__cpu__distributed_8c.html#af0ea25f00987af4c53f17c9cca62ab41">More...</a><br /></td></tr>
<tr class="separator:af0ea25f00987af4c53f17c9cca62ab41"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf8a14ae79c3fb2c0b5f6255cc37bebf9"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__debug.html#gaf8a14ae79c3fb2c0b5f6255cc37bebf9">reportQuESTEnv</a> (<a class="el" href="structQuESTEnv.html">QuESTEnv</a> env)</td></tr>
<tr class="memdesc:gaf8a14ae79c3fb2c0b5f6255cc37bebf9"><td class="mdescLeft"> </td><td class="mdescRight">Report information about the QuEST environment. <a href="group__debug.html#gaf8a14ae79c3fb2c0b5f6255cc37bebf9">More...</a><br /></td></tr>
<tr class="separator:gaf8a14ae79c3fb2c0b5f6255cc37bebf9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaa8437ef3bf135231e2916e64dde1c94e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__debug.html#gaa8437ef3bf135231e2916e64dde1c94e">seedQuESTDefault</a> ()</td></tr>
<tr class="memdesc:gaa8437ef3bf135231e2916e64dde1c94e"><td class="mdescLeft"> </td><td class="mdescRight">Seed the Mersenne Twister used for random number generation in the QuEST environment with an example defualt seed. <a href="group__debug.html#gaa8437ef3bf135231e2916e64dde1c94e">More...</a><br /></td></tr>
<tr class="separator:gaa8437ef3bf135231e2916e64dde1c94e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0fb948ddab4ca210e523aa3c52639df4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structComplex.html">Complex</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a0fb948ddab4ca210e523aa3c52639df4">statevec_calcExpecDiagonalOp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, <a class="el" href="structDiagonalOp.html">DiagonalOp</a> op)</td></tr>
<tr class="separator:a0fb948ddab4ca210e523aa3c52639df4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7ebd3198a198f4cd20840f64fd8b84d0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structComplex.html">Complex</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a7ebd3198a198f4cd20840f64fd8b84d0">statevec_calcInnerProduct</a> (<a class="el" href="structQureg.html">Qureg</a> bra, <a class="el" href="structQureg.html">Qureg</a> ket)</td></tr>
<tr class="separator:a7ebd3198a198f4cd20840f64fd8b84d0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a63cb88a5f4eb12fef087435b8db3f8eb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a63cb88a5f4eb12fef087435b8db3f8eb">statevec_calcProbOfOutcome</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int measureQubit, int outcome)</td></tr>
<tr class="separator:a63cb88a5f4eb12fef087435b8db3f8eb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad65ad1b5ea6f30b0c6b4ffda96e1a8e6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ad65ad1b5ea6f30b0c6b4ffda96e1a8e6">statevec_calcTotalProb</a> (<a class="el" href="structQureg.html">Qureg</a> qureg)</td></tr>
<tr class="separator:ad65ad1b5ea6f30b0c6b4ffda96e1a8e6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab07dc84ee1f2034482f1c186576434be"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ab07dc84ee1f2034482f1c186576434be">statevec_collapseToKnownProbOutcome</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int measureQubit, int outcome, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> totalStateProb)</td></tr>
<tr class="separator:ab07dc84ee1f2034482f1c186576434be"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aec63559e8b9ab0e17efe18d64d2ceca6"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#aec63559e8b9ab0e17efe18d64d2ceca6">statevec_compactUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit, <a class="el" href="structComplex.html">Complex</a> alpha, <a class="el" href="structComplex.html">Complex</a> beta)</td></tr>
<tr class="separator:aec63559e8b9ab0e17efe18d64d2ceca6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1275d604674224d87a173fb5bac78835"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a1275d604674224d87a173fb5bac78835">statevec_controlledCompactUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit, <a class="el" href="structComplex.html">Complex</a> alpha, <a class="el" href="structComplex.html">Complex</a> beta)</td></tr>
<tr class="separator:a1275d604674224d87a173fb5bac78835"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abb2eab4af99adcc59be24f4c91c6f6ad"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#abb2eab4af99adcc59be24f4c91c6f6ad">statevec_controlledNot</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit)</td></tr>
<tr class="separator:abb2eab4af99adcc59be24f4c91c6f6ad"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4e19ef93d01d7acea32ca646d623aedd"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a4e19ef93d01d7acea32ca646d623aedd">statevec_controlledPauliY</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit)</td></tr>
<tr class="separator:a4e19ef93d01d7acea32ca646d623aedd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4a2fa262d3f0dba372797b9bd35d9fa5"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a4a2fa262d3f0dba372797b9bd35d9fa5">statevec_controlledPauliYConj</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit)</td></tr>
<tr class="separator:a4a2fa262d3f0dba372797b9bd35d9fa5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:add9ca9956cdd81ed5d0b0f66168c04a3"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#add9ca9956cdd81ed5d0b0f66168c04a3">statevec_controlledUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int controlQubit, int targetQubit, <a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a> u)</td></tr>
<tr class="separator:add9ca9956cdd81ed5d0b0f66168c04a3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abd509244d57657e148e4084c5ab5d28f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int index)</td></tr>
<tr class="separator:abd509244d57657e148e4084c5ab5d28f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abc9a9ef4344c7faaaf28ac25c76649b9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int index)</td></tr>
<tr class="separator:abc9a9ef4344c7faaaf28ac25c76649b9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af3fc7bd149c70f083b149050242cd55e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#af3fc7bd149c70f083b149050242cd55e">statevec_hadamard</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="separator:af3fc7bd149c70f083b149050242cd55e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0acfe30083d0bc2a84da196378a36122"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a0acfe30083d0bc2a84da196378a36122">statevec_multiControlledMultiQubitUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int ctrlMask, int *targs, int numTargs, <a class="el" href="structComplexMatrixN.html">ComplexMatrixN</a> u)</td></tr>
<tr class="memdesc:a0acfe30083d0bc2a84da196378a36122"><td class="mdescLeft"> </td><td class="mdescRight">This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct. <a href="QuEST__cpu__distributed_8c.html#a0acfe30083d0bc2a84da196378a36122">More...</a><br /></td></tr>
<tr class="separator:a0acfe30083d0bc2a84da196378a36122"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:affbd18d7c2ed8d5bd5edb67116501145"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#affbd18d7c2ed8d5bd5edb67116501145">statevec_multiControlledTwoQubitUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int ctrlMask, int q1, int q2, <a class="el" href="structComplexMatrix4.html">ComplexMatrix4</a> u)</td></tr>
<tr class="memdesc:affbd18d7c2ed8d5bd5edb67116501145"><td class="mdescLeft"> </td><td class="mdescRight">This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks already fit in the node, it operates the unitary direct. <a href="QuEST__cpu__distributed_8c.html#affbd18d7c2ed8d5bd5edb67116501145">More...</a><br /></td></tr>
<tr class="separator:affbd18d7c2ed8d5bd5edb67116501145"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a600bda10463e2078ce746ec28f2d39c9"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, int targetQubit, <a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a> u)</td></tr>
<tr class="separator:a600bda10463e2078ce746ec28f2d39c9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1c82b5e914a8a39c5c7b782dbc16fa76"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a1c82b5e914a8a39c5c7b782dbc16fa76">statevec_pauliX</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="separator:a1c82b5e914a8a39c5c7b782dbc16fa76"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af1cca787f3b0e0c91ffb2495f9ad8d5a"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#af1cca787f3b0e0c91ffb2495f9ad8d5a">statevec_pauliY</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="separator:af1cca787f3b0e0c91ffb2495f9ad8d5a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a81fbd2eccd0d0e5a3cece4df2f96cb92"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#a81fbd2eccd0d0e5a3cece4df2f96cb92">statevec_pauliYConj</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit)</td></tr>
<tr class="separator:a81fbd2eccd0d0e5a3cece4df2f96cb92"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab7478fcaf6357ab202d72853b672e375"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ab7478fcaf6357ab202d72853b672e375">statevec_swapQubitAmps</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int qb1, int qb2)</td></tr>
<tr class="separator:ab7478fcaf6357ab202d72853b672e375"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac3735bd959600e57b2ee3a105666cddf"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="QuEST__cpu__distributed_8c.html#ac3735bd959600e57b2ee3a105666cddf">statevec_unitary</a> (<a class="el" href="structQureg.html">Qureg</a> qureg, int targetQubit, <a class="el" href="structComplexMatrix2.html">ComplexMatrix2</a> u)</td></tr>
<tr class="separator:ac3735bd959600e57b2ee3a105666cddf"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga8d31fe2d1ad4d01e2a1f5f6b8bc15b77"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__debug.html#ga8d31fe2d1ad4d01e2a1f5f6b8bc15b77">syncQuESTEnv</a> (<a class="el" href="structQuESTEnv.html">QuESTEnv</a> env)</td></tr>
<tr class="memdesc:ga8d31fe2d1ad4d01e2a1f5f6b8bc15b77"><td class="mdescLeft"> </td><td class="mdescRight">Guarantees that all code up to the given point has been executed on all nodes (if running in distributed mode) <a href="group__debug.html#ga8d31fe2d1ad4d01e2a1f5f6b8bc15b77">More...</a><br /></td></tr>
<tr class="separator:ga8d31fe2d1ad4d01e2a1f5f6b8bc15b77"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gac7e38d768a1bd79019f88cc1e6295092"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__debug.html#gac7e38d768a1bd79019f88cc1e6295092">syncQuESTSuccess</a> (int successCode)</td></tr>
<tr class="memdesc:gac7e38d768a1bd79019f88cc1e6295092"><td class="mdescLeft"> </td><td class="mdescRight">Performs a logical AND on all successCodes held by all processes. <a href="group__debug.html#gac7e38d768a1bd79019f88cc1e6295092">More...</a><br /></td></tr>
<tr class="separator:gac7e38d768a1bd79019f88cc1e6295092"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>An implementation of the backend in ../QuEST_ops.h for an MPI environment. Mostly pure-state wrappers for the local/distributed functions implemented in QuEST_cpu</p>
<dl class="section author"><dt>Author</dt><dd>Ania Brown </dd>
<dd>
Tyson Jones </dd>
<dd>
Balint Koczor </dd></dl>
<p class="definition">Definition in file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ad3d8a3bd0c0b677acef144f2c2ef6d73"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad3d8a3bd0c0b677acef144f2c2ef6d73">◆ </a></span>_BSD_SOURCE</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define _BSD_SOURCE</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00020">20</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a0552889d6f57d9e0ed8b209bf426482d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0552889d6f57d9e0ed8b209bf426482d">◆ </a></span>chunkIsUpper()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static int chunkIsUpper </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>chunkId</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long long int </td>
<td class="paramname"><em>chunkSize</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>targetQubit</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns whether a given chunk in position chunkId is in the upper or lower half of a block. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">chunkId</td><td>id of chunk in state vector </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">chunkSize</td><td>number of amps in chunk </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">targetQubit</td><td>qubit being rotated </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1: chunk is in upper half of block, 0: chunk is in lower half of block fix – is this the same as isChunkToSkip? </dd></dl>
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00227">227</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00228"></a><span class="lineno"> 228</span> { </div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> sizeHalfBlock = 1LL << (targetQubit);</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> sizeBlock = sizeHalfBlock*2;</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> posInBlock = (chunkId*chunkSize) % sizeBlock;</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="keywordflow">return</span> posInBlock<sizeHalfBlock;</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span> }</div>
</div><!-- fragment -->
<p class="reference">Referenced by <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00314">getChunkOuterBlockPairId()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00303">getChunkPairId()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00258">getRotAngle()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00283">getRotAngleFromUnitaryMatrix()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00844">statevec_compactUnitary()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00920">statevec_controlledCompactUnitary()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01061">statevec_controlledNot()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01140">statevec_controlledPauliY()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01173">statevec_controlledPauliYConj()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00958">statevec_controlledUnitary()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01206">statevec_hadamard()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00997">statevec_multiControlledUnitary()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01034">statevec_pauliX()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01090">statevec_pauliY()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01115">statevec_pauliYConj()</a>, and <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00881">statevec_unitary()</a>.</p>
</div>
</div>
<a id="aa3c2d644a2be7f0d3aa9f757527d306f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa3c2d644a2be7f0d3aa9f757527d306f">◆ </a></span>chunkIsUpperInOuterBlock()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static int chunkIsUpperInOuterBlock </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>chunkId</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">long long int </td>
<td class="paramname"><em>chunkSize</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>targetQubit</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>numQubits</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>fix – do with masking instead </p>
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00236">236</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00237"></a><span class="lineno"> 237</span> { </div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> sizeOuterHalfBlock = 1LL << (targetQubit+numQubits);</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> sizeOuterBlock = sizeOuterHalfBlock*2;</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> posInBlock = (chunkId*chunkSize) % sizeOuterBlock;</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  <span class="keywordflow">return</span> posInBlock<sizeOuterHalfBlock;</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span> }</div>
</div><!-- fragment -->
<p class="reference">Referenced by <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00725">densmatr_mixDamping()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00698">densmatr_mixDepolarising()</a>, and <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00752">densmatr_mixTwoQubitDepolarising()</a>.</p>
</div>
</div>
<a id="a0eb14d48920ea469b0904ae63b47b589"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0eb14d48920ea469b0904ae63b47b589">◆ </a></span>compressPairVectorForSingleQubitDepolarise()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void compressPairVectorForSingleQubitDepolarise </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>targetQubit</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00543">543</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00543"></a><span class="lineno"> 543</span>  {</div>
<div class="line"><a name="l00544"></a><span class="lineno"> 544</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> sizeInnerBlock, sizeInnerHalfBlock;</div>
<div class="line"><a name="l00545"></a><span class="lineno"> 545</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> sizeOuterColumn, sizeOuterHalfColumn;</div>
<div class="line"><a name="l00546"></a><span class="lineno"> 546</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> thisInnerBlock, <span class="comment">// current block</span></div>
<div class="line"><a name="l00547"></a><span class="lineno"> 547</span>  thisOuterColumn, <span class="comment">// current column in density matrix</span></div>
<div class="line"><a name="l00548"></a><span class="lineno"> 548</span>  thisIndex, <span class="comment">// current index in (density matrix representation) state vector</span></div>
<div class="line"><a name="l00549"></a><span class="lineno"> 549</span>  thisIndexInOuterColumn,</div>
<div class="line"><a name="l00550"></a><span class="lineno"> 550</span>  thisIndexInInnerBlock;</div>
<div class="line"><a name="l00551"></a><span class="lineno"> 551</span>  </div>
<div class="line"><a name="l00552"></a><span class="lineno"> 552</span>  <span class="keywordtype">int</span> outerBit;</div>
<div class="line"><a name="l00553"></a><span class="lineno"> 553</span>  </div>
<div class="line"><a name="l00554"></a><span class="lineno"> 554</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> thisTask;</div>
<div class="line"><a name="l00555"></a><span class="lineno"> 555</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> numTasks=qureg.<a class="code" href="structQureg.html#ab0ea0358482b62f43fdd781469607d97">numAmpsPerChunk</a>>>1;</div>
<div class="line"><a name="l00556"></a><span class="lineno"> 556</span>  </div>
<div class="line"><a name="l00557"></a><span class="lineno"> 557</span>  <span class="comment">// set dimensions</span></div>
<div class="line"><a name="l00558"></a><span class="lineno"> 558</span>  sizeInnerHalfBlock = 1LL << targetQubit;</div>
<div class="line"><a name="l00559"></a><span class="lineno"> 559</span>  sizeInnerBlock = 2LL * sizeInnerHalfBlock;</div>
<div class="line"><a name="l00560"></a><span class="lineno"> 560</span>  sizeOuterHalfColumn = 1LL << qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00561"></a><span class="lineno"> 561</span>  sizeOuterColumn = 2LL * sizeOuterHalfColumn;</div>
<div class="line"><a name="l00562"></a><span class="lineno"> 562</span>  </div>
<div class="line"><a name="l00563"></a><span class="lineno"> 563</span> <span class="preprocessor"># ifdef _OPENMP</span></div>
<div class="line"><a name="l00564"></a><span class="lineno"> 564</span> <span class="preprocessor"># pragma omp parallel \</span></div>
<div class="line"><a name="l00565"></a><span class="lineno"> 565</span> <span class="preprocessor"> default (none) \</span></div>
<div class="line"><a name="l00566"></a><span class="lineno"> 566</span> <span class="preprocessor"> shared (sizeInnerBlock,sizeInnerHalfBlock,sizeOuterColumn,sizeOuterHalfColumn, \</span></div>
<div class="line"><a name="l00567"></a><span class="lineno"> 567</span> <span class="preprocessor"> qureg,numTasks,targetQubit) \</span></div>
<div class="line"><a name="l00568"></a><span class="lineno"> 568</span> <span class="preprocessor"> private (thisTask,thisInnerBlock,thisOuterColumn,thisIndex,thisIndexInOuterColumn, \</span></div>
<div class="line"><a name="l00569"></a><span class="lineno"> 569</span> <span class="preprocessor"> thisIndexInInnerBlock,outerBit) </span></div>
<div class="line"><a name="l00570"></a><span class="lineno"> 570</span> <span class="preprocessor"># endif</span></div>
<div class="line"><a name="l00571"></a><span class="lineno"> 571</span>  {</div>
<div class="line"><a name="l00572"></a><span class="lineno"> 572</span> <span class="preprocessor"># ifdef _OPENMP</span></div>
<div class="line"><a name="l00573"></a><span class="lineno"> 573</span> <span class="preprocessor"># pragma omp for schedule (static)</span></div>
<div class="line"><a name="l00574"></a><span class="lineno"> 574</span> <span class="preprocessor"># endif</span></div>
<div class="line"><a name="l00575"></a><span class="lineno"> 575</span>  <span class="comment">// thisTask iterates over half the elements in this process' chunk of the density matrix</span></div>
<div class="line"><a name="l00576"></a><span class="lineno"> 576</span>  <span class="comment">// treat this as iterating over all columns, then iterating over half the values</span></div>
<div class="line"><a name="l00577"></a><span class="lineno"> 577</span>  <span class="comment">// within one column.</span></div>
<div class="line"><a name="l00578"></a><span class="lineno"> 578</span>  <span class="comment">// If this function has been called, this process' chunk contains half an </span></div>
<div class="line"><a name="l00579"></a><span class="lineno"> 579</span>  <span class="comment">// outer block or less</span></div>
<div class="line"><a name="l00580"></a><span class="lineno"> 580</span>  <span class="keywordflow">for</span> (thisTask=0; thisTask<numTasks; thisTask++) {</div>
<div class="line"><a name="l00581"></a><span class="lineno"> 581</span>  <span class="comment">// we want to process all columns in the density matrix,</span></div>
<div class="line"><a name="l00582"></a><span class="lineno"> 582</span>  <span class="comment">// updating the values for half of each column (one half of each inner block)</span></div>
<div class="line"><a name="l00583"></a><span class="lineno"> 583</span>  thisOuterColumn = thisTask / sizeOuterHalfColumn;</div>
<div class="line"><a name="l00584"></a><span class="lineno"> 584</span>  thisIndexInOuterColumn = thisTask&(sizeOuterHalfColumn-1); <span class="comment">// thisTask % sizeOuterHalfColumn</span></div>
<div class="line"><a name="l00585"></a><span class="lineno"> 585</span>  thisInnerBlock = thisIndexInOuterColumn/sizeInnerHalfBlock;</div>
<div class="line"><a name="l00586"></a><span class="lineno"> 586</span>  <span class="comment">// get index in state vector corresponding to upper inner block</span></div>
<div class="line"><a name="l00587"></a><span class="lineno"> 587</span>  thisIndexInInnerBlock = thisTask&(sizeInnerHalfBlock-1); <span class="comment">// thisTask % sizeInnerHalfBlock</span></div>
<div class="line"><a name="l00588"></a><span class="lineno"> 588</span>  thisIndex = thisOuterColumn*sizeOuterColumn + thisInnerBlock*sizeInnerBlock</div>
<div class="line"><a name="l00589"></a><span class="lineno"> 589</span>  + thisIndexInInnerBlock;</div>
<div class="line"><a name="l00590"></a><span class="lineno"> 590</span>  <span class="comment">// check if we are in the upper or lower half of an outer block</span></div>
<div class="line"><a name="l00591"></a><span class="lineno"> 591</span>  outerBit = <a class="code" href="QuEST__gpu_8cu.html#aec1852e1a8e70d3690919ce8ab551ba0">extractBit</a>(targetQubit, (thisIndex+qureg.<a class="code" href="structQureg.html#ab0ea0358482b62f43fdd781469607d97">numAmpsPerChunk</a>*qureg.<a class="code" href="structQureg.html#ac2929e681d3d95591c18cf168dbbe4f0">chunkId</a>)>>qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00592"></a><span class="lineno"> 592</span>  <span class="comment">// if we are in the lower half of an outer block, shift to be in the lower half</span></div>
<div class="line"><a name="l00593"></a><span class="lineno"> 593</span>  <span class="comment">// of the inner block as well (we want to dephase |0><0| and |1><1| only)</span></div>
<div class="line"><a name="l00594"></a><span class="lineno"> 594</span>  thisIndex += outerBit*(sizeInnerHalfBlock);</div>
<div class="line"><a name="l00595"></a><span class="lineno"> 595</span>  </div>
<div class="line"><a name="l00596"></a><span class="lineno"> 596</span>  <span class="comment">// NOTE: at this point thisIndex should be the index of the element we want to </span></div>
<div class="line"><a name="l00597"></a><span class="lineno"> 597</span>  <span class="comment">// dephase in the chunk of the state vector on this process, in the </span></div>
<div class="line"><a name="l00598"></a><span class="lineno"> 598</span>  <span class="comment">// density matrix representation. </span></div>
<div class="line"><a name="l00599"></a><span class="lineno"> 599</span>  <span class="comment">// thisTask is the index of the pair element in pairStateVec</span></div>
<div class="line"><a name="l00600"></a><span class="lineno"> 600</span>  <span class="comment">// we will populate the second half of pairStateVec with this process'</span></div>
<div class="line"><a name="l00601"></a><span class="lineno"> 601</span>  <span class="comment">// data to send</span></div>
<div class="line"><a name="l00602"></a><span class="lineno"> 602</span>  </div>
<div class="line"><a name="l00603"></a><span class="lineno"> 603</span>  qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real[thisTask+numTasks] = qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.real[thisIndex];</div>
<div class="line"><a name="l00604"></a><span class="lineno"> 604</span>  qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag[thisTask+numTasks] = qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.imag[thisIndex];</div>
<div class="line"><a name="l00605"></a><span class="lineno"> 605</span>  </div>
<div class="line"><a name="l00606"></a><span class="lineno"> 606</span>  }</div>
<div class="line"><a name="l00607"></a><span class="lineno"> 607</span>  }</div>
<div class="line"><a name="l00608"></a><span class="lineno"> 608</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00217">Qureg::chunkId</a>, <a class="el" href="QuEST__gpu_8cu_source.html#l00082">extractBit()</a>, <a class="el" href="QuEST_8h_source.html#l00213">Qureg::numAmpsPerChunk</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST_8h_source.html#l00224">Qureg::pairStateVec</a>, and <a class="el" href="QuEST_8h_source.html#l00222">Qureg::stateVec</a>.</p>
<p class="reference">Referenced by <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00725">densmatr_mixDamping()</a>, and <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00698">densmatr_mixDepolarising()</a>.</p>
</div>
</div>
<a id="a373394db1bf71b0be63585c0e9a52abb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a373394db1bf71b0be63585c0e9a52abb">◆ </a></span>compressPairVectorForTwoQubitDepolarise()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void compressPairVectorForTwoQubitDepolarise </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>targetQubit</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>qubit2</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00610">610</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00611"></a><span class="lineno"> 611</span>  {</div>
<div class="line"><a name="l00612"></a><span class="lineno"> 612</span>  </div>
<div class="line"><a name="l00613"></a><span class="lineno"> 613</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> sizeInnerBlockQ1, sizeInnerHalfBlockQ1;</div>
<div class="line"><a name="l00614"></a><span class="lineno"> 614</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> sizeInnerBlockQ2, sizeInnerHalfBlockQ2, sizeInnerQuarterBlockQ2;</div>
<div class="line"><a name="l00615"></a><span class="lineno"> 615</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> sizeOuterColumn, sizeOuterQuarterColumn;</div>
<div class="line"><a name="l00616"></a><span class="lineno"> 616</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> </div>
<div class="line"><a name="l00617"></a><span class="lineno"> 617</span>  thisInnerBlockQ2,</div>
<div class="line"><a name="l00618"></a><span class="lineno"> 618</span>  thisOuterColumn, <span class="comment">// current column in density matrix</span></div>
<div class="line"><a name="l00619"></a><span class="lineno"> 619</span>  thisIndex, <span class="comment">// current index in (density matrix representation) state vector</span></div>
<div class="line"><a name="l00620"></a><span class="lineno"> 620</span>  thisIndexInOuterColumn,</div>
<div class="line"><a name="l00621"></a><span class="lineno"> 621</span>  thisIndexInInnerBlockQ1,</div>
<div class="line"><a name="l00622"></a><span class="lineno"> 622</span>  thisIndexInInnerBlockQ2,</div>
<div class="line"><a name="l00623"></a><span class="lineno"> 623</span>  thisInnerBlockQ1InInnerBlockQ2;</div>
<div class="line"><a name="l00624"></a><span class="lineno"> 624</span>  <span class="keywordtype">int</span> outerBitQ1, outerBitQ2;</div>
<div class="line"><a name="l00625"></a><span class="lineno"> 625</span>  </div>
<div class="line"><a name="l00626"></a><span class="lineno"> 626</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> thisTask;</div>
<div class="line"><a name="l00627"></a><span class="lineno"> 627</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> numTasks=qureg.<a class="code" href="structQureg.html#ab0ea0358482b62f43fdd781469607d97">numAmpsPerChunk</a>>>2;</div>
<div class="line"><a name="l00628"></a><span class="lineno"> 628</span>  </div>
<div class="line"><a name="l00629"></a><span class="lineno"> 629</span>  <span class="comment">// set dimensions</span></div>
<div class="line"><a name="l00630"></a><span class="lineno"> 630</span>  sizeInnerHalfBlockQ1 = 1LL << targetQubit;</div>
<div class="line"><a name="l00631"></a><span class="lineno"> 631</span>  sizeInnerHalfBlockQ2 = 1LL << qubit2;</div>
<div class="line"><a name="l00632"></a><span class="lineno"> 632</span>  sizeInnerQuarterBlockQ2 = sizeInnerHalfBlockQ2 >> 1;</div>
<div class="line"><a name="l00633"></a><span class="lineno"> 633</span>  sizeInnerBlockQ2 = sizeInnerHalfBlockQ2 << 1;</div>
<div class="line"><a name="l00634"></a><span class="lineno"> 634</span>  sizeInnerBlockQ1 = 2LL * sizeInnerHalfBlockQ1;</div>
<div class="line"><a name="l00635"></a><span class="lineno"> 635</span>  sizeOuterColumn = 1LL << qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00636"></a><span class="lineno"> 636</span>  sizeOuterQuarterColumn = sizeOuterColumn >> 2;</div>
<div class="line"><a name="l00637"></a><span class="lineno"> 637</span>  </div>
<div class="line"><a name="l00638"></a><span class="lineno"> 638</span> <span class="preprocessor"># ifdef _OPENMP</span></div>
<div class="line"><a name="l00639"></a><span class="lineno"> 639</span> <span class="preprocessor"># pragma omp parallel \</span></div>
<div class="line"><a name="l00640"></a><span class="lineno"> 640</span> <span class="preprocessor"> default (none) \</span></div>
<div class="line"><a name="l00641"></a><span class="lineno"> 641</span> <span class="preprocessor"> shared (sizeInnerBlockQ1,sizeInnerHalfBlockQ1,sizeInnerQuarterBlockQ2,sizeInnerHalfBlockQ2,sizeInnerBlockQ2, \</span></div>
<div class="line"><a name="l00642"></a><span class="lineno"> 642</span> <span class="preprocessor"> sizeOuterColumn,sizeOuterQuarterColumn,qureg,numTasks,targetQubit,qubit2) \</span></div>
<div class="line"><a name="l00643"></a><span class="lineno"> 643</span> <span class="preprocessor"> private (thisTask,thisInnerBlockQ2,thisOuterColumn,thisIndex,thisIndexInOuterColumn, \</span></div>
<div class="line"><a name="l00644"></a><span class="lineno"> 644</span> <span class="preprocessor"> thisIndexInInnerBlockQ1,thisIndexInInnerBlockQ2,thisInnerBlockQ1InInnerBlockQ2,outerBitQ1,outerBitQ2) </span></div>
<div class="line"><a name="l00645"></a><span class="lineno"> 645</span> <span class="preprocessor"># endif</span></div>
<div class="line"><a name="l00646"></a><span class="lineno"> 646</span>  {</div>
<div class="line"><a name="l00647"></a><span class="lineno"> 647</span> <span class="preprocessor"># ifdef _OPENMP</span></div>
<div class="line"><a name="l00648"></a><span class="lineno"> 648</span> <span class="preprocessor"># pragma omp for schedule (static)</span></div>
<div class="line"><a name="l00649"></a><span class="lineno"> 649</span> <span class="preprocessor"># endif</span></div>
<div class="line"><a name="l00650"></a><span class="lineno"> 650</span>  <span class="comment">// thisTask iterates over half the elements in this process' chunk of the density matrix</span></div>
<div class="line"><a name="l00651"></a><span class="lineno"> 651</span>  <span class="comment">// treat this as iterating over all columns, then iterating over half the values</span></div>
<div class="line"><a name="l00652"></a><span class="lineno"> 652</span>  <span class="comment">// within one column.</span></div>
<div class="line"><a name="l00653"></a><span class="lineno"> 653</span>  <span class="comment">// If this function has been called, this process' chunk contains half an </span></div>
<div class="line"><a name="l00654"></a><span class="lineno"> 654</span>  <span class="comment">// outer block or less</span></div>
<div class="line"><a name="l00655"></a><span class="lineno"> 655</span>  <span class="keywordflow">for</span> (thisTask=0; thisTask<numTasks; thisTask++) {</div>
<div class="line"><a name="l00656"></a><span class="lineno"> 656</span>  <span class="comment">// we want to process all columns in the density matrix,</span></div>
<div class="line"><a name="l00657"></a><span class="lineno"> 657</span>  <span class="comment">// updating the values for half of each column (one half of each inner block)</span></div>
<div class="line"><a name="l00658"></a><span class="lineno"> 658</span>  thisOuterColumn = thisTask / sizeOuterQuarterColumn;</div>
<div class="line"><a name="l00659"></a><span class="lineno"> 659</span>  <span class="comment">// thisTask % sizeOuterQuarterColumn</span></div>
<div class="line"><a name="l00660"></a><span class="lineno"> 660</span>  thisIndexInOuterColumn = thisTask&(sizeOuterQuarterColumn-1);</div>
<div class="line"><a name="l00661"></a><span class="lineno"> 661</span>  thisInnerBlockQ2 = thisIndexInOuterColumn / sizeInnerQuarterBlockQ2;</div>
<div class="line"><a name="l00662"></a><span class="lineno"> 662</span>  <span class="comment">// thisTask % sizeInnerQuarterBlockQ2;</span></div>
<div class="line"><a name="l00663"></a><span class="lineno"> 663</span>  thisIndexInInnerBlockQ2 = thisTask&(sizeInnerQuarterBlockQ2-1);</div>
<div class="line"><a name="l00664"></a><span class="lineno"> 664</span>  thisInnerBlockQ1InInnerBlockQ2 = thisIndexInInnerBlockQ2 / sizeInnerHalfBlockQ1;</div>
<div class="line"><a name="l00665"></a><span class="lineno"> 665</span>  <span class="comment">// thisTask % sizeInnerHalfBlockQ1;</span></div>
<div class="line"><a name="l00666"></a><span class="lineno"> 666</span>  thisIndexInInnerBlockQ1 = thisTask&(sizeInnerHalfBlockQ1-1);</div>
<div class="line"><a name="l00667"></a><span class="lineno"> 667</span>  </div>
<div class="line"><a name="l00668"></a><span class="lineno"> 668</span>  <span class="comment">// get index in state vector corresponding to upper inner block</span></div>
<div class="line"><a name="l00669"></a><span class="lineno"> 669</span>  thisIndex = thisOuterColumn*sizeOuterColumn + thisInnerBlockQ2*sizeInnerBlockQ2</div>
<div class="line"><a name="l00670"></a><span class="lineno"> 670</span>  + thisInnerBlockQ1InInnerBlockQ2*sizeInnerBlockQ1 + thisIndexInInnerBlockQ1;</div>
<div class="line"><a name="l00671"></a><span class="lineno"> 671</span>  </div>
<div class="line"><a name="l00672"></a><span class="lineno"> 672</span>  <span class="comment">// check if we are in the upper or lower half of an outer block for Q1</span></div>
<div class="line"><a name="l00673"></a><span class="lineno"> 673</span>  outerBitQ1 = <a class="code" href="QuEST__gpu_8cu.html#aec1852e1a8e70d3690919ce8ab551ba0">extractBit</a>(targetQubit, (thisIndex+qureg.<a class="code" href="structQureg.html#ab0ea0358482b62f43fdd781469607d97">numAmpsPerChunk</a>*qureg.<a class="code" href="structQureg.html#ac2929e681d3d95591c18cf168dbbe4f0">chunkId</a>)>>qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00674"></a><span class="lineno"> 674</span>  <span class="comment">// if we are in the lower half of an outer block, shift to be in the lower half</span></div>
<div class="line"><a name="l00675"></a><span class="lineno"> 675</span>  <span class="comment">// of the inner block as well (we want to dephase |0><0| and |1><1| only)</span></div>
<div class="line"><a name="l00676"></a><span class="lineno"> 676</span>  thisIndex += outerBitQ1*(sizeInnerHalfBlockQ1);</div>
<div class="line"><a name="l00677"></a><span class="lineno"> 677</span>  </div>
<div class="line"><a name="l00678"></a><span class="lineno"> 678</span>  <span class="comment">// check if we are in the upper or lower half of an outer block for Q2</span></div>
<div class="line"><a name="l00679"></a><span class="lineno"> 679</span>  outerBitQ2 = <a class="code" href="QuEST__gpu_8cu.html#aec1852e1a8e70d3690919ce8ab551ba0">extractBit</a>(qubit2, (thisIndex+qureg.<a class="code" href="structQureg.html#ab0ea0358482b62f43fdd781469607d97">numAmpsPerChunk</a>*qureg.<a class="code" href="structQureg.html#ac2929e681d3d95591c18cf168dbbe4f0">chunkId</a>)>>qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>);</div>
<div class="line"><a name="l00680"></a><span class="lineno"> 680</span>  <span class="comment">// if we are in the lower half of an outer block, shift to be in the lower half</span></div>
<div class="line"><a name="l00681"></a><span class="lineno"> 681</span>  <span class="comment">// of the inner block as well (we want to dephase |0><0| and |1><1| only)</span></div>
<div class="line"><a name="l00682"></a><span class="lineno"> 682</span>  thisIndex += outerBitQ2*(sizeInnerQuarterBlockQ2<<1);</div>
<div class="line"><a name="l00683"></a><span class="lineno"> 683</span>  </div>
<div class="line"><a name="l00684"></a><span class="lineno"> 684</span>  <span class="comment">// NOTE: at this point thisIndex should be the index of the element we want to </span></div>
<div class="line"><a name="l00685"></a><span class="lineno"> 685</span>  <span class="comment">// dephase in the chunk of the state vector on this process, in the </span></div>
<div class="line"><a name="l00686"></a><span class="lineno"> 686</span>  <span class="comment">// density matrix representation. </span></div>
<div class="line"><a name="l00687"></a><span class="lineno"> 687</span>  <span class="comment">// thisTask is the index of the pair element in pairStateVec</span></div>
<div class="line"><a name="l00688"></a><span class="lineno"> 688</span>  </div>
<div class="line"><a name="l00689"></a><span class="lineno"> 689</span>  <span class="comment">// state[thisIndex] = (1-depolLevel)*state[thisIndex] + depolLevel*(state[thisIndex]</span></div>
<div class="line"><a name="l00690"></a><span class="lineno"> 690</span>  <span class="comment">// + pair[thisTask])/2</span></div>
<div class="line"><a name="l00691"></a><span class="lineno"> 691</span>  qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real[thisTask+numTasks*2] = qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.real[thisIndex];</div>
<div class="line"><a name="l00692"></a><span class="lineno"> 692</span>  qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag[thisTask+numTasks*2] = qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.imag[thisIndex];</div>
<div class="line"><a name="l00693"></a><span class="lineno"> 693</span>  }</div>
<div class="line"><a name="l00694"></a><span class="lineno"> 694</span>  }</div>
<div class="line"><a name="l00695"></a><span class="lineno"> 695</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00217">Qureg::chunkId</a>, <a class="el" href="QuEST__gpu_8cu_source.html#l00082">extractBit()</a>, <a class="el" href="QuEST_8h_source.html#l00213">Qureg::numAmpsPerChunk</a>, <a class="el" href="QuEST_8h_source.html#l00208">Qureg::numQubitsRepresented</a>, <a class="el" href="QuEST_8h_source.html#l00224">Qureg::pairStateVec</a>, and <a class="el" href="QuEST_8h_source.html#l00222">Qureg::stateVec</a>.</p>
<p class="reference">Referenced by <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00752">densmatr_mixTwoQubitDepolarising()</a>.</p>
</div>
</div>
<a id="aefba328e047e6ef4fd1ae4b56901aaa7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aefba328e047e6ef4fd1ae4b56901aaa7">◆ </a></span>copyDiagOpIntoMatrixPairState()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void copyDiagOpIntoMatrixPairState </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structDiagonalOp.html">DiagonalOp</a> </td>
<td class="paramname"><em>op</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01482">1482</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01482"></a><span class="lineno"> 1482</span>  {</div>
<div class="line"><a name="l01483"></a><span class="lineno"> 1483</span>  </div>
<div class="line"><a name="l01484"></a><span class="lineno"> 1484</span>  <span class="comment">/* since, for every elem in 2^N op, there is a column in 2^N x 2^N qureg, </span></div>
<div class="line"><a name="l01485"></a><span class="lineno"> 1485</span> <span class="comment"> * we know immediately (by each node containing at least 1 element of op)</span></div>
<div class="line"><a name="l01486"></a><span class="lineno"> 1486</span> <span class="comment"> * that every node contains at least 1 column. Hence, we know that pairStateVec </span></div>
<div class="line"><a name="l01487"></a><span class="lineno"> 1487</span> <span class="comment"> * of qureg can fit the entirety of op.</span></div>
<div class="line"><a name="l01488"></a><span class="lineno"> 1488</span> <span class="comment"> */</span></div>
<div class="line"><a name="l01489"></a><span class="lineno"> 1489</span>  </div>
<div class="line"><a name="l01490"></a><span class="lineno"> 1490</span>  <span class="comment">// load up our local contribution</span></div>
<div class="line"><a name="l01491"></a><span class="lineno"> 1491</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> localOffset = qureg.<a class="code" href="structQureg.html#ac2929e681d3d95591c18cf168dbbe4f0">chunkId</a> * op.<a class="code" href="structDiagonalOp.html#a2c6eab631ef48b4978db026c98180eee">numElemsPerChunk</a>;</div>
<div class="line"><a name="l01492"></a><span class="lineno"> 1492</span>  memcpy(&qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real[localOffset], op.<a class="code" href="structDiagonalOp.html#a1d66088bed235d524cd452b107694d5c">real</a>, op.<a class="code" href="structDiagonalOp.html#a2c6eab631ef48b4978db026c98180eee">numElemsPerChunk</a> * <span class="keyword">sizeof</span>(<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>));</div>
<div class="line"><a name="l01493"></a><span class="lineno"> 1493</span>  memcpy(&qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag[localOffset], op.<a class="code" href="structDiagonalOp.html#a85c3f52533efe831bbe40b9a48602388">imag</a>, op.<a class="code" href="structDiagonalOp.html#a2c6eab631ef48b4978db026c98180eee">numElemsPerChunk</a> * <span class="keyword">sizeof</span>(<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>));</div>
<div class="line"><a name="l01494"></a><span class="lineno"> 1494</span>  </div>
<div class="line"><a name="l01495"></a><span class="lineno"> 1495</span>  <span class="comment">// work out how many messages are needed to send op chunks (2GB limit)</span></div>
<div class="line"><a name="l01496"></a><span class="lineno"> 1496</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> maxMsgSize = MPI_MAX_AMPS_IN_MSG;</div>
<div class="line"><a name="l01497"></a><span class="lineno"> 1497</span>  <span class="keywordflow">if</span> (op.<a class="code" href="structDiagonalOp.html#a2c6eab631ef48b4978db026c98180eee">numElemsPerChunk</a> < maxMsgSize) </div>
<div class="line"><a name="l01498"></a><span class="lineno"> 1498</span>  maxMsgSize = op.<a class="code" href="structDiagonalOp.html#a2c6eab631ef48b4978db026c98180eee">numElemsPerChunk</a>;</div>
<div class="line"><a name="l01499"></a><span class="lineno"> 1499</span>  <span class="keywordtype">int</span> numMsgs = op.<a class="code" href="structDiagonalOp.html#a2c6eab631ef48b4978db026c98180eee">numElemsPerChunk</a> / maxMsgSize; <span class="comment">// since MPI_MAX... = 2^n, division is exact</span></div>
<div class="line"><a name="l01500"></a><span class="lineno"> 1500</span>  </div>
<div class="line"><a name="l01501"></a><span class="lineno"> 1501</span>  <span class="comment">// each node has a turn at broadcasting its contribution of op</span></div>
<div class="line"><a name="l01502"></a><span class="lineno"> 1502</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> broadcaster=0; broadcaster < qureg.<a class="code" href="structQureg.html#aa3deb7163aab90a61e755a1f200f5413">numChunks</a>; broadcaster++) {</div>
<div class="line"><a name="l01503"></a><span class="lineno"> 1503</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> broadOffset = broadcaster * op.<a class="code" href="structDiagonalOp.html#a2c6eab631ef48b4978db026c98180eee">numElemsPerChunk</a>;</div>
<div class="line"><a name="l01504"></a><span class="lineno"> 1504</span>  </div>
<div class="line"><a name="l01505"></a><span class="lineno"> 1505</span>  <span class="comment">// (while keeping each message smaller than MPI max)</span></div>
<div class="line"><a name="l01506"></a><span class="lineno"> 1506</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<numMsgs; i++) {</div>
<div class="line"><a name="l01507"></a><span class="lineno"> 1507</span>  MPI_Bcast(</div>
<div class="line"><a name="l01508"></a><span class="lineno"> 1508</span>  &qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real[broadOffset + i*maxMsgSize], </div>
<div class="line"><a name="l01509"></a><span class="lineno"> 1509</span>  maxMsgSize, MPI_QuEST_REAL, broadcaster, MPI_COMM_WORLD);</div>
<div class="line"><a name="l01510"></a><span class="lineno"> 1510</span>  MPI_Bcast(</div>
<div class="line"><a name="l01511"></a><span class="lineno"> 1511</span>  &qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag[broadOffset + i*maxMsgSize], </div>
<div class="line"><a name="l01512"></a><span class="lineno"> 1512</span>  maxMsgSize, MPI_QuEST_REAL, broadcaster, MPI_COMM_WORLD);</div>
<div class="line"><a name="l01513"></a><span class="lineno"> 1513</span>  }</div>
<div class="line"><a name="l01514"></a><span class="lineno"> 1514</span>  }</div>
<div class="line"><a name="l01515"></a><span class="lineno"> 1515</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00217">Qureg::chunkId</a>, <a class="el" href="QuEST_8h_source.html#l00191">DiagonalOp::imag</a>, <a class="el" href="QuEST_8h_source.html#l00219">Qureg::numChunks</a>, <a class="el" href="QuEST_8h_source.html#l00183">DiagonalOp::numElemsPerChunk</a>, <a class="el" href="QuEST_8h_source.html#l00224">Qureg::pairStateVec</a>, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>, and <a class="el" href="QuEST_8h_source.html#l00189">DiagonalOp::real</a>.</p>
<p class="reference">Referenced by <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01517">densmatr_applyDiagonalOp()</a>.</p>
</div>
</div>
<a id="a95af772d87c461fc8abfd6d47b752ac2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a95af772d87c461fc8abfd6d47b752ac2">◆ </a></span>copyVecIntoMatrixPairState()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void copyVecIntoMatrixPairState </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>matr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>vec</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This copies/clones vec (a statevector) into every node's matr pairState. </p>
<p>(where matr is a density matrix or equal number of qubits as vec) </p>
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00371">371</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00371"></a><span class="lineno"> 371</span>  {</div>
<div class="line"><a name="l00372"></a><span class="lineno"> 372</span>  </div>
<div class="line"><a name="l00373"></a><span class="lineno"> 373</span>  <span class="comment">// Remember that for every amplitude that `vec` stores on the node,</span></div>
<div class="line"><a name="l00374"></a><span class="lineno"> 374</span>  <span class="comment">// `matr` stores an entire column. Ergo there are always an integer</span></div>
<div class="line"><a name="l00375"></a><span class="lineno"> 375</span>  <span class="comment">// number (in fact, a power of 2) number of `matr`s columns on each node.</span></div>
<div class="line"><a name="l00376"></a><span class="lineno"> 376</span>  <span class="comment">// Since the total size of `vec` (between all nodes) is one column</span></div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  <span class="comment">// and each node stores (possibly) multiple columns (vec.numAmpsPerChunk as many), </span></div>
<div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  <span class="comment">// `vec` can be fit entirely inside a single node's matr.pairStateVec (with excess!)</span></div>
<div class="line"><a name="l00379"></a><span class="lineno"> 379</span>  </div>
<div class="line"><a name="l00380"></a><span class="lineno"> 380</span>  <span class="comment">// copy this node's vec segment into this node's matr pairState (in the right spot)</span></div>
<div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> numLocalAmps = vec.<a class="code" href="structQureg.html#ab0ea0358482b62f43fdd781469607d97">numAmpsPerChunk</a>;</div>
<div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> myOffset = vec.<a class="code" href="structQureg.html#ac2929e681d3d95591c18cf168dbbe4f0">chunkId</a> * numLocalAmps;</div>
<div class="line"><a name="l00383"></a><span class="lineno"> 383</span>  memcpy(&matr.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real[myOffset], vec.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.real, numLocalAmps * <span class="keyword">sizeof</span>(<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>));</div>
<div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  memcpy(&matr.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag[myOffset], vec.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.imag, numLocalAmps * <span class="keyword">sizeof</span>(<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>));</div>
<div class="line"><a name="l00385"></a><span class="lineno"> 385</span>  </div>
<div class="line"><a name="l00386"></a><span class="lineno"> 386</span>  <span class="comment">// we now want to share this node's vec segment with other node, so that </span></div>
<div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  <span class="comment">// vec is cloned in every node's matr.pairStateVec </span></div>
<div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  </div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span>  <span class="comment">// work out how many messages needed to send vec chunks (2GB limit)</span></div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> maxMsgSize = MPI_MAX_AMPS_IN_MSG;</div>
<div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  <span class="keywordflow">if</span> (numLocalAmps < maxMsgSize) </div>
<div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  maxMsgSize = numLocalAmps;</div>
<div class="line"><a name="l00393"></a><span class="lineno"> 393</span>  <span class="comment">// safely assume MPI_MAX... = 2^n, so division always exact:</span></div>
<div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  <span class="keywordtype">int</span> numMsgs = numLocalAmps / maxMsgSize;</div>
<div class="line"><a name="l00395"></a><span class="lineno"> 395</span>  </div>
<div class="line"><a name="l00396"></a><span class="lineno"> 396</span>  <span class="comment">// every node gets a turn at being the broadcaster</span></div>
<div class="line"><a name="l00397"></a><span class="lineno"> 397</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> broadcaster=0; broadcaster < vec.<a class="code" href="structQureg.html#aa3deb7163aab90a61e755a1f200f5413">numChunks</a>; broadcaster++) {</div>
<div class="line"><a name="l00398"></a><span class="lineno"> 398</span>  </div>
<div class="line"><a name="l00399"></a><span class="lineno"> 399</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> otherOffset = broadcaster * numLocalAmps;</div>
<div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  </div>
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  <span class="comment">// every node sends a slice of qureg's pairState to every other</span></div>
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i< numMsgs; i++) {</div>
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  </div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  <span class="comment">// by sending that slice in further slices (due to bandwidth limit)</span></div>
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span>  MPI_Bcast(</div>
<div class="line"><a name="l00406"></a><span class="lineno"> 406</span>  &matr.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real[otherOffset + i*maxMsgSize], </div>
<div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  maxMsgSize, MPI_QuEST_REAL, broadcaster, MPI_COMM_WORLD);</div>
<div class="line"><a name="l00408"></a><span class="lineno"> 408</span>  MPI_Bcast(</div>
<div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  &matr.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag[otherOffset + i*maxMsgSize], </div>
<div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  maxMsgSize, MPI_QuEST_REAL, broadcaster, MPI_COMM_WORLD);</div>
<div class="line"><a name="l00411"></a><span class="lineno"> 411</span>  }</div>
<div class="line"><a name="l00412"></a><span class="lineno"> 412</span>  }</div>
<div class="line"><a name="l00413"></a><span class="lineno"> 413</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST_8h_source.html#l00217">Qureg::chunkId</a>, <a class="el" href="QuEST_8h_source.html#l00213">Qureg::numAmpsPerChunk</a>, <a class="el" href="QuEST_8h_source.html#l00219">Qureg::numChunks</a>, <a class="el" href="QuEST_8h_source.html#l00224">Qureg::pairStateVec</a>, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>, and <a class="el" href="QuEST_8h_source.html#l00222">Qureg::stateVec</a>.</p>
<p class="reference">Referenced by <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00415">densmatr_calcFidelity()</a>, and <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00452">densmatr_initPureState()</a>.</p>
</div>
</div>
<a id="a076fe6125da4d6037b8bc4d912df4015"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a076fe6125da4d6037b8bc4d912df4015">◆ </a></span>densityMatrixBlockFitsInChunk()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static int densityMatrixBlockFitsInChunk </td>
<td>(</td>
<td class="paramtype">long long int </td>
<td class="paramname"><em>chunkSize</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>numQubits</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>targetQubit</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00363">363</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  {</div>
<div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> sizeOuterHalfBlock = 1LL << (targetQubit+numQubits);</div>
<div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  <span class="keywordflow">if</span> (chunkSize > sizeOuterHalfBlock) <span class="keywordflow">return</span> 1;</div>
<div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span> }</div>
</div><!-- fragment -->
<p class="reference">Referenced by <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00725">densmatr_mixDamping()</a>, <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00698">densmatr_mixDepolarising()</a>, and <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00752">densmatr_mixTwoQubitDepolarising()</a>.</p>
</div>
</div>
<a id="aedd7ecccf2f09dd2f1c5d191950b51e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aedd7ecccf2f09dd2f1c5d191950b51e6">◆ </a></span>densmatr_applyDiagonalOp()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void densmatr_applyDiagonalOp </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structDiagonalOp.html">DiagonalOp</a> </td>
<td class="paramname"><em>op</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01517">1517</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01517"></a><span class="lineno"> 1517</span>  {</div>
<div class="line"><a name="l01518"></a><span class="lineno"> 1518</span>  </div>
<div class="line"><a name="l01519"></a><span class="lineno"> 1519</span>  <a class="code" href="QuEST__cpu__distributed_8c.html#aefba328e047e6ef4fd1ae4b56901aaa7">copyDiagOpIntoMatrixPairState</a>(qureg, op);</div>
<div class="line"><a name="l01520"></a><span class="lineno"> 1520</span>  <a class="code" href="QuEST__cpu_8c.html#afa58cf7cb98a25ab33621120c5c330d0">densmatr_applyDiagonalOpLocal</a>(qureg, op);</div>
<div class="line"><a name="l01521"></a><span class="lineno"> 1521</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01482">copyDiagOpIntoMatrixPairState()</a>, and <a class="el" href="QuEST__cpu_8c_source.html#l03696">densmatr_applyDiagonalOpLocal()</a>.</p>
</div>
</div>
<a id="a70e3b0a2297c186d5c779af31459b4ca"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a70e3b0a2297c186d5c779af31459b4ca">◆ </a></span>densmatr_calcExpecDiagonalOp()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structComplex.html">Complex</a> densmatr_calcExpecDiagonalOp </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structDiagonalOp.html">DiagonalOp</a> </td>
<td class="paramname"><em>op</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l01541">1541</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l01541"></a><span class="lineno"> 1541</span>  {</div>
<div class="line"><a name="l01542"></a><span class="lineno"> 1542</span>  </div>
<div class="line"><a name="l01543"></a><span class="lineno"> 1543</span>  <a class="code" href="structComplex.html">Complex</a> localVal = <a class="code" href="QuEST__cpu_8c.html#aeb4453a2e609e5359d2995bccf6663ca">densmatr_calcExpecDiagonalOpLocal</a>(qureg, op);</div>
<div class="line"><a name="l01544"></a><span class="lineno"> 1544</span>  <span class="keywordflow">if</span> (qureg.<a class="code" href="structQureg.html#aa3deb7163aab90a61e755a1f200f5413">numChunks</a> == 1)</div>
<div class="line"><a name="l01545"></a><span class="lineno"> 1545</span>  <span class="keywordflow">return</span> localVal;</div>
<div class="line"><a name="l01546"></a><span class="lineno"> 1546</span>  </div>
<div class="line"><a name="l01547"></a><span class="lineno"> 1547</span>  <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> localRe = localVal.<a class="code" href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">real</a>;</div>
<div class="line"><a name="l01548"></a><span class="lineno"> 1548</span>  <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> localIm = localVal.<a class="code" href="structComplex.html#a84f5439aad0ef495efdd3b4c1c02d27e">imag</a>;</div>
<div class="line"><a name="l01549"></a><span class="lineno"> 1549</span>  <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> globalRe, globalIm;</div>
<div class="line"><a name="l01550"></a><span class="lineno"> 1550</span>  </div>
<div class="line"><a name="l01551"></a><span class="lineno"> 1551</span>  MPI_Allreduce(&localRe, &globalRe, 1, MPI_QuEST_REAL, MPI_SUM, MPI_COMM_WORLD);</div>
<div class="line"><a name="l01552"></a><span class="lineno"> 1552</span>  MPI_Allreduce(&localIm, &globalIm, 1, MPI_QuEST_REAL, MPI_SUM, MPI_COMM_WORLD);</div>
<div class="line"><a name="l01553"></a><span class="lineno"> 1553</span>  </div>
<div class="line"><a name="l01554"></a><span class="lineno"> 1554</span>  <a class="code" href="structComplex.html">Complex</a> globalVal;</div>
<div class="line"><a name="l01555"></a><span class="lineno"> 1555</span>  globalVal.<a class="code" href="structComplex.html#ab5b2e2eca02131fc74b289a83636cbe3">real</a> = globalRe;</div>
<div class="line"><a name="l01556"></a><span class="lineno"> 1556</span>  globalVal.<a class="code" href="structComplex.html#a84f5439aad0ef495efdd3b4c1c02d27e">imag</a> = globalIm;</div>
<div class="line"><a name="l01557"></a><span class="lineno"> 1557</span>  <span class="keywordflow">return</span> globalVal;</div>
<div class="line"><a name="l01558"></a><span class="lineno"> 1558</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu_8c_source.html#l03781">densmatr_calcExpecDiagonalOpLocal()</a>, <a class="el" href="QuEST_8h_source.html#l00106">Complex::imag</a>, <a class="el" href="QuEST_8h_source.html#l00219">Qureg::numChunks</a>, <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>, and <a class="el" href="QuEST_8h_source.html#l00105">Complex::real</a>.</p>
</div>
</div>
<a id="aa6c3f86010ad398f42b0577ea3bb5bcf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa6c3f86010ad398f42b0577ea3bb5bcf">◆ </a></span>densmatr_calcFidelity()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> densmatr_calcFidelity </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>qureg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>pureState</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00415">415</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00415"></a><span class="lineno"> 415</span>  {</div>
<div class="line"><a name="l00416"></a><span class="lineno"> 416</span>  </div>
<div class="line"><a name="l00417"></a><span class="lineno"> 417</span>  <span class="comment">// set qureg's pairState is to be the full pureState (on every node)</span></div>
<div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  <a class="code" href="QuEST__cpu__distributed_8c.html#a95af772d87c461fc8abfd6d47b752ac2">copyVecIntoMatrixPairState</a>(qureg, pureState);</div>
<div class="line"><a name="l00419"></a><span class="lineno"> 419</span>  </div>
<div class="line"><a name="l00420"></a><span class="lineno"> 420</span>  <span class="comment">// collect calcFidelityLocal by every machine</span></div>
<div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> localSum = <a class="code" href="QuEST__cpu_8c.html#a7772f97cb4d92a9825bf3b7c82c3230c">densmatr_calcFidelityLocal</a>(qureg, pureState);</div>
<div class="line"><a name="l00422"></a><span class="lineno"> 422</span>  </div>
<div class="line"><a name="l00423"></a><span class="lineno"> 423</span>  <span class="comment">// sum each localSum</span></div>
<div class="line"><a name="l00424"></a><span class="lineno"> 424</span>  <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> globalSum;</div>
<div class="line"><a name="l00425"></a><span class="lineno"> 425</span>  MPI_Allreduce(&localSum, &globalSum, 1, MPI_QuEST_REAL, MPI_SUM, MPI_COMM_WORLD);</div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span>  </div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span>  <span class="keywordflow">return</span> globalSum;</div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00371">copyVecIntoMatrixPairState()</a>, <a class="el" href="QuEST__cpu_8c_source.html#l00990">densmatr_calcFidelityLocal()</a>, and <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>.</p>
</div>
</div>
<a id="a8c9da88f734b0862f4cce7d819e6d3b5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8c9da88f734b0862f4cce7d819e6d3b5">◆ </a></span>densmatr_calcHilbertSchmidtDistance()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> densmatr_calcHilbertSchmidtDistance </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>b</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00430">430</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  {</div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span>  </div>
<div class="line"><a name="l00432"></a><span class="lineno"> 432</span>  <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> localSum = <a class="code" href="QuEST__cpu_8c.html#a939897137596bb73ad7a028d0beaaa10">densmatr_calcHilbertSchmidtDistanceSquaredLocal</a>(a, b);</div>
<div class="line"><a name="l00433"></a><span class="lineno"> 433</span>  </div>
<div class="line"><a name="l00434"></a><span class="lineno"> 434</span>  <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> globalSum;</div>
<div class="line"><a name="l00435"></a><span class="lineno"> 435</span>  MPI_Allreduce(&localSum, &globalSum, 1, MPI_QuEST_REAL, MPI_SUM, MPI_COMM_WORLD);</div>
<div class="line"><a name="l00436"></a><span class="lineno"> 436</span>  </div>
<div class="line"><a name="l00437"></a><span class="lineno"> 437</span>  <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> dist = sqrt(globalSum);</div>
<div class="line"><a name="l00438"></a><span class="lineno"> 438</span>  <span class="keywordflow">return</span> dist;</div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span> }</div>
</div><!-- fragment -->
<p class="reference">References <a class="el" href="QuEST__cpu_8c_source.html#l00923">densmatr_calcHilbertSchmidtDistanceSquaredLocal()</a>, and <a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>.</p>
</div>
</div>
<a id="a6ff3dc624b5fafe8edae4fe327c255a0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6ff3dc624b5fafe8edae4fe327c255a0">◆ </a></span>densmatr_calcInnerProduct()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> densmatr_calcInnerProduct </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>a</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structQureg.html">Qureg</a> </td>
<td class="paramname"><em>b</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="QuEST__cpu__distributed_8c_source.html#l00441">441</a> of file <a class="el" href="QuEST__cpu__distributed_8c_source.html">QuEST_cpu_distributed.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00441"></a><span class="lineno"> 441</span>  {</div>
<div class="line"><a name="l00442"></a><span class="lineno"> 442</span>  </div>
<div class="line"><a name="l00443"></a><span class="lineno"> 443</span>  <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> localSum = <a class="code" href="QuEST__cpu_8c.html#a08392b1b27d10e3b8a8648a5afeaa629">densmatr_calcInnerProductLocal</a>(a, b);</div>