-
Notifications
You must be signed in to change notification settings - Fork 3
/
MVlookup.nb
1765 lines (1671 loc) · 75.1 KB
/
MVlookup.nb
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
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 9.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 157, 7]
NotebookDataLength[ 76683, 1756]
NotebookOptionsPosition[ 73146, 1637]
NotebookOutlinePosition[ 73485, 1652]
CellTagsIndexPosition[ 73442, 1649]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
RowBox[{
RowBox[{"(*", " ",
RowBox[{
RowBox[{"cost", " ", "of", " ", "MV", " ", "sumcheck"}], ",", " ",
RowBox[{
RowBox[{"relative", " ", "to", " ", "the", " ", "size"}], "|", "H", "|",
" ",
RowBox[{
RowBox[{"of", " ", "the", " ", "n"}], "-",
RowBox[{"dimensional", " ", "hypercube"}]}]}]}], "\n", "*)"}], "\n",
RowBox[{
RowBox[{
RowBox[{"ClearAll", "@", "sumcheck"}], ";"}], "\n",
RowBox[{
RowBox[{"sumcheck", "[",
RowBox[{"n_", ",", "d_", ",", "numVars_", ",",
RowBox[{"{",
RowBox[{"Qm_", ",", "Qs_", ",", "Qa_"}], "}"}]}], "]"}], ":=", "\n",
RowBox[{
RowBox[{"(",
RowBox[{"1", " ", "-", " ",
RowBox[{"1", "/",
RowBox[{"2", "^",
RowBox[{"(", "n", ")"}]}]}]}], ")"}], " ", "*", " ",
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{"d", "*", "numVars"}], " ", "+", " ",
RowBox[{
RowBox[{"(",
RowBox[{"d", "+", "1"}], ")"}], " ", "*", " ", "Qm"}]}], ",", " ",
RowBox[{
RowBox[{"(",
RowBox[{"numVars", "+", " ", "d", " ", "+", " ", "1"}], ")"}], " ",
"*", " ", "Qs"}], ",", " ",
RowBox[{
RowBox[{"d", "*", "numVars"}], " ", "+", " ",
RowBox[{
RowBox[{"(",
RowBox[{"d", "+", "1"}], ")"}], "*",
RowBox[{"(",
RowBox[{"Qa", " ", "+", " ", "1"}], ")"}]}]}]}], "}"}],
" "}]}]}]}]], "Code",
CellChangeTimes->{{3.8750892597671213`*^9, 3.8750893986050997`*^9}, {
3.8750894332159452`*^9, 3.875089434032494*^9}, {3.875089522618288*^9,
3.8750895264495363`*^9}, {3.875090719855582*^9, 3.875090921681652*^9},
3.875091020506954*^9, 3.875095525984243*^9, {3.875464062927775*^9,
3.875464063514955*^9}, {3.8754642664194927`*^9, 3.875464274987112*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{
RowBox[{"(*", " ",
RowBox[{
RowBox[{"From", " ", "Berstein", " ", "and", " ", "Lange"}], ",", " ",
"2007", ",", " ",
RowBox[{
RowBox[{
RowBox[{
"Analysis", " ", "of", " ", "EC", " ", "single", " ", "scalar", " ",
"multiplication", "\[IndentingNewLine]", "costPerScalarBit"}], " ",
"=", " ", "8"}], ";", " ",
RowBox[{"(*", " ",
RowBox[{"InvEdwards", " ", "coordinates"}], " ", "*)"}], "\n",
RowBox[{"costPerScalarMul", " ", "=", " ",
RowBox[{
RowBox[{"8", "*", "255", "\n", "costPippengerPerScalar"}], " ", "=",
" ",
RowBox[{"costPerScalarMul", "/", "12"}]}]}]}]}], " ",
RowBox[{"(*", " ",
RowBox[{
RowBox[{
RowBox[{"1", " ", "/", " ", "log"}], "|", "H", "|"}], ",", " ",
RowBox[{
RowBox[{"with", " ", "|", "H", "|"}], "=",
RowBox[{"2", "^", "12"}]}]}], " ", "*)"}], " ", "\n", "*)"}], "\n",
"\n",
RowBox[{"(*", " ", "\n",
RowBox[{
RowBox[{
RowBox[{
"Cost", " ", "of", " ", "Pippenger", " ", "in", " ", "terms", " ", "of",
" ", "field", " ",
RowBox[{"multiplications", ".", "\n", "Based"}], " ", "on", " ",
"Marcin", " ", "single"}], "-",
RowBox[{"threaded", " ", "benchmarks", " ", "of", " ", "Pippenger", "\n",
RowBox[{"https", ":"}]}]}], "//",
RowBox[{
RowBox[{
RowBox[{"github", ".", "com"}], "/", "Orbis"}], "-",
RowBox[{
RowBox[{
RowBox[{"Tertius", "/", "Orbis"}], "/", "issues"}], "/", "97"}]}]}],
"\n", "*)"}], "\n", "\n", "\n",
RowBox[{
RowBox[{
RowBox[{"instanceSizes", " ", "=", " ",
RowBox[{"Range", "[",
RowBox[{"12", ",", "18"}], "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"benchesPippenger", "=", " ",
RowBox[{"{",
RowBox[{
"46.010", ",", " ", "82.382", ",", " ", "153.67", ",", " ", "279.35",
",", " ", "522.13", ",", " ", "1003.4", ",", " ", "1869.5"}], "}"}]}],
";"}], " ",
RowBox[{"(*", " ",
RowBox[{
RowBox[{
RowBox[{"for", " ", "N"}], "=", "12"}], ",", " ", "13", ",", "...", ",",
" ", "18"}], "*)"}], "\n",
RowBox[{
RowBox[{"benchesFieldMul", " ", "=", " ",
RowBox[{"{",
RowBox[{
"21.110", ",", " ", "42.315", ",", " ", "84.777", ",", " ", "169.70",
",", " ", "339.25", ",", " ", "679.27", ",", " ", "1360.6"}], "}"}]}],
";"}], " ",
RowBox[{"(*", " ",
RowBox[{"for", " ",
RowBox[{"2", "^", "8"}], " ", "*", " ", "N"}], " ", "*)"}], "\n",
RowBox[{"equivalentMuls", " ", "=", " ",
RowBox[{
RowBox[{"benchesPippenger", "/", "benchesFieldMul"}], " ", "*", " ",
RowBox[{"2", "^", "8"}]}]}]}]}]], "Code",
CellChangeTimes->{
3.876385782402144*^9, {3.876546678241295*^9, 3.876546833037793*^9}, {
3.8765470262945023`*^9, 3.876547038754353*^9}, {3.87655572188908*^9,
3.876556138055821*^9}, {3.8765561847248993`*^9, 3.876556222062521*^9},
3.876556258761971*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
"557.9611558503079`", ",", "498.39990547087325`", ",",
"464.03529259115084`", ",", "421.41190335886864`", ",",
"394.00229918938834`", ",", "378.1565504144155`", ",",
"351.75069822137294`"}], "}"}]], "Output",
CellChangeTimes->{
3.876556259442092*^9, 3.876556717781522*^9, 3.8765601122094593`*^9,
3.8765601718109207`*^9, 3.876560948777672*^9, {3.876565089141786*^9,
3.876565141901601*^9}, 3.876572676005343*^9, 3.8769972609926777`*^9}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"maxM", " ", "=", " ", "200"}], ";"}], "\n",
RowBox[{
RowBox[{"domainSize", " ", "=", " ", "12"}], ";"}], "\n",
RowBox[{"costPippengerPerScalar", " ", "=", " ",
RowBox[{"equivalentMuls", "[",
RowBox[{"[",
RowBox[{
RowBox[{
RowBox[{"Position", "[",
RowBox[{"instanceSizes", ",", " ", "domainSize"}], "]"}], "//",
"Flatten"}], "//", "First"}], "]"}], "]"}]}]}], "Code",
CellChangeTimes->{{3.876386163553298*^9, 3.8763861664544897`*^9}, {
3.876546999625012*^9, 3.876546999759676*^9}, {3.876556226246236*^9,
3.876556226492296*^9}, {3.8765567156743507`*^9, 3.876556716055079*^9}, {
3.8765601100124598`*^9, 3.876560110598651*^9}, {3.876560170382987*^9,
3.876560170719102*^9}, {3.876560946908489*^9, 3.876560947221896*^9}, {
3.876565087382625*^9, 3.876565139674706*^9}, {3.876572674254801*^9,
3.876572674499219*^9}}],
Cell[BoxData["557.9611558503079`"], "Output",
CellChangeTimes->{{3.876556228208119*^9, 3.8765562564138317`*^9}, {
3.8765567178043118`*^9, 3.87655671821242*^9}, {3.8765601122130632`*^9,
3.876560112567276*^9}, {3.876560171830325*^9, 3.876560172126446*^9}, {
3.876560948797903*^9, 3.8765609491039953`*^9}, {3.8765650891547327`*^9,
3.876565142228589*^9}, {3.876572676018879*^9, 3.876572676427266*^9}, {
3.876997261037283*^9, 3.8769972627925158`*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell["Based on the logarithmic derivative", "Section",
CellChangeTimes->{{3.876385540206491*^9, 3.8763855496770477`*^9}}],
Cell[CellGroupData[{
Cell["small number of columns", "Subsection",
CellChangeTimes->{{3.87657263997535*^9, 3.876572644391529*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"arithComp", " ", "=", " ",
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{"4", "M"}], " ", "+", " ", "1"}], ",", "1", ",",
RowBox[{"M", "+", "1"}]}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"costsumcheck", " ", "=", " ",
RowBox[{
RowBox[{
RowBox[{"sumcheck", "[",
RowBox[{"n", ",", " ",
RowBox[{"M", "+", "3"}], ",",
RowBox[{"M", "+", "4"}], ",", " ", "arithComp"}], " ", "]"}], "/",
RowBox[{"(",
RowBox[{"1", " ", "-", " ",
RowBox[{"1", "/",
RowBox[{"2", "^", "n"}]}]}], ")"}]}], "//",
"Simplify"}]}], "\[IndentingNewLine]",
RowBox[{"cost", " ", "=", " ",
RowBox[{
RowBox[{"costsumcheck", "+", " ",
RowBox[{"{",
RowBox[{"7", ",", " ", "1", ",", " ",
RowBox[{
RowBox[{"2", "M"}], "+", "1"}]}], "}"}]}], "//",
"Simplify"}]}]}], "Code",
CellChangeTimes->{{3.8750909259659147`*^9, 3.8750909755423727`*^9}, {
3.875091011817265*^9, 3.875091011971953*^9}, {3.875091761347869*^9,
3.8750917685033712`*^9}, {3.875095922978674*^9, 3.875095924237027*^9}, {
3.875102731687755*^9, 3.875102732249934*^9}, {3.8751027766648827`*^9,
3.8751027771588306`*^9}, {3.8751035450282717`*^9, 3.875103545106289*^9}, {
3.875103575541709*^9, 3.875103575695881*^9}, {3.87544903570872*^9,
3.875449051990718*^9}, {3.875459791604109*^9, 3.875459793447543*^9}, {
3.875460098494342*^9, 3.875460146550344*^9}, 3.8754622749212112`*^9, {
3.8754623550682497`*^9, 3.875462355922514*^9}, {3.8754628105165787`*^9,
3.8754628283143*^9}, {3.875462860582975*^9, 3.875462874171104*^9}, {
3.8754629739336987`*^9, 3.8754629980591993`*^9}, {3.875464304445507*^9,
3.8754643097529507`*^9}, {3.875464374646179*^9, 3.875464379549264*^9}, {
3.875464667348877*^9, 3.875464667406427*^9}, {3.875464789979189*^9,
3.87546480291568*^9}, {3.875464900566935*^9, 3.875464925993936*^9}, {
3.8754665630601683`*^9, 3.875466563364303*^9}, {3.875603537872497*^9,
3.875603540199489*^9}, {3.87560358270327*^9, 3.875603659183642*^9}, {
3.875604134438981*^9, 3.875604134819813*^9}, 3.875604513449641*^9, {
3.8757017826018*^9, 3.87570182248929*^9}, {3.876295114711844*^9,
3.876295115023265*^9}, {3.876385582696113*^9, 3.876385587334529*^9}, {
3.8763857218627453`*^9, 3.8763857221737823`*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"16", "+",
RowBox[{"24", " ", "M"}], "+",
RowBox[{"5", " ",
SuperscriptBox["M", "2"]}]}], ",",
RowBox[{"2", " ",
RowBox[{"(",
RowBox[{"4", "+", "M"}], ")"}]}], ",",
RowBox[{"20", "+",
RowBox[{"13", " ", "M"}], "+",
RowBox[{"2", " ",
SuperscriptBox["M", "2"]}]}]}], "}"}]], "Output",
CellChangeTimes->{{3.876385715009602*^9, 3.876385722596904*^9},
3.8763867511917953`*^9, 3.876388874745801*^9, 3.876545897342609*^9,
3.876546877593207*^9, 3.876547012008567*^9, 3.8765562564425907`*^9,
3.8765567179227877`*^9, 3.876560112246744*^9, 3.876560171852413*^9,
3.8765609488236647`*^9, {3.876565089189497*^9, 3.87656514196437*^9},
3.876572676140774*^9, 3.876997261144877*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"23", "+",
RowBox[{"24", " ", "M"}], "+",
RowBox[{"5", " ",
SuperscriptBox["M", "2"]}]}], ",",
RowBox[{"9", "+",
RowBox[{"2", " ", "M"}]}], ",",
RowBox[{"21", "+",
RowBox[{"15", " ", "M"}], "+",
RowBox[{"2", " ",
SuperscriptBox["M", "2"]}]}]}], "}"}]], "Output",
CellChangeTimes->{{3.876385715009602*^9, 3.876385722596904*^9},
3.8763867511917953`*^9, 3.876388874745801*^9, 3.876545897342609*^9,
3.876546877593207*^9, 3.876547012008567*^9, 3.8765562564425907`*^9,
3.8765567179227877`*^9, 3.876560112246744*^9, 3.876560171852413*^9,
3.8765609488236647`*^9, {3.876565089189497*^9, 3.87656514196437*^9},
3.876572676140774*^9, 3.876997261145756*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["large number of columns", "Subsection",
CellChangeTimes->{{3.876385600508483*^9, 3.876385604712728*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"arithComp", " ", "=", " ",
RowBox[{"{",
RowBox[{"4", ",", "1", ",", "2"}], "}"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{"costsumcheckLargeM", " ", "=", " ",
RowBox[{
RowBox[{"M", " ", "*", " ",
RowBox[{
RowBox[{"sumcheck", "[",
RowBox[{
RowBox[{"n", "+", "m"}], ",", " ", "4", ",", " ", "5", ",", " ",
"arithComp"}], "]"}], "/",
RowBox[{"(",
RowBox[{"1", " ", "-", " ",
RowBox[{"1", "/",
RowBox[{"2", "^",
RowBox[{"(",
RowBox[{"n", "+", "m"}], ")"}]}]}]}], ")"}]}]}], "//",
"Simplify"}]}], "\[IndentingNewLine]",
RowBox[{"costLargeM", " ", "=", " ",
RowBox[{
RowBox[{"costsumcheckLargeM", " ", "+", " ",
RowBox[{"M", " ", "*", " ",
RowBox[{"{",
RowBox[{"4", ",", " ", "0", ",", " ", "2"}], "}"}]}]}], "//",
"Simplify"}]}]}], "Code",
CellChangeTimes->{{3.8750909259659147`*^9, 3.8750909755423727`*^9}, {
3.875091011817265*^9, 3.875091011971953*^9}, {3.875091761347869*^9,
3.8750917685033712`*^9}, {3.875095922978674*^9, 3.875095924237027*^9}, {
3.875102731687755*^9, 3.875102732249934*^9}, {3.8751027766648827`*^9,
3.8751027771588306`*^9}, {3.8751035450282717`*^9, 3.875103545106289*^9}, {
3.875103575541709*^9, 3.875103575695881*^9}, {3.87544903570872*^9,
3.875449051990718*^9}, {3.875459791604109*^9, 3.875459793447543*^9}, {
3.875460098494342*^9, 3.875460146550344*^9}, 3.8754622749212112`*^9, {
3.8754623550682497`*^9, 3.875462355922514*^9}, {3.8754628105165787`*^9,
3.8754628283143*^9}, {3.875462860582975*^9, 3.875462874171104*^9}, {
3.8754629739336987`*^9, 3.8754629980591993`*^9}, {3.875464304445507*^9,
3.8754643097529507`*^9}, {3.875464374646179*^9, 3.875464379549264*^9}, {
3.875464667348877*^9, 3.875464667406427*^9}, {3.875464789979189*^9,
3.87546480291568*^9}, {3.875464900566935*^9, 3.875464925993936*^9}, {
3.8754665630601683`*^9, 3.875466563364303*^9}, {3.875603537872497*^9,
3.875603540199489*^9}, {3.87560358270327*^9, 3.875603659183642*^9}, {
3.875604134438981*^9, 3.875604134819813*^9}, 3.875604513449641*^9, {
3.8757017826018*^9, 3.87570182248929*^9}, {3.876294935922762*^9,
3.876294976871594*^9}, {3.8762950096121683`*^9, 3.87629504286515*^9}, {
3.876295088768346*^9, 3.876295091983234*^9}, {3.876295140653759*^9,
3.8762952201241207`*^9}, {3.8762954318300037`*^9, 3.876295438845056*^9}, {
3.876368111846792*^9, 3.876368114205063*^9}, {3.876385621768506*^9,
3.876385712184557*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"40", " ", "M"}], ",",
RowBox[{"10", " ", "M"}], ",",
RowBox[{"35", " ", "M"}]}], "}"}]], "Output",
CellChangeTimes->{{3.876385715044609*^9, 3.876385715142146*^9},
3.87638675119805*^9, 3.8763888747507277`*^9, 3.8765458973800983`*^9,
3.876546877627763*^9, 3.876547012024343*^9, 3.876556256464425*^9,
3.8765567179640636`*^9, 3.876560112250761*^9, 3.8765601718693943`*^9,
3.8765609488288097`*^9, {3.876565089207079*^9, 3.876565141969204*^9},
3.876572676165784*^9, 3.876997261153358*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"44", " ", "M"}], ",",
RowBox[{"10", " ", "M"}], ",",
RowBox[{"37", " ", "M"}]}], "}"}]], "Output",
CellChangeTimes->{{3.876385715044609*^9, 3.876385715142146*^9},
3.87638675119805*^9, 3.8763888747507277`*^9, 3.8765458973800983`*^9,
3.876546877627763*^9, 3.876547012024343*^9, 3.876556256464425*^9,
3.8765567179640636`*^9, 3.876560112250761*^9, 3.8765601718693943`*^9,
3.8765609488288097`*^9, {3.876565089207079*^9, 3.876565141969204*^9},
3.876572676165784*^9, 3.8769972611576033`*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["break even point", "Subsection",
CellChangeTimes->{{3.876385748469411*^9, 3.876385752247199*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{"costWithComm", " ", "=", " ",
RowBox[{"cost", " ", "+", " ",
RowBox[{"costPippengerPerScalar", "*", "2"}]}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"costWithCommLarge", " ", "=", " ",
RowBox[{"costLargeM", " ", "+", " ",
RowBox[{"costPippengerPerScalar", "*",
RowBox[{"(",
RowBox[{"M", "+", "1"}], ")"}]}]}]}], "\n", "\n",
RowBox[{"(*", " ",
RowBox[{
"break", " ", "even", " ", "point", " ", "with", " ", "linear", " ",
"strategy"}], " ", "*)"}]}], "\n",
RowBox[{"sol", " ", "=", " ",
RowBox[{"NSolve", "[",
RowBox[{
RowBox[{
RowBox[{"costWithComm", "[",
RowBox[{"[", "1", "]"}], "]"}], " ", "\[Equal]", " ",
RowBox[{"costWithCommLarge", "[",
RowBox[{"[", "1", "]"}], "]"}]}], ",", "M"}], "]"}]}], "\n",
RowBox[{
RowBox[{"breakEven", " ", "=", " ",
RowBox[{
RowBox[{
RowBox[{"M", " ", "/.", " ", "sol"}], " ", "//", " ", "Last"}], "//",
"Floor"}]}], "\n", "\n",
RowBox[{"(*", " ",
RowBox[{"maximum", " ", "speedup"}], " ", "*)"}]}], "\n",
RowBox[{
RowBox[{"ratio", " ", "=", " ",
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"costWithCommLarge", "[",
RowBox[{"[", "1", "]"}], "]"}], "/",
RowBox[{"costWithComm", "[",
RowBox[{"[", "1", "]"}], "]"}]}], "/.",
RowBox[{"{",
RowBox[{"M", "\[Rule]", "x"}], "}"}]}], ",", "\[IndentingNewLine]",
RowBox[{"{",
RowBox[{"x", ",", "1", ",", " ", "breakEven"}], "}"}]}], "]"}]}],
";"}], "\n",
RowBox[{
RowBox[{"max", " ", "=", " ",
RowBox[{"Max", "@", "ratio"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"max", "//", "N"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"Position", "[",
RowBox[{"ratio", ",", "max"}], "]"}], "//", "Flatten"}], "\n", "\n",
RowBox[{"(*", " ",
RowBox[{
"range", " ", "for", " ", "0.8", " ", "of", " ", "the", " ", "maximum",
" ", "speedup"}], " ", "*)"}]}], "\n",
RowBox[{"threshold", " ", "=", " ", "1.5"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"Position", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"#", "\[GreaterEqual]", "threshold"}], ")"}], "&"}], "/@",
"ratio"}], ",", "True"}], "]"}], "//", "Flatten"}], "\n"}], "\n",
RowBox[{"ListPlot", "[",
RowBox[{"ratio", ",",
RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}]}], "Code",
CellChangeTimes->{{3.8763858044317017`*^9, 3.876385921151272*^9}, {
3.876386743411701*^9, 3.876386838144216*^9}, {3.8763889126917133`*^9,
3.8763889257377234`*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"1138.9223117006159`", "\[VeryThinSpace]", "+",
RowBox[{"24", " ", "M"}], "+",
RowBox[{"5", " ",
SuperscriptBox["M", "2"]}]}], ",",
RowBox[{"1124.9223117006159`", "\[VeryThinSpace]", "+",
RowBox[{"2", " ", "M"}]}], ",",
RowBox[{"1136.9223117006159`", "\[VeryThinSpace]", "+",
RowBox[{"15", " ", "M"}], "+",
RowBox[{"2", " ",
SuperscriptBox["M", "2"]}]}]}], "}"}]], "Output",
CellChangeTimes->{{3.876385910047246*^9, 3.876385923439322*^9}, {
3.8763867512289867`*^9, 3.8763868387229633`*^9}, {3.876388874777326*^9,
3.876388875009164*^9}, 3.876388926834021*^9, 3.876545897410365*^9,
3.876546877634027*^9, 3.876547012070548*^9, 3.876556256487472*^9,
3.876556717970819*^9, 3.876560112282793*^9, 3.8765601718768682`*^9,
3.8765609488515263`*^9, {3.876565089213463*^9, 3.8765651419895573`*^9},
3.876572676171049*^9, 3.876997261206531*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{"44", " ", "M"}], "+",
RowBox[{"557.9611558503079`", " ",
RowBox[{"(",
RowBox[{"1", "+", "M"}], ")"}]}]}], ",",
RowBox[{
RowBox[{"10", " ", "M"}], "+",
RowBox[{"557.9611558503079`", " ",
RowBox[{"(",
RowBox[{"1", "+", "M"}], ")"}]}]}], ",",
RowBox[{
RowBox[{"37", " ", "M"}], "+",
RowBox[{"557.9611558503079`", " ",
RowBox[{"(",
RowBox[{"1", "+", "M"}], ")"}]}]}]}], "}"}]], "Output",
CellChangeTimes->{{3.876385910047246*^9, 3.876385923439322*^9}, {
3.8763867512289867`*^9, 3.8763868387229633`*^9}, {3.876388874777326*^9,
3.876388875009164*^9}, 3.876388926834021*^9, 3.876545897410365*^9,
3.876546877634027*^9, 3.876547012070548*^9, 3.876556256487472*^9,
3.876556717970819*^9, 3.876560112282793*^9, 3.8765601718768682`*^9,
3.8765609488515263`*^9, {3.876565089213463*^9, 3.8765651419895573`*^9},
3.876572676171049*^9, 3.876997261212948*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"M", "\[Rule]", "1.0140872173493711`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"M", "\[Rule]", "114.57814395271221`"}], "}"}]}], "}"}]], "Output",\
CellChangeTimes->{{3.876385910047246*^9, 3.876385923439322*^9}, {
3.8763867512289867`*^9, 3.8763868387229633`*^9}, {3.876388874777326*^9,
3.876388875009164*^9}, 3.876388926834021*^9, 3.876545897410365*^9,
3.876546877634027*^9, 3.876547012070548*^9, 3.876556256487472*^9,
3.876556717970819*^9, 3.876560112282793*^9, 3.8765601718768682`*^9,
3.8765609488515263`*^9, {3.876565089213463*^9, 3.8765651419895573`*^9},
3.876572676171049*^9, 3.876997261254324*^9}],
Cell[BoxData["114"], "Output",
CellChangeTimes->{{3.876385910047246*^9, 3.876385923439322*^9}, {
3.8763867512289867`*^9, 3.8763868387229633`*^9}, {3.876388874777326*^9,
3.876388875009164*^9}, 3.876388926834021*^9, 3.876545897410365*^9,
3.876546877634027*^9, 3.876547012070548*^9, 3.876556256487472*^9,
3.876556717970819*^9, 3.876560112282793*^9, 3.8765601718768682`*^9,
3.8765609488515263`*^9, {3.876565089213463*^9, 3.8765651419895573`*^9},
3.876572676171049*^9, 3.876997261255728*^9}],
Cell[BoxData["3.6601636210353585`"], "Output",
CellChangeTimes->{{3.876385910047246*^9, 3.876385923439322*^9}, {
3.8763867512289867`*^9, 3.8763868387229633`*^9}, {3.876388874777326*^9,
3.876388875009164*^9}, 3.876388926834021*^9, 3.876545897410365*^9,
3.876546877634027*^9, 3.876547012070548*^9, 3.876556256487472*^9,
3.876556717970819*^9, 3.876560112282793*^9, 3.8765601718768682`*^9,
3.8765609488515263`*^9, {3.876565089213463*^9, 3.8765651419895573`*^9},
3.876572676171049*^9, 3.8769972612643023`*^9}],
Cell[BoxData[
RowBox[{"{", "14", "}"}]], "Output",
CellChangeTimes->{{3.876385910047246*^9, 3.876385923439322*^9}, {
3.8763867512289867`*^9, 3.8763868387229633`*^9}, {3.876388874777326*^9,
3.876388875009164*^9}, 3.876388926834021*^9, 3.876545897410365*^9,
3.876546877634027*^9, 3.876547012070548*^9, 3.876556256487472*^9,
3.876556717970819*^9, 3.876560112282793*^9, 3.8765601718768682`*^9,
3.8765609488515263`*^9, {3.876565089213463*^9, 3.8765651419895573`*^9},
3.876572676171049*^9, 3.87699726126502*^9}],
Cell[BoxData["1.5`"], "Output",
CellChangeTimes->{{3.876385910047246*^9, 3.876385923439322*^9}, {
3.8763867512289867`*^9, 3.8763868387229633`*^9}, {3.876388874777326*^9,
3.876388875009164*^9}, 3.876388926834021*^9, 3.876545897410365*^9,
3.876546877634027*^9, 3.876547012070548*^9, 3.876556256487472*^9,
3.876556717970819*^9, 3.876560112282793*^9, 3.8765601718768682`*^9,
3.8765609488515263`*^9, {3.876565089213463*^9, 3.8765651419895573`*^9},
3.876572676171049*^9, 3.876997261265718*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
"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"}], "}"}]], "Output",
CellChangeTimes->{{3.876385910047246*^9, 3.876385923439322*^9}, {
3.8763867512289867`*^9, 3.8763868387229633`*^9}, {3.876388874777326*^9,
3.876388875009164*^9}, 3.876388926834021*^9, 3.876545897410365*^9,
3.876546877634027*^9, 3.876547012070548*^9, 3.876556256487472*^9,
3.876556717970819*^9, 3.876560112282793*^9, 3.8765601718768682`*^9,
3.8765609488515263`*^9, {3.876565089213463*^9, 3.8765651419895573`*^9},
3.876572676171049*^9, 3.876997261266651*^9}],
Cell[BoxData[
GraphicsBox[{{},
{RGBColor[0.24720000000000014`, 0.24, 0.6], PointBox[CompressedData["
1:eJw11AlMFFccBvCBlcohLFlbpcihlHpziMghKN8Cyy7Xwi7sArsUK9Ei0Qoo
HpGqE8GgDTEIseJ6ISlqKYpApWK7dKG2KngWMKKirBZEDWFFRUTB2vh/k0wm
v/neN5mZl/dmpGcpV5pzHLfuw/n/9eNhCmm2Xzb28OJgCN2AfFK9a4b2NdkS
Db13rZTO42R7bMPAu1Abc3z0p3B7nr34wtEJZAe49555o736CdkJezsbvUfL
LMnT8avnZTdna2uyG0RaG1PTHBuyO7zLhn02mU0iz8S1Ydlwp455NiwyBv9+
Mc48F4eW9XZ5+NmS56PmtrJbIGP2ROuhKWdtg5i9If99nDP7jHkBsvv65xju
sOf5YHmkIHttMfNCmOqf/LszkNkXwWmqpIHb7H0XIb9QLbDNYfZDUKUxwyhg
9keO7fh7m1L2vQGwrM6+bXRlDkSVr7nz5p+tyItR2bu79bQfcxBOy/nzgS3s
/wUjs0W49KSceQkOBDp8t/reRPJSbF/t1Xx3NXMIOlMznwWPsfkAOuTqKS3F
ZB7wtcs/XjyT5WLcbXS83tJkQbkYz2a4ncxMIXOh2Oc0u3/PMM03H4qpg/MV
fj+w+Q9D62Zjd1oAy8OgWTPrvKBbQHk4Vpb0CJ0LyHw4Sov21JR7sFwCx+uj
uh1d5pRLEP140qazhWQuAhs3iJ7MDWB5BIYquEftT80ol+KrmoPG8qNkXoqs
+yaXHWqWy2D9yv23DCHLZSioE3eLWznKIxHisOIqV0jmI+Hhn2O1T8LyKHy9
XqIatGB5FBbeUuwxK35P6yMalgPpFRumkvlouBwMLnapYOsnBl+Uht3o8SLz
Maj1e1lzzDBGeSyWvlWqpIlkPhZVp2YYzj19R7kczV2yy935ZF6OrU03px91
ZXkcpFv1UX36t5THYYvoje5wGpmLR1xthfcZMzLioX/dZrI6MUrj46Fsu8fv
l5MN8YiN+wURI2+or4DEvjx8wo9kKJAoXBJnUJB5BfzKlW2ZZmSDAiWv6v8y
1Y1QX4nuYz6PJd+QoUSxR9VazTQyr8QCx3nzpv9D+49BiQTPqI27v2f7UQIy
qvd77g4nIwGNInGdiCPzCfjS40HX5/ph6ifg3N6cFyV5ZC4RCtEu/bogMhIh
DNSln373ivqJaCgsyg36g2z4MP5xer8wn8ypEL7FVeQmI0OF0Y4r5avsWF8F
6bY63Z3Ol9RXIXdbXUrWETKnRm7ttUKXVWSoEVLQMa3Hh8yrYdfkoa4ef0F9
NfqHOvR5bWQuCaFL1jhLD5CRBK8HufzEVWQ+CZXZx70b/Fn/w3jpivoYS9ZP
xo22uIsXuoaonwyrvOHlDtVkPhmGZN0p8XayIRncickTgxLIXAok+ta347NY
PwU3+y5Jd409p34KLBc/aL/ZTjak4PDKh/W3qsicBk55o+4lO8jQ4N4li6L3
GtbXQNBjm+voy/oa2AxcLbpvy/pahJVG/iTtN1FfC/HO9U2KP8m8Fv7Oj4wj
R8gGLSLEZbLAPDKXCrv+KxJhMuunIkDXHrlpEeunIlRlbvx2sinkP+75BZs=
"]]}, {}},
AspectRatio->NCache[GoldenRatio^(-1), 0.6180339887498948],
Axes->True,
AxesLabel->{None, None},
AxesOrigin->{1., 0.9931502293261688},
Method->{},
PlotRangeClipping->True]], "Output",
CellChangeTimes->{{3.876385910047246*^9, 3.876385923439322*^9}, {
3.8763867512289867`*^9, 3.8763868387229633`*^9}, {3.876388874777326*^9,
3.876388875009164*^9}, 3.876388926834021*^9, 3.876545897410365*^9,
3.876546877634027*^9, 3.876547012070548*^9, 3.876556256487472*^9,
3.876556717970819*^9, 3.876560112282793*^9, 3.8765601718768682`*^9,
3.8765609488515263`*^9, {3.876565089213463*^9, 3.8765651419895573`*^9},
3.876572676171049*^9, 3.876997261345639*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["Best strategy ", "Subsection",
CellChangeTimes->{{3.876386294229916*^9, 3.876386298685363*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"bestCostWithComm", " ", "=", " ",
RowBox[{"Join", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{"costWithComm", "[",
RowBox[{"[", "1", "]"}], "]"}], "/.",
RowBox[{"{",
RowBox[{"M", "\[Rule]", "x"}], "}"}]}], ",",
RowBox[{"{",
RowBox[{"x", ",", "1", ",", "breakEven"}], "}"}]}], "]"}], ",",
"\[IndentingNewLine]",
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{"costWithCommLarge", "[",
RowBox[{"[", "1", "]"}], "]"}], "/.",
RowBox[{"{",
RowBox[{"M", "\[Rule]", "x"}], "}"}]}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"breakEven", "+", "1"}], ",", "maxM"}], "}"}]}], "]"}]}],
"\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"ListPlot", "[", "bestCostWithComm", "]"}]}], "Code",
CellChangeTimes->{{3.8763863084943447`*^9, 3.8763864302263527`*^9}}],
Cell[BoxData[
GraphicsBox[{{},
{RGBColor[0.24720000000000014`, 0.24, 0.6], PointBox[CompressedData["
1:eJw11XlYzAkcx/GfY7fWscQuoYdZRzm2hNzSdwkRm0pW5/zmHsKu1u3Bz1rn
PitJjtUxhDZhY1VuI4lcWTlShilC0uGaNmNqre+nnqen59W7z3xn5o/mG+WP
AZqmgiBc/vj9/0/+qvGav2xpVLrXFsIv6JOLG23PToqF27J/2wp/hR4HO2K/
DXZie+2AZeyrO+Hu7JW74J7s0ATYmS1PgnvTSU/P4YUXDXBfdvVu+Fu2azLs
xl65F3Znl+2DB7DlKfBAduWf8CB29AHYgz3uIDyY3eYwPAT7v+ChZEpMdHpZ
nQ4PY78+Ag9nNxyFR7A7HINHsodmwKPYykzYk709Cx7Nvnsc9mJ3OwkTO+oU
W4LzT6N/xx5yFh1OOYc+hub6+X25MMaIzrYEnkcfy71LNjrb8gwWvLmfuIDO
tkTnoI/jHnkRnW3xzUUfz33AJXS2pctl9AncW+ahsy0NsODDve4KOttSexV9
InfrNXS2pdkN9EncHfLRJ1FWioud1eEmuu8nn0qAJba13z/ok7mfhiW21e8W
+hTuZbDEti4vQP+eu+NtdLY1Axb8uAfdQWdba2FhKvf4u2xiW8few9+jV8JG
9J2F2Ptz97mPPdtaB0voh4qwR1cVYx/A3ekB9mzrPVhCjzNhjx70EPtAvP5H
2LOtJlgKpAcFsatNAWbs2bYsWJj2yeFdS7Bn29bAEttUBRvRZ5RiH8T7HJjY
NvfH2LNNibARvfUT7KfzfgVMbFs1LLFNyjLs0e/Cwg+8n/wUe7YtG5bYphHP
sEf/GxZm8N7tOfZsWyossU3O5dij74WFYN73fIF9MDosBWNfgT16KiyE4P5L
7EPw/GApBM+/Env0bFgIxeuvwj4U7w8sheL9q8YevRoWwqiqPO+8m1cN9uz6
tbDEnpsPG8OopOHss0VfvMI+nArfJvt07A9TOOWXr0/NnAZL4ZT7cE6L6Uth
YzidKQiIfJfUuI+gY5eHXtt6sXEfQWlnnFw9Khr3EbT7aJNNBW1fYx9BO1Ke
VkUNgQU5Rcdf9WsXBpOc1sakpx9ZBUtyWr42zsE/pXEv//T5WXOtcS9S5E/y
gujXsEwkpcbbo7/jGzyeSMEhfeJueMKiSFM//vubo4IlkSZ4v5neegNsEOnj
p13WwcOwUSQPtzOOk2/DZpH69dizpKIOFhTU3XFd0cZub3FfQZ1azx7ZdxxM
Cmrb1D8+bxYsKsiudrBNvxmWFFRf0TnCPhM2KOidueFsSjFsVNDLO0+6TWjy
DvcVVHolT3rqDAtKun/ucMmaybBMSTePxY7pFQWTki6lLk7O2Q6LSjqbGN5c
fQaWlJQRO0bT7DFsUNLB9S65e+wtuK+k5OWtXMa4wWYl/RH1al1JICyoKEZ3
97m0BJapaH3YqYmyJJhUtMLfcOBcDiyqaMH4NS3lL2BJRbNHzppd36YW91Wk
cve7njAYNqoopJeHm2cobFaRf+dO0Q8kWFCTT5v66mX7YZmavJo/ntrlGkxq
GlJ36cjJV7CoJteqg+1COv6L+2rq+Tjm57pRsEFNnQsX3t6hhI1qcrgeOnjY
etisJvts2nbvECxoqCGzV+3CAlimIUtaixkd6mDSUKWh+nhG1zrc19CTuNud
grxhSUPFG08sfTsTNmjo1srE4tho2KihvPmrRw3KgM0aMs7UJ9wqggUtZUZM
qZ8nvMd9LR0KHCh3cIZJS3t9OhrTfWFRS7s8P8imzoMlLW0ZWLKqehts0NIG
l9zSTadho5Ykp7SxbqWwWUuLHDbvvW5nxX0dzf18wWdzXGGZjjTWYG2rQJh0
FFoz+lLaYljUUUBZj96+ibCko4lF9hteXIANOqL8yvIN5bBRR0Nzbk3q0+YD
7uvI7URW2mUPWNBTr8PxrfQhsExPTsmr5thJMOmp/Q7tjf37YFFPLX737T/+
Kizpqckv7pvLamCDnmoXfv3q1w423NdTVeR7/56jYLOeysRHRy8oYGEmPQjK
aa9aZ6P/AEgDEbA=
"]]}, {}},
AspectRatio->NCache[GoldenRatio^(-1), 0.6180339887498948],
Axes->True,
AxesLabel->{None, None},
AxesOrigin->{0, 0},
Method->{},
PlotRange->{{0, 200.}, {0, 120950.19232591189`}},
PlotRangeClipping->True,
PlotRangePadding->{{4., 4.}, {2419.003846518238,
2419.003846518238}}]], "Output",
CellChangeTimes->{
3.8763864308388166`*^9, 3.876386751300392*^9, 3.8763888748586206`*^9,
3.876545897521863*^9, 3.876546877708362*^9, 3.876547012149145*^9,
3.876556256565036*^9, 3.876556718045046*^9, 3.876560112371064*^9,
3.876560171945764*^9, 3.876560948926437*^9, {3.876565089283977*^9,
3.876565142052981*^9}, 3.876572676253577*^9, 3.8769972614114237`*^9}]
}, Open ]],
Cell[BoxData[""], "Input",
CellChangeTimes->{{3.87638637542977*^9, 3.8763863858549757`*^9}}]
}, Open ]]
}, Closed]],
Cell[CellGroupData[{
Cell["Based on the univariate strategy", "Section",
CellChangeTimes->{{3.876385540206491*^9, 3.8763855496770477`*^9}, {
3.8763859504295197`*^9, 3.876385954050096*^9}}],
Cell[CellGroupData[{
Cell["small number of columns", "Subsection",
CellChangeTimes->{{3.87657262920255*^9, 3.8765726324865093`*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"arithComp", " ", "=", " ",
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{"2",
RowBox[{"(",
RowBox[{"M", "+", "1"}], ")"}]}], "+", "3"}], ",", "2", ",", "1"}],
"}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"costsumcheckUV", " ", "=", " ",
RowBox[{
RowBox[{
RowBox[{"sumcheck", "[",
RowBox[{"n", ",", " ",
RowBox[{"M", "+", "3"}], ",", " ",
RowBox[{
RowBox[{"2", "M"}], "+", "6"}], ",", " ", "arithComp"}], "]"}], "/",
RowBox[{"(",
RowBox[{"1", " ", "-", " ",
RowBox[{"1", "/",
RowBox[{"2", "^", "n"}]}]}], ")"}]}], "//",
"Simplify"}]}], "\[IndentingNewLine]",
RowBox[{"costUV", " ", "=", " ",
RowBox[{
RowBox[{"costsumcheckUV", "+", " ",
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{"2",
RowBox[{"(",
RowBox[{"M", "+", "1"}], ")"}]}], "+",
RowBox[{"(",
RowBox[{
RowBox[{"2", "M"}], "+", "4"}], ")"}], "+", "2"}], ",", " ", "0",
",", " ",
RowBox[{
RowBox[{"3", "M"}], "+", "5"}]}], "}"}]}], "//",
"Simplify"}]}]}], "Code",
CellChangeTimes->{{3.8750909259659147`*^9, 3.8750909755423727`*^9}, {
3.875091011817265*^9, 3.875091011971953*^9}, {3.875091761347869*^9,
3.8750917685033712`*^9}, {3.875095922978674*^9, 3.875095924237027*^9}, {
3.875102731687755*^9, 3.875102732249934*^9}, {3.8751027766648827`*^9,
3.8751027771588306`*^9}, {3.8751035450282717`*^9, 3.875103545106289*^9}, {
3.875103575541709*^9, 3.875103575695881*^9}, {3.87544903570872*^9,
3.875449051990718*^9}, {3.875459791604109*^9, 3.875459793447543*^9}, {
3.875460098494342*^9, 3.875460146550344*^9}, 3.8754622749212112`*^9, {
3.8754623550682497`*^9, 3.875462355922514*^9}, {3.8754628105165787`*^9,
3.8754628283143*^9}, {3.875462860582975*^9, 3.875462874171104*^9}, {
3.8754629739336987`*^9, 3.8754629980591993`*^9}, {3.875464304445507*^9,
3.8754643097529507`*^9}, {3.875464374646179*^9, 3.875464379549264*^9}, {
3.875464667348877*^9, 3.875464667406427*^9}, {3.875464789979189*^9,
3.87546480291568*^9}, {3.875464900566935*^9, 3.875464925993936*^9}, {
3.8754665630601683`*^9, 3.875466563364303*^9}, {3.875603537872497*^9,
3.875603540199489*^9}, {3.87560358270327*^9, 3.875603659183642*^9}, {
3.875604134438981*^9, 3.875604134819813*^9}, 3.875604513449641*^9, {
3.8757017826018*^9, 3.87570182248929*^9}, {3.876295114711844*^9,
3.876295115023265*^9}, {3.876385582696113*^9, 3.876385587334529*^9}, {
3.8763857218627453`*^9, 3.8763857221737823`*^9}, {3.8763859659634027`*^9,
3.8763860077477903`*^9}, {3.876572531010734*^9, 3.876572583060375*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"38", "+",
RowBox[{"25", " ", "M"}], "+",
RowBox[{"4", " ",
SuperscriptBox["M", "2"]}]}], ",",
RowBox[{"20", "+",
RowBox[{"6", " ", "M"}]}], ",",
RowBox[{"2", " ",
RowBox[{"(",
RowBox[{"13", "+",
RowBox[{"7", " ", "M"}], "+",
SuperscriptBox["M", "2"]}], ")"}]}]}], "}"}]], "Output",
CellChangeTimes->{{3.876385715009602*^9, 3.876385722596904*^9},
3.876386008897937*^9, 3.876386751315452*^9, 3.8763888748686457`*^9,
3.876545897538424*^9, 3.876546877718638*^9, 3.876547012161355*^9,
3.876556256580185*^9, 3.876556718056282*^9, 3.876560112393311*^9,
3.8765601719581823`*^9, 3.8765609489446907`*^9, {3.876565089295424*^9,
3.876565142063918*^9}, 3.876572584959175*^9, 3.876572676264659*^9,
3.876572738584547*^9, 3.8769972614221373`*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"46", "+",
RowBox[{"29", " ", "M"}], "+",
RowBox[{"4", " ",
SuperscriptBox["M", "2"]}]}], ",",
RowBox[{"20", "+",
RowBox[{"6", " ", "M"}]}], ",",
RowBox[{"31", "+",
RowBox[{"17", " ", "M"}], "+",
RowBox[{"2", " ",
SuperscriptBox["M", "2"]}]}]}], "}"}]], "Output",
CellChangeTimes->{{3.876385715009602*^9, 3.876385722596904*^9},
3.876386008897937*^9, 3.876386751315452*^9, 3.8763888748686457`*^9,
3.876545897538424*^9, 3.876546877718638*^9, 3.876547012161355*^9,
3.876556256580185*^9, 3.876556718056282*^9, 3.876560112393311*^9,
3.8765601719581823`*^9, 3.8765609489446907`*^9, {3.876565089295424*^9,
3.876565142063918*^9}, 3.876572584959175*^9, 3.876572676264659*^9,
3.876572738584547*^9, 3.8769972614236393`*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["large number of columns", "Subsection",
CellChangeTimes->{{3.876385600508483*^9, 3.876385604712728*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"arithComp", " ", "=", " ",
RowBox[{"{",
RowBox[{"5", ",", "2", ",", "1"}], "}"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{"costsumcheckUVlarge", " ", "=", " ",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"M", "+", "1"}], ")"}], " ", "*", " ",
RowBox[{
RowBox[{"sumcheck", "[",
RowBox[{
RowBox[{"n", "+", "m"}], ",", " ", "3", ",", " ", "6", ",", " ",
"arithComp"}], "]"}], "/",
RowBox[{"(",
RowBox[{"1", " ", "-", " ",
RowBox[{"1", "/",
RowBox[{"2", "^",
RowBox[{"(",
RowBox[{"n", "+", "m"}], ")"}]}]}]}], ")"}]}]}], "//",
"Simplify"}]}], "\[IndentingNewLine]",
RowBox[{"costUVlarge", " ", "=", " ",
RowBox[{
RowBox[{"costsumcheckUVlarge", "+", " ",
RowBox[{
RowBox[{"(",
RowBox[{"M", "+", "1"}], ")"}],
RowBox[{"{",
RowBox[{"7", ",", " ", "0", ",", " ", "4"}], "}"}]}]}], "//",
"Simplify"}]}]}], "Code",
CellChangeTimes->{{3.8750909259659147`*^9, 3.8750909755423727`*^9}, {
3.875091011817265*^9, 3.875091011971953*^9}, {3.875091761347869*^9,
3.8750917685033712`*^9}, {3.875095922978674*^9, 3.875095924237027*^9}, {
3.875102731687755*^9, 3.875102732249934*^9}, {3.8751027766648827`*^9,
3.8751027771588306`*^9}, {3.8751035450282717`*^9, 3.875103545106289*^9}, {
3.875103575541709*^9, 3.875103575695881*^9}, {3.87544903570872*^9,
3.875449051990718*^9}, {3.875459791604109*^9, 3.875459793447543*^9}, {
3.875460098494342*^9, 3.875460146550344*^9}, 3.8754622749212112`*^9, {
3.8754623550682497`*^9, 3.875462355922514*^9}, {3.8754628105165787`*^9,
3.8754628283143*^9}, {3.875462860582975*^9, 3.875462874171104*^9}, {
3.8754629739336987`*^9, 3.8754629980591993`*^9}, {3.875464304445507*^9,
3.8754643097529507`*^9}, {3.875464374646179*^9, 3.875464379549264*^9}, {
3.875464667348877*^9, 3.875464667406427*^9}, {3.875464789979189*^9,
3.87546480291568*^9}, {3.875464900566935*^9, 3.875464925993936*^9}, {
3.8754665630601683`*^9, 3.875466563364303*^9}, {3.875603537872497*^9,
3.875603540199489*^9}, {3.87560358270327*^9, 3.875603659183642*^9}, {
3.875604134438981*^9, 3.875604134819813*^9}, 3.875604513449641*^9, {
3.8757017826018*^9, 3.87570182248929*^9}, {3.876294935922762*^9,
3.876294976871594*^9}, {3.8762950096121683`*^9, 3.87629504286515*^9}, {
3.876295088768346*^9, 3.876295091983234*^9}, {3.876295140653759*^9,
3.8762952201241207`*^9}, {3.8762954318300037`*^9, 3.876295438845056*^9}, {
3.876368111846792*^9, 3.876368114205063*^9}, {3.876385621768506*^9,
3.876385712184557*^9}, {3.8763859817375793`*^9, 3.87638599991722*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"38", " ",
RowBox[{"(",
RowBox[{"1", "+", "M"}], ")"}]}], ",",
RowBox[{"20", " ",
RowBox[{"(",
RowBox[{"1", "+", "M"}], ")"}]}], ",",
RowBox[{"26", " ",
RowBox[{"(",
RowBox[{"1", "+", "M"}], ")"}]}]}], "}"}]], "Output",
CellChangeTimes->{{3.876385715044609*^9, 3.876385715142146*^9},
3.876386016882557*^9, 3.876386751338686*^9, 3.876388874890017*^9,
3.876545897562159*^9, 3.876546877744257*^9, 3.876547012184167*^9,
3.87655625660221*^9, 3.876556718078918*^9, 3.8765601124171124`*^9,
3.876560171975246*^9, 3.8765609489653463`*^9, {3.876565089312255*^9,
3.876565142080762*^9}, 3.87657267628866*^9, 3.87699726147366*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"45", " ",
RowBox[{"(",
RowBox[{"1", "+", "M"}], ")"}]}], ",",
RowBox[{"20", " ",
RowBox[{"(",
RowBox[{"1", "+", "M"}], ")"}]}], ",",
RowBox[{"30", " ",
RowBox[{"(",
RowBox[{"1", "+", "M"}], ")"}]}]}], "}"}]], "Output",
CellChangeTimes->{{3.876385715044609*^9, 3.876385715142146*^9},
3.876386016882557*^9, 3.876386751338686*^9, 3.876388874890017*^9,
3.876545897562159*^9, 3.876546877744257*^9, 3.876547012184167*^9,
3.87655625660221*^9, 3.876556718078918*^9, 3.8765601124171124`*^9,
3.876560171975246*^9, 3.8765609489653463`*^9, {3.876565089312255*^9,
3.876565142080762*^9}, 3.87657267628866*^9, 3.8769972614750357`*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["break even point", "Subsection",
CellChangeTimes->{{3.876385748469411*^9, 3.876385752247199*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{"costWithCommUV", " ", "=", " ",
RowBox[{"costUV", " ", "+", " ",
RowBox[{"costPippengerPerScalar", " ", "*", " ",
RowBox[{"(",
RowBox[{"M", "+", "2"}], ")"}]}]}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"costWithCommUVlarge", " ", "=", " ",
RowBox[{"costUVlarge", " ", "+", " ",
RowBox[{"costPippengerPerScalar", " ", "*", " ", "2", "*",
RowBox[{"(",
RowBox[{"M", "+", "1"}], ")"}]}]}]}], "\n", "\n",
RowBox[{"(*", " ",
RowBox[{
"break", " ", "even", " ", "point", " ", "with", " ", "linear", " ",
"strategy"}], " ", "*)"}]}], "\n",
RowBox[{"sol", " ", "=", " ",
RowBox[{"NSolve", "[",
RowBox[{
RowBox[{
RowBox[{"costWithCommUV", "[",
RowBox[{"[", "1", "]"}], "]"}], " ", "\[Equal]", " ",
RowBox[{"costWithCommUVlarge", "[",
RowBox[{"[", "1", "]"}], "]"}]}], ",", "M"}], "]"}]}], "\n",
RowBox[{
RowBox[{"breakEvenUV", " ", "=", " ",
RowBox[{
RowBox[{
RowBox[{"M", " ", "/.", " ", "sol"}], " ", "//", " ", "Last"}], "//",
"Floor"}]}], "\n", "\n",
RowBox[{"(*", " ",
RowBox[{"maximum", " ", "speedup"}], " ", "*)"}]}], "\n",
RowBox[{
RowBox[{"ratio", " ", "=", " ",
RowBox[{"Table", "[",
RowBox[{