When the index is a tuple

The nearest product is not the nearest operator

A Kronecker sum is solved by one eigendecomposition per axis, and a variable-coefficient operator almost never is one. So the natural move is to solve the nearest separable problem instead and use it as a preconditioner, with the coefficient's first singular value saying how near. That number predicts nothing. A bump at contrast six has 99.9 per cent of its norm in its first singular value and takes 123 iterations, seven times what it takes at a share of 95 per cent, because a fit in the norm chases the peak and leaves the rest of the domain wrong by a factor of 167. Fit the logarithm instead and the misfit is a ratio, the iterations fall by more than half, and one number accounts for them on every case tried: the root of the spread of the pointwise ratio.

Worth reading first: An index that is a pair · Changing the condition number on purpose.

A solve that is d decompositions found what a Kronecker sum offers: eigenvectors that are Kronecker products, so a solve with 1,728 unknowns needs one decomposition of a 12-by-12 matrix and nothing else. Five indices are cheaper than two then priced that against the number of axes. All of it depends on the coefficients separating, as they do on a constant-coefficient Laplacian on a box. Almost no physical operator does. A diffusion coefficient a(x,y)a(x, y) that is not a product p(x)q(y)p(x)q(y) takes the whole structure away.

The standard response is to give up the exact solve and keep the structure in a preconditioner. Take the nearest separable coefficient to the true one, solve that exactly by fast diagonalisation, and iterate. Van Loan and Pitsianis wrote the nearest Kronecker product down in 1993 as a singular value problem: reshuffle the matrix, take the first singular triple. The size of the first singular value relative to the rest then seems to say how near the problem is to separable, and so how well this will work. That is the reading to measure. The operator is −∂(a ∂u)-\partial(a\,\partial u) on a square grid of 24 points a side, with the five-point stencil, and coefficients of the form exp⁡(c g(x,y))\exp(c\,g(x, y)), where cc sets the contrast.

Three coefficients, three preconditioners

The function gg comes in three forms. A separable one, sin⁡2πx+cos⁡πy\sin 2\pi x + \cos \pi y, makes aa an exact product of two functions. A bump in the middle of the square is not separable, but it comes close. A ridge along the diagonal has nothing separable about it at all. The preconditioners are a Laplacian scaled by the coefficient’s mean, which ignores everything about aa except its size; a separable problem fitted in the Frobenius norm, by the first singular triple of the coefficient’s grid values; and a separable problem fitted in the logarithm, of which more below.

Conjugate gradient iterations to ten to the minus eight on a variable-coefficient operator of a bump in the middle, against the contrast, preconditioned by a scaled Laplacian and by separable fits in the norm and in the logarithmScaled Laplacian: 9, 14, 23, 35, 50, 109. Fit in the norm: 7, 9, 17, 29, 50, 123. Fit in the logarithm: 8, 10, 16, 22, 30, 50, at contrasts 0.5, 1, 2, 3, 4, 6.0123456110¹10²10³contrast c, the coefficient is exp(c g)iterationsscaled Laplacianfit in the normfit in the logarithm24 × 24 grid · a bump in the middlethe norm's fit chases the peak
Fig. 1 Conjugate gradient iterations to 10−810^{-8} on a variable-coefficient operator, against the contrast, preconditioned by a scaled Laplacian and by separable fits in the norm and in the logarithm. The dial sets the coefficient.

The first stop on the dial is the case the method is made for, and the case for the method is overwhelming. On the separable coefficient, the fit takes 5, 6, 8, 10, 12 and 15 iterations as the contrast runs from a half to six, and a scaled Laplacian takes 25, 68, 427 and then fails to finish in 2,000 at a contrast of three, at which the coefficient varies by a factor of about e12e^{12}. Plain conjugate gradients fails too. The result is better than a factor of a hundred. A count of 15 rather than one, on a coefficient that is exactly separable, comes from how the faces of the cells are averaged: a product at the nodes is not quite a product at the faces, and that discretisation mismatch falls as the grid is refined.

Turn it to the bump and the picture is not so clear. At a contrast of a half the fit in the norm takes 7 iterations against the Laplacian’s 9, a small advantage. At a contrast of four they tie at 50. At six, the fit in the norm takes 123 and the Laplacian 109, so the separable fit is now worse than a constant. On the ridge it is worse throughout, by about a quarter at contrast one, and by a factor of 2.5 at six. So a structured preconditioner is a long way from a free gain, and something is needed to say when it pays.

The share does not say

The iterations of a separable preconditioner fitted in the Frobenius norm beside the share of the coefficient's norm in its first singular value, at six contrasts, for a bump and a ridgea bump in the middle: share 0.996, 7 iterations; share 0.982, 9 iterations; share 0.954, 17 iterations; share 0.971, 29 iterations; share 0.990, 50 iterations; share 0.999, 123 iterations. a ridge along the diagonal: share 0.967, 10 iterations; share 0.861, 16 iterations; share 0.559, 30 iterations; share 0.354, 55 iterations; share 0.254, 100 iterations; share 0.175, 308 iterations.110100a bump in the middlecontrast 0.5, share 0.9967contrast 1, share 0.9829contrast 2, share 0.95417contrast 3, share 0.97129contrast 4, share 0.99050contrast 6, share 0.999123a ridge along the diagonalcontrast 0.5, share 0.96710contrast 1, share 0.86116contrast 2, share 0.55930contrast 3, share 0.35455contrast 4, share 0.254100contrast 6, share 0.175308iterations, with a fit in the norm24 × 24 gridthe share is high where the fit is worst
Fig. 2 The iterations of a separable preconditioner fitted in the norm beside the share of the coefficient’s norm in its first singular value, at six contrasts, for a bump and a ridge.

The obvious candidate is the first singular value’s share of the coefficient’s norm. On the ridge it behaves: as the contrast rises, the share falls from 0.97 to 0.17 and the iterations rise from 10 to 308. On the bump it goes wrong in an instructive way. The share falls from 0.996 at contrast one-half to 0.954 at two, and then it rises, to 0.971, 0.990 and 0.999 at contrast six. Over that last stretch the iterations rise from 17 to 29, 50 and 123. So the highest share of all, 99.9 per cent, sits on the worst iteration count for this coefficient, and the share and the iterations move in opposite directions.

The reason is what a Frobenius norm is. At a contrast of six, the bump’s peak has a coefficient of about e6e^6, or 400, and everywhere else the coefficient is near one. A norm squared is dominated by the largest entries, and those lie on one small central region. Of course that region is nearly a rank-one matrix on its own, since a single peak is one. So the first singular triple fits the peak, the share is almost complete, and nothing has been said about how well the coefficient is fitted across the rest of the domain, where the entries are a four-hundredth the size.

What a preconditioner actually reads

A preconditioner does not read a norm. For two operators built from coefficients aa and a~\tilde a on the same stencil, the quadratic forms are sums of aa or a~\tilde a times squared differences, cell by cell. So the ratio of the two forms is bounded by the largest and smallest values of a/a~a/\tilde a. That gives κ≤max⁡(a/a~)/min⁡(a/a~)\kappa \le \max(a/\tilde a)/\min(a/\tilde a), whatever the grid. This is a very old bound, and it says a preconditioner’s quality is a pointwise ratio, measured uniformly across the domain, with no weight given to where the coefficient is large.

The coefficient over its separable fit at every point of the grid, for a bump at contrast six, with the fit made in the Frobenius norm and in the logarithmThe coefficient over the fit in the norm runs from 0.71 to 166.92, and over the fit in the logarithm from 0.26 to 10.12.the fit in the normthe fit in the logarithmwithin 1.4within 3within 10within 30beyondcontrast 6 · 24 × 24 · pointwise ratiothe norm fits the peak and loses the rest
Fig. 3 The coefficient over its separable fit at every point of the grid, for a bump at contrast six, with the fit made in the Frobenius norm and in the logarithm.

The picture shows what the norm’s fit has done. In the middle cross, where the peak is, it is right to within a factor of 1.4. In the corners of the domain, where the coefficient is about one and nobody cared in the norm, the coefficient is 167 times the fit. Its smallest ratio is 0.71, so the spread is 240. A preconditioner with those numbers is doing nothing useful in the outer part of the domain, and that part of the domain holds most of the unknowns.

That suggests the repair. If the misfit that matters is a ratio, then the fit should be made where ratios add, in the logarithm. So log⁡a≈f(x)+g(y)\log a \approx f(x) + g(y), by least squares, which is simply double centring of the grid values of log⁡a\log a: take row means and column means and subtract the grand mean. This costs n2n^2 additions and it uses no singular value at all. Its fit to the same bump is right within a factor of 3 almost everywhere, and over the whole grid the ratio runs from 0.26 to 10.1, a spread of 39, where the norm’s fit had 240.

The effect on the iterations appears in the first figure. At contrast six on the bump the fit in the logarithm takes 50 iterations, against 123 in the norm and 109 for the Laplacian. On a truly separable coefficient the two fits are the same, of course, as the logarithm of a product is exactly a sum. And on the ridge the logarithm’s fit is ahead of the norm’s too, 205 against 308 at six.

One number for all of it

Iterations against the square root of the largest over the smallest pointwise ratio of the coefficient to its fit, for two coefficients and two fits, each at six contrastsbump, fit in the norm: 7 at 1.1, 9 at 1.3, 17 at 1.9, 29 at 3.3, 50 at 5.5, 123 at 15.4; bump, in the logarithm: 8 at 1.2, 10 at 1.4, 16 at 1.8, 22 at 2.5, 30 at 3.4, 50 at 6.3; ridge, in the norm: 10 at 1.4, 16 at 1.9, 30 at 3.8, 55 at 8.0, 100 at 17.4, 308 at 79.3; ridge, in the logarithm: 10 at 1.4, 15 at 1.8, 28 at 3.4, 48 at 6.2, 80 at 11.4, 205 at 38.6.110¹10²110¹10²root of the pointwise ratio's spreaditerationsbump, fit in the normbump, in the logarithmridge, in the normridge, in the logarithmthe spread bounds κ, on any gridthe number the preconditioner reads
Fig. 4 Iterations against the square root of the largest over the smallest pointwise ratio of the coefficient to its fit, for two coefficients and two fits, each at six contrasts.

The bound gives κ\kappa, and conjugate gradients’ iterations should go as its square root. Against the root of the spread of the pointwise ratio, four separate curves, for two coefficients with two fits at six contrasts each, fall on very nearly one line. The correlation in the logarithm is above 0.95. A spread of four gives about 17 iterations, a spread of forty about 50, and a spread of 1,500 about 200, on whichever curve reaches them. The slope is a little below one in the log-log plot, since the bound is not attained on all of the spectrum.

So that spread is what the singular share was meant to be. It costs a single pass over the coefficient’s grid values, needing no iteration, and it can be read before any factorisation is done. A code holding a coefficient and a candidate fit can compute it in n2n^2 operations and say roughly what the iteration count will be, and that includes saying that it should not use this fit at all. Changing the condition number on purpose makes the general case for preconditioning in terms of a spectrum. Here the spectrum’s spread has a closed form from the coefficient alone.

Iterations against the number of grid points a side at contrast four, for a separable fit on three coefficients and a scaled Laplacian on oneseparable, fit: 13, 12, 10, 9; bump, fit in the logarithm: 26, 30, 31, 33; ridge, fit in the logarithm: 67, 80, 88, 98; bump, scaled Laplacian: 39, 50, 58, 67 at 16, 24, 32, 48 points a side.1624324048020406080100120points a sideiterationsseparable, fitbump, fit in the logarithmridge, fit in the logarithmbump, scaled Laplaciancontrast 4 · tolerance 10⁻⁸a spectrally equivalent operator is grid-free
Fig. 5 Iterations against the number of grid points a side at contrast four, for a separable fit on three coefficients and a scaled Laplacian on one.

The bound also says the count should not depend on the grid, because a pointwise ratio does not. That holds for the most part. From 16 to 48 points a side, at a contrast of four, the fit in the logarithm takes 26, 30, 31 and 33 iterations on the bump, nearly flat. The separable case’s mismatch falls with refinement, so it takes 13, 12, 10 and 9. The ridge rises from 67 to 98, slowly, and so does the scaled Laplacian on the bump, from 39 to 67, because with a coarser fit less of the operator’s variation is captured as the sharp features become better resolved. A pointwise ratio bound is a statement about a limit in which all features are resolved, and a preconditioner with a smaller spread than its bound would suggest can lose that slack as the grid improves.

The norm that chose the fit

It is worth asking why the Frobenius norm is the reflex here, since the reasoning is not specific to this problem. A Frobenius-nearest structured approximation has a closed form, it is the projection onto a linear or nearly linear set, and its error is easy to report. That same reflex gives the optimal circulant of the circulant the problem did not contain, the nearest circulant to a Toeplitz matrix in the Frobenius norm, which works very well there. It works because a Toeplitz matrix’s entries are not spread over many decades, so a norm reads all of them. A coefficient that varies over two or three decades is a matrix for which a norm reads only the top decade, and the same formula then has a different meaning.

So nothing is wrong with the singular value decomposition. It has answered the question it was asked, with an optimal result, which is the fit that loses the least squared coefficient. That is simply not the question a preconditioner poses. What is needed is the fit that loses the least in the worst ratio, and that is a problem in the sup norm of the logarithm, for which double centring is a good cheap proxy rather than an exact answer. A sharper solution by alternating minimisation over the sup norm might improve on these counts by a modest amount. Since the iterations go as the root of the spread, a factor of two in spread would save about a third of the iterations, and the double-centred fit has already been obtained for n2n^2 additions.

A similar distinction turns up in how much direction there was to lose, where an operator with a strong direction can be fitted in a way that captures most of its norm and none of what makes it hard. In both cases a smaller number in the obvious measure conceals a much larger number in the one the iteration reads. The practice these results argue for is the same: state what the iteration reads, and measure the approximation in that.

When a constant is better

The last stop on the dial matters as much as the first. A ridge along the diagonal has no separable part. No function of xx times a function of yy can make a line along x=yx = y. Every fit is forced to place its peak as a compromise, a cross centred on the line, and its fit is then worse than having no opinion. At contrast six the scaled Laplacian takes 122 iterations, the fit in the logarithm 205, and the fit in the norm 308.

The spread says so in advance, and on the ridge it is what a person would need to see. A constant coefficient has a pointwise spread of ec range(g)e^{c\,\mathrm{range}(g)}, about 400 at contrast six. The logarithm’s fit has a spread of 1,500. So on a ridge the separable fit has actually increased the spread over what a constant gives it, and this is possible because the fit’s own variation, in directions the coefficient does not have, adds to the misfit elsewhere. That is the same result as the first figure on this page, read from the coefficient alone.

What this costs, and where it pays

Multiplications to reach the tolerance at contrast four, by route, on three coefficients, on a 24-by-24 grid, counting the fit's setupseparable, a product of two functions: no preconditioner, 2000 iterations iterations, 5.8e+6, scaled Laplacian, 2000 iterations, 1.2e+8, fit in the logarithm, 12 iterations, 9.7e+5; a ridge along the diagonal: no preconditioner, 335 iterations iterations, 9.6e+5, scaled Laplacian, 59 iterations, 3.4e+6, fit in the logarithm, 80 iterations, 4.9e+6; a bump in the middle: no preconditioner, 241 iterations iterations, 6.9e+5, scaled Laplacian, 50 iterations, 2.9e+6, fit in the logarithm, 30 iterations, 2.0e+6.10⁵10⁶10⁷10⁸separable, a product of two functionsno preconditioner, 2000 iterationsscaled Laplacian, 2000fit in the logarithm, 12a ridge along the diagonalno preconditioner, 335 iterationsscaled Laplacian, 59fit in the logarithm, 80a bump in the middleno preconditioner, 241 iterationsscaled Laplacian, 50fit in the logarithm, 30multiplicationscounted, on a dense transformthe transforms are the price of the fit
Fig. 6 Multiplications to reach the tolerance at contrast four, by route, on three coefficients, on a 24-by-24 grid, counting the fit’s setup.

The count of iterations leaves out a large thing. A five-point product is 5n25n^2 multiplications. The preconditioner, in the dense form used here, is four one-dimensional transforms costing 4n34n^3. So one preconditioned iteration costs about twenty times one plain iteration on this grid. Counted in multiplications at contrast four on a 24-by-24 grid, the bump costs 7⋅1057 \cdot 10^5 by plain conjugate gradients, 2.0⋅1062.0 \cdot 10^6 with the logarithm’s fit and 2.9⋅1062.9 \cdot 10^6 with the scaled Laplacian. The ridge costs 9.6⋅1059.6 \cdot 10^5, 4.9⋅1064.9 \cdot 10^6 and 3.4⋅1063.4 \cdot 10^6. So on those two coefficients no preconditioner wins at this size and on this count, because a dense transform is not cheap and 241 plain iterations are not many.

The separable coefficient is the exception: plain conjugate gradients does not converge in 2,000 iterations, a scaled Laplacian costs 10810^8 and does not converge either, and the fit costs 10610^6. That is what the structure is for. On a variable coefficient with little contrast, on a small grid, it is not needed at all. A variable-coefficient operator with an order of magnitude more points in each direction, where a plain iteration count grows with the grid and the preconditioned one does not, is where the fit should come into its own, and the crossing has not been measured here. A fast transform for constant coefficients, which an index that is a pair relies on, would cut the Laplacian’s apply far below the dense count, and no such transform exists for a general p(x)p(x), so a one-dimensional eigendecomposition must be used and its transform stays dense.

There is also a fit that was not tried. A rank-two separable approximation, p1(x)q1(y)+p2(x)q2(y)p_1(x)q_1(y) + p_2(x)q_2(y), is the next step in the sequence, and it no longer has a fast solver, since two such products are not simultaneously diagonalisable. So the rank-one fit sits at a real boundary. The rest of the singular values describe structure that a fast solver cannot use. Past this boundary lies what multigrid does, at a cost that does not depend on the coefficient’s structure and is proportional to the size.

What was left out

The grid is uniform and square and the stencil simple, in two dimensions. The bound is the same in any number of dimensions, and the fit generalises by centring along each index in turn, but nothing has been measured beyond two. Only three families are measured here, and no coefficient with a jump is among them. A discontinuous coefficient is the common hard case in practice, and there a smooth fit in the logarithm would have to compromise across the jump, with what result is not known from these numbers. Its boundary conditions are simple Dirichlet conditions on all sides. And a single random right-hand side is used, on a preconditioned count that is not sensitive to it.

Still open: a jump, three dimensions, and a rank that has a solver

A coefficient with a jump. An interface with a factor of 10410^4 across it, placed along a line parallel to one axis, is exactly separable, and one placed along a diagonal is not. The prediction with a sign is that on the axis-aligned jump the logarithm’s fit takes under 20 iterations at every grid, and on the diagonal jump it takes more than a constant does by a factor of at least two, since its spread is then larger than the jump itself, the same result as on the ridge in a sharper form.

Three dimensions. Centring along three indices costs n3n^3 additions and the fast solver three transforms. The prediction is that a bump at the same contrast in three dimensions has a pointwise spread that is the square of its two-dimensional one, in the logarithm’s fit, and that the iterations therefore rise by about the same factor as the root, so that the number of axes makes a fit’s advantage steadily worse on a non-separable coefficient, and not better as the cost arithmetic of five indices might suggest.

What links here

Computed from the collection, not written here: the essays that point at this one.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Discrete laplacianKronecker productKronecker sumModel problemPreconditioningSeparability