Concept

Arithmetic cost — where it appears

The number of multiply-adds a computation performs, counted exactly rather than estimated. It is a property of the algorithm and the order its operations are taken in rather than of the answer, so two evaluations of one expression can differ in it by a factor of a million.

Named by 8 essays across 2 fields — each of them below, with the objects they name alongside it.

11.31.61.92.210⁻¹⁶10⁻¹³10⁻¹⁰10⁻⁷10⁻⁴10⁻¹10²log₁₀ quadrature pointsdistance from the true counthalf an eigenvaluean integer, eventuallytrue count2at 4 points2at 128 points2finest error1.4·10⁻¹³the integral is an integerand a rounding hides how far it was

The last digit is the cheapest

Every cost curve measured here has the same shape: the first digits are cheap and the last ones are not. One method inverts it. Doubling the work buys twice as many digits as the previous doubling did, so the price of a digit halves every time it is paid.

cost · Nonlinear cost
10⁴1ceiling on the largest intermediate, numbers heldarithmetic ÷ the unconstrained cheapest orderno evaluation order fits below thisminimising the peak insteadthe unconstrained cheapest ordera ceiling, not a targetfree order, peak9504leanest possible2106cheapest that fits1leanest order costs1.6the difference1.6largest input2106the same memoryat two prices

A ceiling is not a target

Asked to hold the smallest possible intermediate, an evaluation order costs a median of 1.55 times the cheapest order's arithmetic. Asked to hold no more than that same amount, it costs 1.15. The two answers hold exactly the same number of numbers, and on one network they are 5.17 times apart in work.

cost · Contraction
10¹10²110¹rank of the trains at the moment of evaluationcost ÷ the cost of this rank's own best ordereach rank's own best orderthe order compiled at rank 4, carriedthe smallest-result rule, recomputedthe cheapest-product rule, recomputedone plan, eight rankscompiled at rank4worst carried8carried at rank 2568fresh rule at 2562.9carried at rank 21fresh rule at 21.1the search was exhaustiveand the dimensions moved

The plan that was right at rank four

An evaluation order is chosen once and paid for thousands of times, and the dimensions it was chosen at are not the dimensions it runs at. Compiled at rank four and run at rank 256 it costs 8.01 times the order that rank deserves; compiled at 256 and run at 2 it costs 301 times. A one-line rule recomputed on arrival costs 2.92 and 1.11.

cost · Contraction
12345678110¹partial orders kept at each pairingexcess over the exhaustive orderthe exhaustive orderdashes above: each rule's worst casepair by cheapest productpair by smallest resultone knob, two rulesby cost, width 11.5by cost, width 21.1by size, width 11both, width 81by size, worse wider24by cost, worse wider3the width repairs the bad ruleand does not improve the good one

The search that got worse as it widened

Keeping two candidate orders instead of one removes a third of the cheapest-product rule's excess, and by eight it has removed all of it — the two greedy rules this field separated become the same rule. On twenty-four of sixty networks a wider search returns a dearer order than a narrower one, and it is the better rule that it more often makes worse.

cost · Contraction
123456700.10.20.30.4circle radius Rdigits per quadrature point27 points41 points78 pointseight eigenvalues, 4.19 to 4.56line: the annulus · dots: measured · large: ten digits at the geometric meanon a shared ray the balance is a cancellation

The circle between two eigenvalues

A contour count's error is not approximately governed by the nearest eigenvalue; it is exactly one closed-form term per eigenvalue, and summing those terms reproduces the quadrature to a millionth at 1,720 radius and point pairs. Three things follow. The rate is the ratio of the two moduli the circle sits between, not a distance, so two circles 0.2 from their nearest eigenvalue converge three times apart. Ten digits cost about 21 points divided by log₁₀ of that ratio, 71 points with twelve eigenvalues inside and 3,476 with six. And the best circle is not halfway: at the geometric mean of two eigenvalues on one ray their two terms are equal and opposite, and ten digits cost 27 points where the midpoint needs 84.

cost · Nonlinear cost
1.01.21.41.61.82.0median member's cost over the least any row order reachesindependent entriesa shared zero patternshared row scalesone matrix, two entries redrawnnatural order1.60the median order1.72another member's best1.54best over the other eleven1.46rows by their norms1.49smallest pivot entry1.24natural order1.65the median order1.72another member's best1.59best over the other eleven1.36rows by their norms1.35smallest pivot entry1.08natural order1.88the median order1.86another member's best1.13best over the other eleven1.16rows by their norms1.05smallest pivot entry1.01natural order1.28the median order1.51another member's best1.16best over the other eleven1.07rows by their norms1.42smallest pivot entry1.14dashed: the least cost of all 40,320 ordersthe rule wins wherever the rows show why

An order found once knows what the rows know

Searching for a fraction-free elimination's least-cost row order costs forty to two hundred and sixty times the elimination, so it can only pay if one order serves a whole family. The prediction was that it cannot: the best order depends on which rows happen to have short entries, so a reused order should do no better than the natural one. On independent entries and on a shared zero pattern that holds — another member's best order is an ordinary order, at the middle of the 40,320. On a family that shares its row scales it fails completely: another member's order costs a median 1.13 of the least where the natural order costs 1.88. But on every family, including that one, the rule that just takes the smallest pivot entry is cheaper than any reused or trained order — 1.24, 1.08 and 1.01. What an order carries from one matrix to the next is what the family shares — and only when that is a particular matrix, not a visible structure, does an order trained on the family beat the rule.

exact · Fraction-free
1020501002005000.822 to 1.58741220.822 to 2.68678210.822 to 3.644341321.587 to 2.686381.587 to 3.644202.686 to 3.64426points for ten digitsbest circle about the originbest circle about any real centrethe four together: 341 about the origin, 32 about 2.3the centre is worth most where the rays differ

A centre that chooses which pair cancels

A contour count's error is one closed-form term per eigenvalue, and two real eigenvalues on one ray cancel at their geometric mean — about the origin. Moved along the real axis, the centre was predicted to buy a further factor of two by putting real eigenvalues on two rays, the far one cancelling with a sign flip. The flip is parity: an eigenvalue behind the centre changes sign only at odd point counts. The factor is not two. Counting the delay problem's first two and three real eigenvalues, the best centre costs 22 and 21 points against the origin's 41 and 78; counting all four, 32 against 341, because about the origin the circle has to pass between a real eigenvalue and a complex pair and about 2.3 it does not. The centre does not add a cancellation. It chooses which pair cancels and pushes everything else away.

cost · Nonlinear cost
50100200300reals and one band12 eigenvalues5255reals and 2 bands20 eigenvalues6897reals and 3 bands28 eigenvalues83150reals and 4 bands36 eigenvalues92192reals and 5 bands44 eigenvalues104234reals and 6 bands52 eigenvalues115275points for ten digits on the whole countone circle, best real centresplit, mirror evaluatedsplit, mirror freeone band: one circle wins; six: the split costs 0.42 of itthe mirror is what pays

Count the upper half, read the lower

Moving a contour's centre off the real axis was predicted never to pay for a count closed under conjugation: one member of each pair comes closer, the other goes away, and the slower one always gets slower. For one circle the prediction holds at every offset measured, from 52 points on the axis to 567 three units above it. But one circle is not the only way to count a set like that. On the delay problem, the four real eigenvalues on a circle of their own and each band's upper cluster on a small circle of its own cost 55 points against 52 for one band, 68 against 97 for two, and 115 against 275 for six. What pays is the mirror: for a problem with real coefficients the count about the conjugate centre is the conjugate of the count already made, equal to 1.6·10⁻¹⁵, so the lower half of the plane costs nothing.

cost · Nonlinear cost

Named alongside it

The objects these essays reach for when they reach for this one.

Contour integralConvergence rateHeuristicNonlinear eigenvalue problemQuadratureContour eigensolverContraction orderExact ground truthFlop countSymbolic phaseTensor networkElimination order

All concepts