Changeset 1abcec9b


Ignore:
Timestamp:
Apr 13, 2026, 3:05:44 AM (2 weeks ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
5b21636b
Parents:
2581f1e
Message:

Add overlaid means to list perf histograms. Add 2nd-order graph to the paper and its discussion.

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/mike_brooks_MMath/Makefile

    r2581f1e r1abcec9b  
    100100-include $(Plots)/*.d
    101101
     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
    102108${Build}/plot-%.dat: ${Plots}/%.py ${Plots}/common.py ${Plots}/ListCommon.py ${Plots}/%.py.INPUTS | ${Build}
    103109        python3 $< > $@
  • doc/theses/mike_brooks_MMath/list.tex

    r2581f1e r1abcec9b  
    10341034  \includegraphics{plot-list-1ord.pdf}
    10351035  \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.}
    10381037  \label{fig:plot-list-1ord}
    10391038\end{figure}
     
    10461045
    10471046A 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}.
     1047Specific 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.
    10491048But they are so irrelevant to the issue of picking a winning framework that it is sufficient here to number the operations opaquely.
    10501049Whether 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.
     
    10601059As does a small size on the Intel typically beat a medium size on the AMD by 66\%.
    10611060Framework 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.
     1075But this perspective cannot address questions like, ``Where are \CFA's sore spots?''
     1076Moreover, 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.
     1079Its size-zone criterion refines the obvious notion that a small size runs faster than a big size; this issue is by how much.
     1080Indeed, all means favour small and few tails favour medium.
     1081But the various frameworks do no respond to the different sizes and machines uniformly.
     1082On the AMD, \CFA and \uCpp have a modest size sensitivity, LQ-tailq's is moderate amd LQ-list seems unaffected.
     1083On the Intel, \CFA's increases to moderate, while \uCpp is now unaffected, and both LQs have a dramatic response.
     1084The Intel is more sensitive to size than the AMD.
     1085
     1086Turning next to movement and polarity, the responses appear more subdued.
     1087Note 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
     1091Finally, with accessor, a \CFA sore spot emerges.
     1092Note the pair of two-way comparisons pulled from the three experiment setups used.
     1093First, the all-head/insert-element opposition addresses which insertion style is better---by-head (top) and by-element (bottom).
     1094Then, the all-head/remove-element opposition addresses which removal style is better---by-head (top) and by-element (bottom).
     1095The LQs favour insertion by head and removal by element.
     1096\CFA and \uCpp favour both operations by head.
     1097The 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.
     1101This analysis does not provide more detail about one framework beating another; it offers different benefits.
     1102These 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.
     1103They illustrate the difficult signal-to-noise ratio that I had to overcome in preparing this data.
     1104They may serve as a reference guiding future \CFA linked-list work by informing on where to target improvements.
     1105Finally, 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}
     1109Further 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.
     1110In 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:
     1115Side 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
    10621119
    10631120\MLB{ TODO: find a home for these original conclusions:
     
    11241181  \caption{Histogram of operation durations, decomposed by physical factors.
    11251182  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  }
    11271186  \label{fig:plot-list-mchn-szz}
    11281187\end{figure}
     
    11311190Each 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.
    11321191Among 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 physial factors.
     1192This variability is due solely to physical factors.
    11341193
    11351194From the perspective of assessing winning/losing frameworks, these physical effects are noise.
  • doc/theses/mike_brooks_MMath/plots/ListCommon.py

    r2581f1e r1abcec9b  
    33import math
    44import os
     5import sys
    56from subprocess import Popen, PIPE
    67from scipy.stats import gmean
     
    265266    return metadata
    266267
     268def 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
    267284swiftSweetspot = (lambda x: x > 16 and x < 150)
    268285# swiftSweetspot = (lambda x: x > 4 and x < 32)
     
    303320
    304321        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
    317324
    318325def printSingleDetail(
     
    426433    lateFilter = {}, # exclude from output
    427434    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 ):
    429438
    430439    if marginalizeOn == None:
     
    478487#       print(mgroup, file=sys.stderr)
    479488
     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
    480499        histo_raw = dgroup[ c_measureBkt ].value_counts()
    481500        for b in buckets:
     
    490509        histo.insert(y_lo_col_loc + 1, "y_hi", histo["y_lo"].apply(topValOfBucketBotVal))
    491510
    492         dkey_str = list( map( str, dkey ) )
    493         header = str.join(', ', dkey_str)
    494         print(f'"{header}"')
     511        print(f'"{header}"', file=detFile)
    495512        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)
    499516
    500517        # 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 | build
     1plots/list-1ord.gp.INPUTS: build/plot-list-1ord.sum.dat build/plot-list-1ord.det.dat | build
    22plots/list-1ord.py.INPUTS: benchmarks/list/results-swift-general.csv
  • doc/theses/mike_brooks_MMath/plots/list-1ord.gp

    r2581f1e r1abcec9b  
    1515set grid
    1616set 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
     18set ylabel "Duration (relative)" offset -1.0,0
     19set logscale y (2**0.2)
     20set yrange [0.38:2.5];
     21set format y "%.1f {/Symbol \264}"
     22set 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'
     25unset border
     26set arrow from graph 0, first 1 to graph 1, first 1 nohead lt -1 lw 2
     27set arrow 100 from graph 0, graph 0 to graph 0, graph 1 nohead lw 1 front
     28set arrow 101 from graph 1, graph 0 to graph 1, graph 1 nohead lw 1 front
     29
    3430set xrange [-5.5:17.5];
    3531set xlabel "Machine, Size Zone;                           Operation;                                     Framework;       \nPrevalence                                   Prevalence                                     Prevalence"
     
    5753   "LQ: tailq" 15, \
    5854   "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
    6456
    6557barHtScale_phys = 0.05
     
    6759barHtScale_fx = 0.05
    6860
     61set errorbars 0 linewidth 4
     62set pointintervalbox 0
    6963
    70 plot INDIR."/plot-list-1ord.dat" \
     64
     65plot INDIR."/plot-list-1ord.det.dat" \
    7166       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, \
    7267    '' 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, \
     
    110105    '' i 19 using (1 + 13 +       barHtScale_fx * $3):2 notitle with steps lc rgb "dark-orange"  lw 0.3, \
    111106    '' 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  
    66sys.path.insert(0, os.path.dirname(__file__))
    77from ListCommon import *
     8
     9sumFile = open( sys.argv[1], 'w' )
     10detFile = open( sys.argv[2], 'w' )
    811
    912physicals = ['machine', 'SizeZone']
     
    2124    tgtPolarity = 'all',
    2225    tgtAccessor = 'all',
    23     drillOn=physicals )
     26    drillOn=physicals,
     27    sumFile = sumFile,
     28    detFile = detFile )
    2429
    2530printHistos(
     
    2732    tgtPolarity = 'all',
    2833    tgtAccessor = 'all',
    29     drillOn=ops )
     34    drillOn=ops,
     35    sumFile = sumFile,
     36    detFile = detFile )
    3037
    3138printHistos(
     
    3340    tgtPolarity = 'all',
    3441    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 | build
     1plots/list-2ord.gp.INPUTS: build/plot-list-2ord.sum.dat build/plot-list-2ord.det.dat | build
    22plots/list-2ord.py.INPUTS: benchmarks/list/results-swift-general.csv
  • doc/theses/mike_brooks_MMath/plots/list-2ord.gp

    r2581f1e r1abcec9b  
    1212set lmargin 10
    1313set bmargin 5
    14 set tmargin 2
     14set tmargin 3.5
    1515
    1616set grid
    17 set nokey
    1817
    1918set logscale y (2**0.2)
    20 set yrange [0.57:1.65];
    21 set format y "%.2f {/Symbol \264}"
     19set yrange [0.65:1.65];
     20set format y "%.1f {/Symbol \264}"
    2221set ytics (0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6)
    2322set ylabel "Speedup,  bot. opt.  {/Symbol \256}  top opt." offset -0.5,0
     
    3029
    3130set xrange [-0.7:27.5];
    32 set xlabel "Criterion;  top / bot. Options;  Prevalence" offset 0,-1.5
     31set xlabel "Criterion;  top-bottom Options;  Prevalence" offset 0,-1.5
    3332set format x ""
    3433set xtics ( \
     
    4241
    4342set 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"
     43set label "(AMD)"                           at first  1.5, graph  0.06 center font "Times-Bold,18" front
    4544set label "medium"                          at first  1.5, graph -0.05 center
    4645set 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"
     46set label "(Intel)"                         at first  6.5, graph  0.06 center font "Times-Bold,18" front
    4847set label "medium"                          at first  6.5, graph -0.05 center
    4948set label "Size Zone"                       at first  4  , graph -0.14 center
     
    6059set label "ins. elem."                      at first 19.5, graph -0.05 center
    6160set label "all head"                        at first 24.5, graph  1.05 center
    62 set label "rem. elem"                       at first 24.5, graph -0.05 center
     61set label "rem. elem."                       at first 24.5, graph -0.05 center
    6362set label "Accessor"                        at first 22  , graph -0.14 center
    6463
     
    8483set arrow 21+.4 from 26+.4, graph -0.10 to 26+.4, graph -0.08 nohead lw 1
    8584
     85# legend, augmented
     86set key outside top center horizontal maxrows 1 samplen 2 width +1 # offset -10,0
     87set 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
     88set 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
     89set 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
     90set 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
     92set arrow 99 from first 20.8, screen 0.96 to first 23, screen 0.96  nohead lw 1 dt 2
     93
    8694set errorbars 2.0
    8795set pointintervalbox 0
    8896
    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
     990
     100EOD
     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
     115set errorbars 0 linewidth 4
     116
     117
     118barHtScale = 0.048
     119
     120plot \
     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  
    66sys.path.insert(0, os.path.dirname(__file__))
    77from ListCommon import *
     8
     9sumFile = open( sys.argv[1], 'w' )
     10detFile = open( sys.argv[2], 'w' )
    811
    912# for mvmt+polarity effects, where lq-list doesn't support queue or inslast
     
    1720                   'SizeZone': ['ML'] },
    1821    drillOn=['machine', 'SizeZone', 'fx'],
    19     marginalizeOn=['SizeZone'] )
     22    marginalizeOn=['SizeZone'],
     23    sumFile = sumFile,
     24    detFile = detFile )
    2025
    2126printHistos(
     
    2631                   'SizeZone': ['ML'] },
    2732    drillOn=['machine', 'SizeZone', 'fx'],
    28     marginalizeOn=['SizeZone'] )
     33    marginalizeOn=['SizeZone'],
     34    sumFile = sumFile,
     35    detFile = detFile )
    2936
    3037printHistos(
     
    3542                   'fx': noLqList },
    3643    drillOn=['movement', 'fx'],
    37     marginalizeOn=['movement'] )
     44    marginalizeOn=['movement'],
     45    sumFile = sumFile,
     46    detFile = detFile )
    3847
    3948printHistos(
     
    4453                   'fx': noLqList },
    4554    drillOn=['polarity', 'fx'],
    46     marginalizeOn=['polarity'] )
     55    marginalizeOn=['polarity'],
     56    sumFile = sumFile,
     57    detFile = detFile )
    4758
    4859printHistos(
     
    5061    tgtPolarity = 'all',
    5162    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
    5465    drillOn=['accessor', 'fx'],
    55     marginalizeOn=['accessor'] )
     66    marginalizeOn=['accessor'],
     67    sumFile = sumFile,
     68    detFile = detFile )
    5669
    5770printHistos(
     
    6275    lateFilter = { 'accessor': ['remelem'] },
    6376    drillOn=['accessor', 'fx'],
    64     marginalizeOn=['accessor'] )
     77    marginalizeOn=['accessor'],
     78    sumFile = sumFile,
     79    detFile = detFile )
  • libcfa/src/collections/array.hfa

    r2581f1e r1abcec9b  
    11#pragma once
    2 
    32
    43
     
    176175}
    177176
     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
    178219
    179220//
  • libcfa/src/collections/string.cfa

    r2581f1e r1abcec9b  
    244244
    245245string ?()( 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;
    250251        string ret = { *s.inner, start, len };
    251252        return ret`share;
  • tests/collections/string-overwrite.cfa

    r2581f1e r1abcec9b  
    7373*/
    7474
     75const char * OUT_DELIM = "------------------------------------------------------------------------";
    7576
    7677void showOneReplacement(string & s, int ms, int ml, int ws, int wl, const char* replaceWith) {
     
    232233    };
    233234    for ( i; sizeof(cases)/sizeof(cases[0]) ) {
    234         sout | "------------------------------------------------------------------------" | cases[i].label;
     235        sout | OUT_DELIM | cases[i].label;
    235236        string replaceIn = alphabetTemplate;
    236237        showOneReplacement( replaceIn, cases[i].ms, cases[i].ml, cases[i].ws, cases[i].wl, cases[i].replaceWith );
     
    246247
    247248
     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
    248265    //          0         1         2
    249266    //          01234567890123456789012345
     
    251268
    252269    s(5,5) = "qqqqq";  // start=5, end=10, len=5
    253 
    254270    sout | s;
    255271
    256 
    257272    s(5,0) = "-----";  // start=5, end=5, len=0
    258 
    259273    sout | s;
    260274
    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/*
     298The test
     299
     300base = 01234
     301
     302
     303(Start|Step) is (just over|right on|just under) the (min|mid|max) value
     304|
     305whlln (>|=|<) rplln
     306|
     3070 (=|<) (whlln|rplln)
     308
     309Every case needs concrete & independent
     310whlln
     311rpln
     312start
     313step, aka sctln
     314
     315Constraint space is
     316sel[Start]
     317*
     318sel[Step]
     319*
     320lens1
     321*
     322lens2
     323,
     324excluding when the lens pair contradicts
     325=
     326972 concrete test cases (all combinations)
     327
     328Toward all pairs
     329Each case achieves up to 6 further pairings.
     330Best-case, achieved with 81 cases.  (162 permutations / 2 orderings of a pair)
     331
     332
     333
     334Start
     335just over the min value
     336just over the mid value
     337just over the max value
     338just over the min value
     339just over the mid value
     340just over the max value
     341just over the min value
     342just over the mid value
     343just 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
    262355}
Note: See TracChangeset for help on using the changeset viewer.