Changeset 1abcec9b
- Timestamp:
- Apr 13, 2026, 3:05:44 AM (2 weeks ago)
- Branches:
- master
- Children:
- 5b21636b
- Parents:
- 2581f1e
- Files:
-
- 12 edited
-
doc/theses/mike_brooks_MMath/Makefile (modified) (1 diff)
-
doc/theses/mike_brooks_MMath/list.tex (modified) (5 diffs)
-
doc/theses/mike_brooks_MMath/plots/ListCommon.py (modified) (6 diffs)
-
doc/theses/mike_brooks_MMath/plots/list-1ord.d (modified) (1 diff)
-
doc/theses/mike_brooks_MMath/plots/list-1ord.gp (modified) (4 diffs)
-
doc/theses/mike_brooks_MMath/plots/list-1ord.py (modified) (4 diffs)
-
doc/theses/mike_brooks_MMath/plots/list-2ord.d (modified) (1 diff)
-
doc/theses/mike_brooks_MMath/plots/list-2ord.gp (modified) (5 diffs)
-
doc/theses/mike_brooks_MMath/plots/list-2ord.py (modified) (7 diffs)
-
libcfa/src/collections/array.hfa (modified) (2 diffs)
-
libcfa/src/collections/string.cfa (modified) (1 diff)
-
tests/collections/string-overwrite.cfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/mike_brooks_MMath/Makefile
r2581f1e r1abcec9b 100 100 -include $(Plots)/*.d 101 101 102 ${Build}/plot-%.sum.dat ${Build}/plot-%.det.dat: ${Plots}/%.py ${Plots}/common.py ${Plots}/ListCommon.py ${Plots}/%.py.INPUTS | ${Build} 103 python3 $< ${Build}/plot-$*.sum.dat ${Build}/plot-$*.det.dat 104 105 ${Build}/plot-%.dat: ${Plots}/%.py ${Plots}/common.py ${Plots}/ListCommon.py ${Plots}/%.py.INPUTS | ${Build} 106 python3 $< > $@ 107 102 108 ${Build}/plot-%.dat: ${Plots}/%.py ${Plots}/common.py ${Plots}/ListCommon.py ${Plots}/%.py.INPUTS | ${Build} 103 109 python3 $< > $@ -
doc/theses/mike_brooks_MMath/list.tex
r2581f1e r1abcec9b 1034 1034 \includegraphics{plot-list-1ord.pdf} 1035 1035 \caption{Histogram of operation durations, decomposed by all first-order effects. 1036 Each of the three breakdowns divides the entire population of test results into its mutually disjoint constituents. 1037 \MLB{missing: overlay of means}} 1036 Each of the three breakdowns divides the entire population of test results into its mutually disjoint constituents.} 1038 1037 \label{fig:plot-list-1ord} 1039 1038 \end{figure} … … 1046 1045 1047 1046 A similar situation comes from \VRef[Figure]{fig:plot-list-1ord}'s second comparison, by operation type. 1048 Specific interactions like framework X doing better on stacks do occur; a selection of them is addressed in \MLB{TODO: cross reference}.1047 Specific interactions do occur, like framework X doing better on stacks than on queues; a selection of these is addressed in \VRef[Figure]{fig:plot-list-2ord} and discussed shortly. 1049 1048 But they are so irrelevant to the issue of picking a winning framework that it is sufficient here to number the operations opaquely. 1050 1049 Whether a given list implementation is suitable for a language's general library succeeds or fails without knowledge of whether your use will have stack or queue movement. … … 1060 1059 As does a small size on the Intel typically beat a medium size on the AMD by 66\%. 1061 1060 Framework choice is simply not where you stand to win or lose the most. 1061 1062 \begin{figure} 1063 \centering 1064 \includegraphics{plot-list-2ord.pdf} 1065 \caption{Histogram of operation durations, illustrating interactions with framework. 1066 Each distribution shows how its framework reacts to a single other factor being varied across one pair of options. 1067 Every (binned and mean-contributing) individual data point represents a pair of test setups, one with the criterion set to the option labelled at the top; the other setup uses the bottom option. 1068 This point's y-axis score is the ratio of these setups' durations. 1069 The point lands in a bin closer to the label of the option that performs better. 1070 } 1071 \label{fig:plot-list-2ord} 1072 \end{figure} 1073 1074 \VRef[Figure]{fig:plot-list-1ord} stays razor-focused on only first-order effects in order to contextualize a winner/loser framework observation. 1075 But this perspective cannot address questions like, ``Where are \CFA's sore spots?'' 1076 Moreover, the shallow threatment of operations by ordinals said nothing about how stack usage compares with queues'. 1077 1078 \VRef[Figure]{fig:plot-list-2ord} provides such answers. 1079 Its size-zone criterion refines the obvious notion that a small size runs faster than a big size; this issue is by how much. 1080 Indeed, all means favour small and few tails favour medium. 1081 But the various frameworks do no respond to the different sizes and machines uniformly. 1082 On the AMD, \CFA and \uCpp have a modest size sensitivity, LQ-tailq's is moderate amd LQ-list seems unaffected. 1083 On the Intel, \CFA's increases to moderate, while \uCpp is now unaffected, and both LQs have a dramatic response. 1084 The Intel is more sensitive to size than the AMD. 1085 1086 Turning next to movement and polarity, the responses appear more subdued. 1087 Note that LQ-list has no represntation in these comparisons because it only supports stacks that push and pop with the first element. 1088 \CFA is completely stable under movement and polarity changes. 1089 \uCpp and LQ show modest responses favouring queues and insertion at last. 1090 1091 Finally, with accessor, a \CFA sore spot emerges. 1092 Note the pair of two-way comparisons pulled from the three experiment setups used. 1093 First, the all-head/insert-element opposition addresses which insertion style is better---by-head (top) and by-element (bottom). 1094 Then, the all-head/remove-element opposition addresses which removal style is better---by-head (top) and by-element (bottom). 1095 The LQs favour insertion by head and removal by element. 1096 \CFA and \uCpp favour both operations by head. 1097 The strongest effect is \CFA's aversion to removal by element---certainly an opportunity for improvement. 1098 1099 \begin{comment} 1100 These remarks are mostly about 3ord over 2ord. 1101 This analysis does not provide more detail about one framework beating another; it offers different benefits. 1102 These interactions further illustrate the lottery-ticket unpredictability that a linked-list user inevitably faces, by revealing stronger-still performance swings hidden from the first-order view. 1103 They illustrate the difficult signal-to-noise ratio that I had to overcome in preparing this data. 1104 They may serve as a reference guiding future \CFA linked-list work by informing on where to target improvements. 1105 Finally, the findings offer the conclusion that \CFA's list offers more consostent performance across usage scenarios, than the other lists. 1106 \end{comment} 1107 1108 \begin{comment} 1109 Further to the interpretation guidance of \VRef[Figure]{fig:plot-list-2ord}'s caption, a comparison with the construction of \VRef[Figure]{fig:plot-list-1ord} may be helpful. 1110 In the first-order graph, the factors being compared had many options: four, twelve and four. 1111 # XXX Each option contributes its own, seemingly independent, mean and distribution. 1112 # XXX But, in fact, they are not totally independent. 1113 # WRONG: it's not just about binary, you also need a split on a conditioned factor 1114 I'm trying to get to: 1115 Side by side in earlier style, but they're opposites, so they mirror each other, so you take option B, flip it over, and have option A---I'll just show A 1116 \end{comment} 1117 1118 1062 1119 1063 1120 \MLB{ TODO: find a home for these original conclusions: … … 1124 1181 \caption{Histogram of operation durations, decomposed by physical factors. 1125 1182 Measurements are included from only the sizes in the ``small'' and ``medium'' stable zones. 1126 This breakdown divides the entire population of test results into four mutually disjoint constituents.} 1183 This breakdown divides the entire population of test results into four mutually disjoint constituents. 1184 \MLB{I see that I broke it. But we might be getting rid of it.} 1185 } 1127 1186 \label{fig:plot-list-mchn-szz} 1128 1187 \end{figure} … … 1131 1190 Each of these four histograms shows variation in duration coming from the four specific sizes in a size zone, from combining results of all twelve operations and all four frameworks. 1132 1191 Among the means of the four histograms, there is a standard deviation of 0.9 ns, which is 20\% of the global mean. 1133 This variability is due solely to physi al factors.1192 This variability is due solely to physical factors. 1134 1193 1135 1194 From the perspective of assessing winning/losing frameworks, these physical effects are noise. -
doc/theses/mike_brooks_MMath/plots/ListCommon.py
r2581f1e r1abcec9b 3 3 import math 4 4 import os 5 import sys 5 6 from subprocess import Popen, PIPE 6 7 from scipy.stats import gmean … … 265 266 return metadata 266 267 268 def printSingleSummaryFrom( measure, dfgrouped, *, 269 file = sys.stdout, 270 index = True, 271 end = '\n' ) : 272 aggregated = dfgrouped[measure].agg([ 273 ("gmean", gmean), "std", "min", "max", "count", 274 lambda x: x.quantile(0.025), 275 lambda x: x.quantile(0.16), 276 lambda x: x.quantile(0.5), 277 lambda x: x.quantile(0.84), 278 lambda x: x.quantile(0.975) 279 ]) 280 text = aggregated.to_csv(header=False, index=index, sep='\t') 281 print(text, file=file, end=end) 282 283 267 284 swiftSweetspot = (lambda x: x > 16 and x < 150) 268 285 # swiftSweetspot = (lambda x: x > 4 and x < 32) … … 303 320 304 321 grouped = timings.groupby(['op_num', 'fx_num', 'fx']) 305 306 aggregated = grouped[measure].agg( 307 ["mean", "std", "min", "max", "count", 308 lambda x: x.quantile(0.025), 309 lambda x: x.quantile(0.16), 310 lambda x: x.quantile(0.5), 311 lambda x: x.quantile(0.84), 312 lambda x: x.quantile(0.975)] 313 ) 314 315 text = aggregated.to_csv(header=False, index=True, sep='\t') 316 print(text, end='') 322 printSingleSummaryFrom( measure, grouped, end ='' ) 323 317 324 318 325 def printSingleDetail( … … 426 433 lateFilter = {}, # exclude from output 427 434 drillOn = ['fx'], 428 marginalizeOn = None ): # None means match drill-on 435 marginalizeOn = None, # None means match drill-on 436 sumFile = sys.stdout, 437 detFile = sys.stdout ): 429 438 430 439 if marginalizeOn == None: … … 478 487 # print(mgroup, file=sys.stderr) 479 488 489 dkey_str = list( map( str, dkey ) ) 490 header = str.join(', ', dkey_str) 491 492 dgroup_sole = dgroup.groupby((lambda _: 0)) 493 print(f'"{header}"', file=sumFile) 494 printSingleSummaryFrom( 495 c_measure, dgroup_sole, file=sumFile, index=False ) 496 print(file=sumFile) 497 print(file=sumFile) 498 480 499 histo_raw = dgroup[ c_measureBkt ].value_counts() 481 500 for b in buckets: … … 490 509 histo.insert(y_lo_col_loc + 1, "y_hi", histo["y_lo"].apply(topValOfBucketBotVal)) 491 510 492 dkey_str = list( map( str, dkey ) ) 493 header = str.join(', ', dkey_str) 494 print(f'"{header}"') 511 print(f'"{header}"', file=detFile) 495 512 text = histo.to_csv(header=False, index=False, sep='\t') 496 print(text )497 print( )498 print( )513 print(text, file=detFile) 514 print(file=detFile) 515 print(file=detFile) 499 516 500 517 # print(f'"{header}" FULL') -
doc/theses/mike_brooks_MMath/plots/list-1ord.d
r2581f1e r1abcec9b 1 plots/list-1ord.gp.INPUTS: build/plot-list-1ord. dat | build1 plots/list-1ord.gp.INPUTS: build/plot-list-1ord.sum.dat build/plot-list-1ord.det.dat | build 2 2 plots/list-1ord.py.INPUTS: benchmarks/list/results-swift-general.csv -
doc/theses/mike_brooks_MMath/plots/list-1ord.gp
r2581f1e r1abcec9b 15 15 set grid 16 16 set nokey 17 set logscale y 2 18 set yrange [0.4:3.0]; 19 set ytics ( \ 20 "+40%%" 1.666666667, \ 21 "+30%%" 1.428571429, \ 22 "+20%%" 1.25, \ 23 "+10%%" 1.111111111, \ 24 "0" 1, \ 25 "-20%%" 0.833333333, \ 26 "-40%%" 0.714285714, \ 27 "-60%%" 0.625, \ 28 "-80%%" 0.555555556, \ 29 "-100%%" 0.5, \ 30 "-130%%" 0.434782609, \ 31 "-160%%" 0.384615385, \ 32 "-200%%" 0.333333333 \ 33 ) 17 18 set ylabel "Duration (relative)" offset -1.0,0 19 set logscale y (2**0.2) 20 set yrange [0.38:2.5]; 21 set format y "%.1f {/Symbol \264}" 22 set ytics (0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.4) 23 24 # Draw fake x axis at y=1.0; use vertical-only bounding 'H' 25 unset border 26 set arrow from graph 0, first 1 to graph 1, first 1 nohead lt -1 lw 2 27 set arrow 100 from graph 0, graph 0 to graph 0, graph 1 nohead lw 1 front 28 set arrow 101 from graph 1, graph 0 to graph 1, graph 1 nohead lw 1 front 29 34 30 set xrange [-5.5:17.5]; 35 31 set xlabel "Machine, Size Zone; Operation; Framework; \nPrevalence Prevalence Prevalence" … … 57 53 "LQ: tailq" 15, \ 58 54 "LQ: list" 16, \ 59 ) rotate by -45 60 61 set ylabel "Duration (relative)" offset -1.0,0 62 set errorbars 2.0 63 set pointintervalbox 0 55 ) scale 0 rotate by -45 64 56 65 57 barHtScale_phys = 0.05 … … 67 59 barHtScale_fx = 0.05 68 60 61 set errorbars 0 linewidth 4 62 set pointintervalbox 0 69 63 70 plot INDIR."/plot-list-1ord.dat" \ 64 65 plot INDIR."/plot-list-1ord.det.dat" \ 71 66 i 3 using (0):(0):(-1 - 1):(-1 - 1 + barHtScale_phys * $3):1:2 title columnheader(1) with boxxyerror fc rgb "black" fs transparent solid 0.15 noborder, \ 72 67 '' i 2 using (0):(0):(-1 - 2):(-1 - 2 + barHtScale_phys * $3):1:2 title columnheader(1) with boxxyerror fc rgb "black" fs transparent solid 0.15 noborder, \ … … 110 105 '' i 19 using (1 + 13 + barHtScale_fx * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 111 106 '' i 18 using (1 + 14 + barHtScale_fx * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 112 '' i 17 using (1 + 15 + 3.5 * barHtScale_fx * $3):2 notitle with steps lc rgb "purple" lw 0.3 113 107 '' i 17 using (1 + 15 + 3.5 * barHtScale_fx * $3):2 notitle with steps lc rgb "purple" lw 0.3, \ 108 \ 109 INDIR."/plot-list-1ord.sum.dat" \ 110 i 3 using (-1 - 1):1:(-1 - 1):(-1 - 1 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 111 '' i 2 using (-1 - 2):1:(-1 - 2):(-1 - 2 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 112 '' i 1 using (-1 - 3):1:(-1 - 3):(-1 - 3 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 113 '' i 0 using (-1 - 4):1:(-1 - 4):(-1 - 4 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 114 \ 115 '' i 10 using ( 0):1:( 0):( 0 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 116 '' i 11 using ( 1):1:( 1):( 1 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 117 '' i 12 using ( 2):1:( 2):( 2 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 118 '' i 13 using ( 3):1:( 3):( 3 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 119 '' i 14 using ( 4):1:( 4):( 4 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 120 '' i 15 using ( 5):1:( 5):( 5 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 121 '' i 4 using ( 6):1:( 6):( 6 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 122 '' i 5 using ( 7):1:( 7):( 7 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 123 '' i 6 using ( 8):1:( 8):( 8 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 124 '' i 7 using ( 9):1:( 9):( 9 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 125 '' i 8 using ( 10):1:( 10):( 10 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 126 '' i 9 using ( 11):1:( 11):( 11 + .8) notitle with xerrorbars lc rgb "black" pt 5 ps 0.8, \ 127 \ 128 '' i 16 using (1 + 12):1:(1 + 12):(1 + 12 + .8) notitle with xerrorbars lc rgb "blue" pt 7 ps 1.0, \ 129 '' i 19 using (1 + 13):1:(1 + 13):(1 + 13 + .8) notitle with xerrorbars lc rgb "dark-orange" pt 9 ps 1.2, \ 130 '' i 18 using (1 + 14):1:(1 + 14):(1 + 14 + .8) notitle with xerrorbars lc rgb "magenta" pt 11 ps 1.2, \ 131 '' i 17 using (1 + 15):1:(1 + 15):(1 + 15 + .8) notitle with xerrorbars lc rgb "dark-violet" pt 13 ps 1.4 -
doc/theses/mike_brooks_MMath/plots/list-1ord.py
r2581f1e r1abcec9b 6 6 sys.path.insert(0, os.path.dirname(__file__)) 7 7 from ListCommon import * 8 9 sumFile = open( sys.argv[1], 'w' ) 10 detFile = open( sys.argv[2], 'w' ) 8 11 9 12 physicals = ['machine', 'SizeZone'] … … 21 24 tgtPolarity = 'all', 22 25 tgtAccessor = 'all', 23 drillOn=physicals ) 26 drillOn=physicals, 27 sumFile = sumFile, 28 detFile = detFile ) 24 29 25 30 printHistos( … … 27 32 tgtPolarity = 'all', 28 33 tgtAccessor = 'all', 29 drillOn=ops ) 34 drillOn=ops, 35 sumFile = sumFile, 36 detFile = detFile ) 30 37 31 38 printHistos( … … 33 40 tgtPolarity = 'all', 34 41 tgtAccessor = 'all', 35 drillOn=fx ) 42 drillOn=fx, 43 sumFile = sumFile, 44 detFile = detFile ) -
doc/theses/mike_brooks_MMath/plots/list-2ord.d
r2581f1e r1abcec9b 1 plots/list-2ord.gp.INPUTS: build/plot-list-2ord. dat | build1 plots/list-2ord.gp.INPUTS: build/plot-list-2ord.sum.dat build/plot-list-2ord.det.dat | build 2 2 plots/list-2ord.py.INPUTS: benchmarks/list/results-swift-general.csv -
doc/theses/mike_brooks_MMath/plots/list-2ord.gp
r2581f1e r1abcec9b 12 12 set lmargin 10 13 13 set bmargin 5 14 set tmargin 214 set tmargin 3.5 15 15 16 16 set grid 17 set nokey18 17 19 18 set logscale y (2**0.2) 20 set yrange [0. 57:1.65];21 set format y "%. 2f {/Symbol \264}"19 set yrange [0.65:1.65]; 20 set format y "%.1f {/Symbol \264}" 22 21 set ytics (0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6) 23 22 set ylabel "Speedup, bot. opt. {/Symbol \256} top opt." offset -0.5,0 … … 30 29 31 30 set xrange [-0.7:27.5]; 32 set xlabel "Criterion; top / bot.Options; Prevalence" offset 0,-1.531 set xlabel "Criterion; top-bottom Options; Prevalence" offset 0,-1.5 33 32 set format x "" 34 33 set xtics ( \ … … 42 41 43 42 set label "small" at first 1.5, graph 1.05 center 44 set label "(AMD)" at first 1.5, graph 0.06 center font "Times-Bold,18" 43 set label "(AMD)" at first 1.5, graph 0.06 center font "Times-Bold,18" front 45 44 set label "medium" at first 1.5, graph -0.05 center 46 45 set label "small" at first 6.5, graph 1.05 center 47 set label "(Intel)" at first 6.5, graph 0.06 center font "Times-Bold,18" 46 set label "(Intel)" at first 6.5, graph 0.06 center font "Times-Bold,18" front 48 47 set label "medium" at first 6.5, graph -0.05 center 49 48 set label "Size Zone" at first 4 , graph -0.14 center … … 60 59 set label "ins. elem." at first 19.5, graph -0.05 center 61 60 set label "all head" at first 24.5, graph 1.05 center 62 set label "rem. elem " at first 24.5, graph -0.05 center61 set label "rem. elem." at first 24.5, graph -0.05 center 63 62 set label "Accessor" at first 22 , graph -0.14 center 64 63 … … 84 83 set arrow 21+.4 from 26+.4, graph -0.10 to 26+.4, graph -0.08 nohead lw 1 85 84 85 # legend, augmented 86 set key outside top center horizontal maxrows 1 samplen 2 width +1 # offset -10,0 87 set object 2 rect from first 3.20, screen 0.93 to first 4.85, screen 0.99 fc rgb "blue" fs transparent solid 0.20 border lc rgb "blue" lw 0.3 88 set object 3 rect from first 8.80, screen 0.93 to first 10.45, screen 0.99 fc rgb "dark-orange" fs transparent solid 0.25 border lc rgb "dark-orange" lw 0.3 89 set object 4 rect from first 14.40, screen 0.93 to first 16.05, screen 0.99 fc rgb "magenta" fs transparent solid 0.20 border lc rgb "magenta" lw 0.3 90 set object 5 rect from first 19.98, screen 0.93 to first 21.63, screen 0.99 fc rgb "dark-violet" fs transparent solid 0.25 border lc rgb "dark-violet" lw 0.3 91 # word "mean" is title of a data series plotted froom $Singleton 92 set arrow 99 from first 20.8, screen 0.96 to first 23, screen 0.96 nohead lw 1 dt 2 93 86 94 set errorbars 2.0 87 95 set pointintervalbox 0 88 96 89 barHtScale_phys = 0.05 90 barHtScale_op = 0.1 91 barHtScale_fx = 0.05 92 93 94 plot INDIR."/plot-list-2ord.dat" \ 95 i ( 0 + 0) using (0):(0):( 0 + 0):( 0 + 0 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "blue" fs transparent solid 0.15 noborder, \ 96 '' i ( 0 + 3) using (0):(0):( 0 + 1):( 0 + 1 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "dark-orange" fs transparent solid 0.15 noborder, \ 97 '' i ( 0 + 2) using (0):(0):( 0 + 2):( 0 + 2 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "magenta" fs transparent solid 0.15 noborder, \ 98 '' i ( 0 + 1) using (0):(0):( 0 + 3):( 0 + 3 + 3.5 * barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "purple" fs transparent solid 0.35 noborder, \ 99 '' i ( 0 + 0) using ( 0 + 0 + barHtScale_fx * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 100 '' i ( 0 + 3) using ( 0 + 1 + barHtScale_fx * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 101 '' i ( 0 + 2) using ( 0 + 2 + barHtScale_fx * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 102 '' i ( 0 + 1) using ( 0 + 3 + 3.5 * barHtScale_fx * $3):2 notitle with steps lc rgb "purple" lw 0.3, \ 103 \ 104 '' i ( 4 + 0) using (0):(0):( 5 + 0):( 5 + 0 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "blue" fs transparent solid 0.15 noborder, \ 105 '' i ( 4 + 3) using (0):(0):( 5 + 1):( 5 + 1 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "dark-orange" fs transparent solid 0.15 noborder, \ 106 '' i ( 4 + 2) using (0):(0):( 5 + 2):( 5 + 2 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "magenta" fs transparent solid 0.15 noborder, \ 107 '' i ( 4 + 1) using (0):(0):( 5 + 3):( 5 + 3 + 3.5 * barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "purple" fs transparent solid 0.35 noborder, \ 108 '' i ( 4 + 0) using ( 5 + 0 + barHtScale_fx * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 109 '' i ( 4 + 3) using ( 5 + 1 + barHtScale_fx * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 110 '' i ( 4 + 2) using ( 5 + 2 + barHtScale_fx * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 111 '' i ( 4 + 1) using ( 5 + 3 + 3.5 * barHtScale_fx * $3):2 notitle with steps lc rgb "purple" lw 0.3, \ 112 \ 113 '' i ( 8 + 0) using (0):(0):(10 + 0):(10 + 0 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "blue" fs transparent solid 0.15 noborder, \ 114 '' i ( 8 + 2) using (0):(0):(10 + 1):(10 + 1 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "dark-orange" fs transparent solid 0.15 noborder, \ 115 '' i ( 8 + 1) using (0):(0):(10 + 2):(10 + 2 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "magenta" fs transparent solid 0.15 noborder, \ 116 '' i ( 8 + 0) using (10 + 0 + barHtScale_fx * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 117 '' i ( 8 + 2) using (10 + 1 + barHtScale_fx * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 118 '' i ( 8 + 1) using (10 + 2 + barHtScale_fx * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 119 \ 120 '' i (11 + 0) using (0):(0):(14 + 0):(14 + 0 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "blue" fs transparent solid 0.15 noborder, \ 121 '' i (11 + 2) using (0):(0):(14 + 1):(14 + 1 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "dark-orange" fs transparent solid 0.15 noborder, \ 122 '' i (11 + 1) using (0):(0):(14 + 2):(14 + 2 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "magenta" fs transparent solid 0.15 noborder, \ 123 '' i (11 + 0) using (14 + 0 + barHtScale_fx * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 124 '' i (11 + 2) using (14 + 1 + barHtScale_fx * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 125 '' i (11 + 1) using (14 + 2 + barHtScale_fx * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 126 \ 127 '' i (14 + 0) using (0):(0):(18 + 0):(18 + 0 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "blue" fs transparent solid 0.15 noborder, \ 128 '' i (14 + 3) using (0):(0):(18 + 1):(18 + 1 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "dark-orange" fs transparent solid 0.15 noborder, \ 129 '' i (14 + 2) using (0):(0):(18 + 2):(18 + 2 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "magenta" fs transparent solid 0.15 noborder, \ 130 '' i (14 + 1) using (0):(0):(18 + 3):(18 + 3 + 3.5 * barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "purple" fs transparent solid 0.35 noborder, \ 131 '' i (14 + 0) using (18 + 0 + barHtScale_fx * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 132 '' i (14 + 3) using (18 + 1 + barHtScale_fx * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 133 '' i (14 + 2) using (18 + 2 + barHtScale_fx * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 134 '' i (14 + 1) using (18 + 3 + 3.5 * barHtScale_fx * $3):2 notitle with steps lc rgb "purple" lw 0.3, \ 135 \ 136 '' i (18 + 0) using (0):(0):(23 + 0):(23 + 0 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "blue" fs transparent solid 0.15 noborder, \ 137 '' i (18 + 3) using (0):(0):(23 + 1):(23 + 1 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "dark-orange" fs transparent solid 0.15 noborder, \ 138 '' i (18 + 2) using (0):(0):(23 + 2):(23 + 2 + barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "magenta" fs transparent solid 0.15 noborder, \ 139 '' i (18 + 1) using (0):(0):(23 + 3):(23 + 3 + 3.5 * barHtScale_fx * $3):1:2 title columnheader(1) with boxxyerror fc rgb "purple" fs transparent solid 0.35 noborder, \ 140 '' i (18 + 0) using (23 + 0 + barHtScale_fx * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 141 '' i (18 + 3) using (23 + 1 + barHtScale_fx * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 142 '' i (18 + 2) using (23 + 2 + barHtScale_fx * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 143 '' i (18 + 1) using (23 + 3 + 3.5 * barHtScale_fx * $3):2 notitle with steps lc rgb "purple" lw 0.3 97 # One row, to plot one-off points 98 $Singleton <<EOD 99 0 100 EOD 101 102 103 104 105 # show colornames 106 # blue #0000ff = 0 0 255 107 # dark-orange #c04000 = 192 64 0 108 # magenta #ff00ff = 255 0 255 109 # purple #c080ff = 192 128 255 110 111 112 113 114 115 set errorbars 0 linewidth 4 116 117 118 barHtScale = 0.048 119 120 plot \ 121 INDIR."/plot-list-2ord.det.dat" \ 122 i ( 0 + 0) using (0):(0):( 0 + 0):( 0 + 0 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "blue" fs transparent solid 0.20 noborder, \ 123 '' i ( 0 + 3) using (0):(0):( 0 + 1):( 0 + 1 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "dark-orange" fs transparent solid 0.25 noborder, \ 124 '' i ( 0 + 2) using (0):(0):( 0 + 2):( 0 + 2 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "magenta" fs transparent solid 0.20 noborder, \ 125 '' i ( 0 + 1) using (0):(0):( 0 + 3):( 0 + 3 + 3.5 * barHtScale * $3):1:2 notitle with boxxyerror fc rgb "dark-violet" fs transparent solid 0.25 noborder, \ 126 '' i ( 0 + 0) using ( 0 + 0 + barHtScale * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 127 '' i ( 0 + 3) using ( 0 + 1 + barHtScale * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 128 '' i ( 0 + 2) using ( 0 + 2 + barHtScale * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 129 '' i ( 0 + 1) using ( 0 + 3 + 3.5 * barHtScale * $3):2 notitle with steps lc rgb "dark-violet" lw 0.3, \ 130 \ 131 '' i ( 4 + 0) using (0):(0):( 5 + 0):( 5 + 0 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "blue" fs transparent solid 0.20 noborder, \ 132 '' i ( 4 + 3) using (0):(0):( 5 + 1):( 5 + 1 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "dark-orange" fs transparent solid 0.25 noborder, \ 133 '' i ( 4 + 2) using (0):(0):( 5 + 2):( 5 + 2 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "magenta" fs transparent solid 0.20 noborder, \ 134 '' i ( 4 + 1) using (0):(0):( 5 + 3):( 5 + 3 + 3.5 * barHtScale * $3):1:2 notitle with boxxyerror fc rgb "dark-violet" fs transparent solid 0.25 noborder, \ 135 '' i ( 4 + 0) using ( 5 + 0 + barHtScale * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 136 '' i ( 4 + 3) using ( 5 + 1 + barHtScale * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 137 '' i ( 4 + 2) using ( 5 + 2 + barHtScale * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 138 '' i ( 4 + 1) using ( 5 + 3 + 3.5 * barHtScale * $3):2 notitle with steps lc rgb "dark-violet" lw 0.3, \ 139 \ 140 '' i ( 8 + 0) using (0):(0):(10 + 0):(10 + 0 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "blue" fs transparent solid 0.20 noborder, \ 141 '' i ( 8 + 2) using (0):(0):(10 + 1):(10 + 1 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "dark-orange" fs transparent solid 0.25 noborder, \ 142 '' i ( 8 + 1) using (0):(0):(10 + 2):(10 + 2 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "magenta" fs transparent solid 0.20 noborder, \ 143 '' i ( 8 + 0) using (10 + 0 + barHtScale * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 144 '' i ( 8 + 2) using (10 + 1 + barHtScale * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 145 '' i ( 8 + 1) using (10 + 2 + barHtScale * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 146 \ 147 '' i (11 + 0) using (0):(0):(14 + 0):(14 + 0 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "blue" fs transparent solid 0.20 noborder, \ 148 '' i (11 + 2) using (0):(0):(14 + 1):(14 + 1 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "dark-orange" fs transparent solid 0.25 noborder, \ 149 '' i (11 + 1) using (0):(0):(14 + 2):(14 + 2 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "magenta" fs transparent solid 0.20 noborder, \ 150 '' i (11 + 0) using (14 + 0 + barHtScale * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 151 '' i (11 + 2) using (14 + 1 + barHtScale * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 152 '' i (11 + 1) using (14 + 2 + barHtScale * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 153 \ 154 '' i (14 + 0) using (0):(0):(18 + 0):(18 + 0 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "blue" fs transparent solid 0.20 noborder, \ 155 '' i (14 + 3) using (0):(0):(18 + 1):(18 + 1 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "dark-orange" fs transparent solid 0.25 noborder, \ 156 '' i (14 + 2) using (0):(0):(18 + 2):(18 + 2 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "magenta" fs transparent solid 0.20 noborder, \ 157 '' i (14 + 1) using (0):(0):(18 + 3):(18 + 3 + 3.5 * barHtScale * $3):1:2 notitle with boxxyerror fc rgb "dark-violet" fs transparent solid 0.25 noborder, \ 158 '' i (14 + 0) using (18 + 0 + barHtScale * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 159 '' i (14 + 3) using (18 + 1 + barHtScale * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 160 '' i (14 + 2) using (18 + 2 + barHtScale * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 161 '' i (14 + 1) using (18 + 3 + 3.5 * barHtScale * $3):2 notitle with steps lc rgb "dark-violet" lw 0.3, \ 162 \ 163 '' i (18 + 0) using (0):(0):(23 + 0):(23 + 0 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "blue" fs transparent solid 0.20 noborder, \ 164 '' i (18 + 3) using (0):(0):(23 + 1):(23 + 1 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "dark-orange" fs transparent solid 0.25 noborder, \ 165 '' i (18 + 2) using (0):(0):(23 + 2):(23 + 2 + barHtScale * $3):1:2 notitle with boxxyerror fc rgb "magenta" fs transparent solid 0.20 noborder, \ 166 '' i (18 + 1) using (0):(0):(23 + 3):(23 + 3 + 3.5 * barHtScale * $3):1:2 notitle with boxxyerror fc rgb "dark-violet" fs transparent solid 0.25 noborder, \ 167 '' i (18 + 0) using (23 + 0 + barHtScale * $3):2 notitle with steps lc rgb "blue" lw 0.3, \ 168 '' i (18 + 3) using (23 + 1 + barHtScale * $3):2 notitle with steps lc rgb "dark-orange" lw 0.3, \ 169 '' i (18 + 2) using (23 + 2 + barHtScale * $3):2 notitle with steps lc rgb "magenta" lw 0.3, \ 170 '' i (18 + 1) using (23 + 3 + 3.5 * barHtScale * $3):2 notitle with steps lc rgb "dark-violet" lw 0.3, \ 171 \ 172 INDIR."/plot-list-2ord.sum.dat" \ 173 i ( 0 + 0) using ( 0 + 0 ):1 title "{/Helvetica=15 C{/Symbol \42}}" with points lc rgb "blue" pt 7 ps 1.0, \ 174 '' i ( 0 + 3) using ( 0 + 1 ):1 title "{/Symbol \155}C++" with points lc rgb "dark-orange" pt 9 ps 1.2, \ 175 '' i ( 0 + 2) using ( 0 + 2 ):1 title "LQ-tailq" with points lc rgb "magenta" pt 11 ps 1.2, \ 176 '' i ( 0 + 1) using ( 0 + 3 ):1 title "LQ-list" with points lc rgb "dark-violet" pt 13 ps 1.4, \ 177 '' i ( 0 + 0) using ( 0 + 0):1:( 0 + 0):( 0 + 0 + .8) notitle with xerrorbars lc rgb "blue" pt 0, \ 178 '' i ( 0 + 3) using ( 0 + 1):1:( 0 + 1):( 0 + 1 + .8) notitle with xerrorbars lc rgb "dark-orange" pt 0, \ 179 '' i ( 0 + 2) using ( 0 + 2):1:( 0 + 2):( 0 + 2 + .8) notitle with xerrorbars lc rgb "magenta" pt 0, \ 180 '' i ( 0 + 1) using ( 0 + 3):1:( 0 + 3):( 0 + 3 + .8) notitle with xerrorbars lc rgb "dark-violet" pt 0, \ 181 \ 182 '' i ( 4 + 0) using ( 5 + 0):1:( 5 + 0):( 5 + 0 + .8) notitle with xerrorbars lc rgb "blue" pt 7 ps 1.0, \ 183 '' i ( 4 + 3) using ( 5 + 1):1:( 5 + 1):( 5 + 1 + .8) notitle with xerrorbars lc rgb "dark-orange" pt 9 ps 1.2, \ 184 '' i ( 4 + 2) using ( 5 + 2):1:( 5 + 2):( 5 + 2 + .8) notitle with xerrorbars lc rgb "magenta" pt 11 ps 1.2, \ 185 '' i ( 4 + 1) using ( 5 + 3):1:( 5 + 3):( 5 + 3 + .8) notitle with xerrorbars lc rgb "dark-violet" pt 13 ps 1.4, \ 186 \ 187 '' i ( 8 + 0) using (10 + 0):1:(10 + 0):(10 + 0 + .8) notitle with xerrorbars lc rgb "blue" pt 7 ps 1.0, \ 188 '' i ( 8 + 2) using (10 + 1):1:(10 + 1):(10 + 1 + .8) notitle with xerrorbars lc rgb "dark-orange" pt 9 ps 1.2, \ 189 '' i ( 8 + 1) using (10 + 2):1:(10 + 2):(10 + 2 + .8) notitle with xerrorbars lc rgb "magenta" pt 11 ps 1.2, \ 190 \ 191 '' i (11 + 0) using (14 + 0):1:(14 + 0):(14 + 0 + .8) notitle with xerrorbars lc rgb "blue" pt 7 ps 1.0, \ 192 '' i (11 + 2) using (14 + 1):1:(14 + 1):(14 + 1 + .8) notitle with xerrorbars lc rgb "dark-orange" pt 9 ps 1.2, \ 193 '' i (11 + 1) using (14 + 2):1:(14 + 2):(14 + 2 + .8) notitle with xerrorbars lc rgb "magenta" pt 11 ps 1.2, \ 194 \ 195 '' i (14 + 0) using (18 + 0):1:(18 + 0):(18 + 0 + .8) notitle with xerrorbars lc rgb "blue" pt 7 ps 1.0, \ 196 '' i (14 + 3) using (18 + 1):1:(18 + 1):(18 + 1 + .8) notitle with xerrorbars lc rgb "dark-orange" pt 9 ps 1.2, \ 197 '' i (14 + 2) using (18 + 2):1:(18 + 2):(18 + 2 + .8) notitle with xerrorbars lc rgb "magenta" pt 11 ps 1.2, \ 198 '' i (14 + 1) using (18 + 3):1:(18 + 3):(18 + 3 + .8) notitle with xerrorbars lc rgb "dark-violet" pt 13 ps 1.4, \ 199 \ 200 '' i (18 + 0) using (23 + 0):1:(23 + 0):(23 + 0 + .8) notitle with xerrorbars lc rgb "blue" pt 7 ps 1.0, \ 201 '' i (18 + 3) using (23 + 1):1:(23 + 1):(23 + 1 + .8) notitle with xerrorbars lc rgb "dark-orange" pt 9 ps 1.2, \ 202 '' i (18 + 2) using (23 + 2):1:(23 + 2):(23 + 2 + .8) notitle with xerrorbars lc rgb "magenta" pt 11 ps 1.2, \ 203 '' i (18 + 1) using (23 + 3):1:(23 + 3):(23 + 3 + .8) notitle with xerrorbars lc rgb "dark-violet" pt 13 ps 1.4, \ 204 \ 205 $Singleton using (0):(0.1):("This text is placed offscrean-low") title "↕ mean" with labels -
doc/theses/mike_brooks_MMath/plots/list-2ord.py
r2581f1e r1abcec9b 6 6 sys.path.insert(0, os.path.dirname(__file__)) 7 7 from ListCommon import * 8 9 sumFile = open( sys.argv[1], 'w' ) 10 detFile = open( sys.argv[2], 'w' ) 8 11 9 12 # for mvmt+polarity effects, where lq-list doesn't support queue or inslast … … 17 20 'SizeZone': ['ML'] }, 18 21 drillOn=['machine', 'SizeZone', 'fx'], 19 marginalizeOn=['SizeZone'] ) 22 marginalizeOn=['SizeZone'], 23 sumFile = sumFile, 24 detFile = detFile ) 20 25 21 26 printHistos( … … 26 31 'SizeZone': ['ML'] }, 27 32 drillOn=['machine', 'SizeZone', 'fx'], 28 marginalizeOn=['SizeZone'] ) 33 marginalizeOn=['SizeZone'], 34 sumFile = sumFile, 35 detFile = detFile ) 29 36 30 37 printHistos( … … 35 42 'fx': noLqList }, 36 43 drillOn=['movement', 'fx'], 37 marginalizeOn=['movement'] ) 44 marginalizeOn=['movement'], 45 sumFile = sumFile, 46 detFile = detFile ) 38 47 39 48 printHistos( … … 44 53 'fx': noLqList }, 45 54 drillOn=['polarity', 'fx'], 46 marginalizeOn=['polarity'] ) 55 marginalizeOn=['polarity'], 56 sumFile = sumFile, 57 detFile = detFile ) 47 58 48 59 printHistos( … … 50 61 tgtPolarity = 'all', 51 62 tgtAccessor = 'all', 52 earlyFilter = { 'accessor': ['allhead', 'inselem'] }, 53 lateFilter = { 'accessor': ['inselem'] }, 63 earlyFilter = { 'accessor': ['allhead', 'inselem'] }, # set up head-to-head benchmarking 64 lateFilter = { 'accessor': ['inselem'] }, # show one side of the mirror, as usual 54 65 drillOn=['accessor', 'fx'], 55 marginalizeOn=['accessor'] ) 66 marginalizeOn=['accessor'], 67 sumFile = sumFile, 68 detFile = detFile ) 56 69 57 70 printHistos( … … 62 75 lateFilter = { 'accessor': ['remelem'] }, 63 76 drillOn=['accessor', 'fx'], 64 marginalizeOn=['accessor'] ) 77 marginalizeOn=['accessor'], 78 sumFile = sumFile, 79 detFile = detFile ) -
libcfa/src/collections/array.hfa
r2581f1e r1abcec9b 1 1 #pragma once 2 3 2 4 3 … … 176 175 } 177 176 177 // RAII for copying interacts poorly with CFA RAII's default (quasi-mandate) to take 178 // 'src' parameters by value; note doc/proposals/autogen.md suggests changing this pattern. 179 // If Timmed offers a by-value copy-ctor, then 180 // - the array copy-ctor will make lots of memcpys of them 181 // - the array assignment operator will make temporaries (and call their RAII, implying 182 // the above memcpys) of them 183 // - the array assignment operator will scale poorly to higher dimensionality due to #226 184 // Furthermore, enabling this experimental flag breaks some multidimensional behaviour, 185 // as illustraed by a test failure in array-md-sbscr-cases, which has not been investigated. 186 // These limitations kick in upon calling the copy operation, not upon including the definitions. 187 // Design choice here: 188 // - FIX ME: deal with `const &` on params 189 #ifdef EXPERIMENTAL_ARRAY_ALLOW_COPY_RAII 190 // call copy ctor on elements 191 // array(float, 5) y; // given 192 // array(float, 5) x = y; // <- do 193 forall( [N], S & | sized(S), Timmed *, Tbase & | { void ?{}( Timmed &, Timmed & ); } ) 194 static inline void ?{}( arpk( N, S, Timmed, Tbase ) & this, arpk( N, S, Timmed, Tbase ) & src ) { 195 ?{}( this, delay_init ); 196 for (i; N) ?{}( (Timmed &)this.strides[i], src[i] ); 197 } 198 forall( [N], S & | sized(S), Timmed *, Tbase & | { void ?{}( Timmed &, const Timmed & ); } ) 199 static inline void ?{}( arpk( N, S, Timmed, Tbase ) & this, arpk( N, S, Timmed, Tbase ) & src ) { 200 ?{}( this, delay_init ); 201 for (i; N) ?{}( (Timmed &)this.strides[i], src[i] ); 202 } 203 204 // call assignment on elements 205 // array(float, 5) x, y; // given 206 // x = y; // <- do 207 forall( [N], S & | sized(S), Timmed & | is_value(Timmed), Tbase & ) 208 static inline void ?=?( arpk( N, S, Timmed, Tbase ) & this, arpk( N, S, Timmed, Tbase ) & src ) { 209 for (i; N) this[i] = src[i]; 210 return src; 211 } 212 forall( [N], S & | sized(S), Timmed &, Tbase & | { void ?=?( Timmed &, const Timmed & ); } ) 213 static inline void ?=?( arpk( N, S, Timmed, Tbase ) & this, arpk( N, S, Timmed, Tbase ) & src ) { 214 for (i; N) this[i] = src[i]; 215 return src; 216 } 217 #endif // EXPERIMENTAL_ARRAY_ALLOW_COPY_RAII 218 178 219 179 220 // -
libcfa/src/collections/string.cfa
r2581f1e r1abcec9b 244 244 245 245 string ?()( string & s, ssize_t start, ssize_t len ) { 246 if ( start < 0 ) start += len( s ); 247 if ( len < 0 ) { len = -len; start -= len - 1; } 248 if ( start < 0 || start >= len( s ) ) return (string){ "" }; 249 if ( start + len > len( s ) ) len = len( s ) - start; 246 // if ( start < 0 ) start += len( s ); 247 // if ( len < 0 ) { len = -len; start -= len - 1; } 248 // if ( start < 0 ) start = 0; 249 // if ( start > len( s ) ) start = len( s ); 250 // if ( start + len > len( s ) ) len = len( s ) - start; 250 251 string ret = { *s.inner, start, len }; 251 252 return ret`share; -
tests/collections/string-overwrite.cfa
r2581f1e r1abcec9b 73 73 */ 74 74 75 const char * OUT_DELIM = "------------------------------------------------------------------------"; 75 76 76 77 void showOneReplacement(string & s, int ms, int ml, int ws, int wl, const char* replaceWith) { … … 232 233 }; 233 234 for ( i; sizeof(cases)/sizeof(cases[0]) ) { 234 sout | "------------------------------------------------------------------------"| cases[i].label;235 sout | OUT_DELIM | cases[i].label; 235 236 string replaceIn = alphabetTemplate; 236 237 showOneReplacement( replaceIn, cases[i].ms, cases[i].ml, cases[i].ws, cases[i].wl, cases[i].replaceWith ); … … 246 247 247 248 249 runReplaceCases(); 250 251 252 // in `s(i, k) = sr`: 253 // - whlln, whole-string length = len(s) 254 // - sctln, selection length = k 255 // - rplln, replacement length = len(sr) 256 257 // Extra cases via syntax that appears more direct. 258 // Indirect, as drives the table: 259 // string replace = src(strt, len)`share; 260 // replace = "xyz"; 261 // Direct, following: 262 // src(strt, len) = "xyz"; 263 sout | OUT_DELIM | "syn-direct"; 264 248 265 // 0 1 2 249 266 // 01234567890123456789012345 … … 251 268 252 269 s(5,5) = "qqqqq"; // start=5, end=10, len=5 253 254 270 sout | s; 255 271 256 257 272 s(5,0) = "-----"; // start=5, end=5, len=0 258 259 273 sout | s; 260 274 261 runReplaceCases(); 275 276 // Extra cases for at-/out-of-bound access 277 // Every selection starts and ends at a position between characters, inclusive of before-first and after-last 278 // Intended behaviour is 279 // - negative start means "back from whlln;" i.e., -1 is before-last 280 // - negative sctln menas "back from start;" i.e., -1 from middle selects 1 character before start 281 // - squish inward at subject string's first/last character 282 // - start > whlln means same as start == whlln: after last character, with sctln >= 0 selecting zero characters 283 // - start < -whlln means same as start == -whlln: before first character, with sctln <= 0 selecting zero characters 284 // - (let xstart be the position in [0,whlln] equivalent to start, by the above, in the following...) 285 // - xstart + sctln > whlln means same as sctln = whlln - xstart (significant when sctln is positive) 286 // - xstart + sctln < 0 means same as sctln = -xstart (significant when sctln is negative) 287 // - start = 0 means 288 // - before first, when sctln is zero or positive 289 // - after last, when sctln is negative 290 // - start "outside the string" cases are: 291 // - start = 0 can select forward from first or backward from last (as just stated); note the asymmetric "sctln = 0" handling 292 // - (so, the following cases are available to specify front-v-back explicitly...) 293 // - start >= whlln can select only backward from last, i.e. selects final epsilon when sctln >= 0 294 // - start <= -whln can select only forward from first, i.e. selects initial epsilon when sctln <= 0 295 // most selections have two equivalent representations 296 sout | OUT_DELIM | "boundary"; 297 /* 298 The test 299 300 base = 01234 301 302 303 (Start|Step) is (just over|right on|just under) the (min|mid|max) value 304 | 305 whlln (>|=|<) rplln 306 | 307 0 (=|<) (whlln|rplln) 308 309 Every case needs concrete & independent 310 whlln 311 rpln 312 start 313 step, aka sctln 314 315 Constraint space is 316 sel[Start] 317 * 318 sel[Step] 319 * 320 lens1 321 * 322 lens2 323 , 324 excluding when the lens pair contradicts 325 = 326 972 concrete test cases (all combinations) 327 328 Toward all pairs 329 Each case achieves up to 6 further pairings. 330 Best-case, achieved with 81 cases. (162 permutations / 2 orderings of a pair) 331 332 333 334 Start 335 just over the min value 336 just over the mid value 337 just over the max value 338 just over the min value 339 just over the mid value 340 just over the max value 341 just over the min value 342 just over the mid value 343 just over the max value 344 345 346 */ 347 348 349 // Extra cases for modifying substring of substring. 350 sout | OUT_DELIM | "compound"; 351 352 s = "abcdefghijklmnopqrstuvwxyz"; 353 string sx = s(5,5)`share; 354 262 355 }
Note:
See TracChangeset
for help on using the changeset viewer.