The order of the indices is not free
Worth reading first: The format that does not notice the dimension · An index that is a pair · A model that is a rational function.
The format that does not notice the dimension cut a tensor between its indices rather than across them. That gave ranks in place of , storage linear in the number of indices, and a family whose ranks are two everywhere by an addition formula. The digit that costs more than the tensor then found that the same format costs more than the array on small grids at modest tolerances, with its break-even at a rank of .
Both worked in the order the indices were written. The first essay did say why that matters, in one paragraph: “The index order is a choice and it is not free. The cuts are cuts of a list, so permuting the indices changes every rank.” It gave no measurement and moved on. The title remained, which implies something this page has to take back in part. The storage of a train is a property of a tensor and an ordering, and how much the ordering costs turns out to be enormous, cheap to fix, and larger the more digits are wanted.
Three tensors, one format
The tensors have eight indices and three points an index, so 6,561 entries, small enough to read every cut exactly. All ranks are numerical at a relative tolerance of .
One is four pairs with coupled members four positions apart: over the pairs , , , , with . It has no coupling at all except within a pair, and a pair’s own coupling has rank three on three points. Another is a chain of the same couplings joining the indices in a shuffled sequence, so that each index is coupled to two others. The third is a single function of the sum, , in which every index is coupled to every other in exactly the same way.
A cut’s rank is the rank of the unfolding between the indices on its left and those on its right. Rearrange the indices and the same tensor has different unfoldings. It is worth seeing that a cut’s rank depends on the set of indices to its left and not on their order within that set. So all orders of eight indices draw on at most 128 different unfoldings, and measuring a great many of them is cheap. That is the observation behind a contraction’s order too, where a tree’s cuts are a set of partitions and the same kind of bookkeeping applies.
In the order the tensor was written, the four pairs cross at the middle. The first cut separates one pair, the second two, the third three, and the fourth all four. So the ranks run 3, 9, 23, 50, 23, 9, 3: each crossing pair contributes its own rank, up to rounding, and these multiply. The full value of is cut to 50 by the tolerance. That train stores 8,322 numbers, which is more than the array’s 6,561.
Put each pair side by side, in the order 1, 5, 2, 6, 3, 7, 4, 8. The cuts then alternate between crossing one pair and crossing none. The ranks run 3, 1, 3, 1, 3, 1, 3, and the train stores 72 numbers. That is a ratio of 115 to one, for the same tensor at the same tolerance, with no approximation changed, and it is a transformation that costs one permutation of the axes at the moment the array is built.
Turn the dial to the chain and it repeats, with natural ranks up to 50 and a best order at three throughout, storing 180. Turn it to the function of the sum and the two lines lie on each other, at 3, 5, 5, 5, 5, 5, 3. That tensor treats all its indices alike, so any order is the same as any other, and 200 random orders all store exactly 408. So an order matters only as far as the tensor has a structure to arrange, and it is a measure of the structure as much as of the format.
A typical order is a bad one
Two hundred random orders of the pairs tensor run from 216 numbers to 8,322, with a median of 1,584. On the chain they run from 612 to 8,322, with a median of 4,596, where the best order stores 180. So a random order sits more than twenty times above the best on either, and none of the 200 random orders of the chain reaches the best at all. There are more than twenty thousand orders of eight indices once reversals are set aside, and only a few of them keep a chain’s neighbours adjacent. The natural order is not specially bad either: it sits at the same top value as about a quarter of the random draws.
There is an interesting shape in the sorted curves. They are staircases. Each step is one more crossing somewhere, and one crossing multiplies a stretch of ranks by up to three. So storage here falls in big jumps as a chain gets closer to being unbroken, and an order that is nearly right is much worse than one that is exactly right. That is a reason not to expect any local search to behave smoothly on this objective.
The digits are charged at every crossing
An earlier essay on what a train costs found the price of a digit flat, at about two-thirds of a rank per decade. On a well-ordered train that continues to hold. On a badly ordered one a digit is charged at each crossing, and crossings multiply.
In the best order, storage is 48 numbers at a tolerance of a hundredth and 72 at every tolerance from to . A pair on three points has only rank three to give. In the natural order, at those same tolerances, it is 240, 1,386, 4,140, 8,322, 11,880 and 13,950. So at a hundredth the ordering costs a factor of five, and at a factor of 194. Down to the bad order is still below the array’s own 6,561 entries, and at it is well past them. That is what makes this a problem for people who want accuracy in particular. A code running at three digits may not even notice its ordering is wrong, and the same code asked for twelve is paying two orders of magnitude for it.
The reading of the digit that costs more has to be taken with this in mind. Its “break-even rank of ”, in which a train costs more than the array, was on a tensor without any ordering question, the three-index reciprocal family. Past that family a train can exceed the array with no help from the grid or the tolerance, through ordering alone.
Weak coupling helps less than one might think. With each pair coupled by and falling from one to a thousandth, the natural order’s storage falls from 11,880 to 828, and the best order’s is 72 until the last, where it reaches 48. So couplings a thousand times weaker still leave a factor of 17. A coupling that can barely be seen in any single entry keeps its rank wherever the tolerance can read it, and crossing cuts multiply that up. It seems best to think of an order’s penalty as depending on how many digits the coupling has above the tolerance, which at is still about five.
A slice shows the order
An order this important needs some way of being found, and with a tensor this size one could simply try them. But the point of a train is that the array is too large to read. So the question is how little of the array shows which indices belong together.
Fix all indices at a base point except two, and read the slice that is left. Its second singular value over its first says how far those two indices are from separated, at that point. There are 28 pairs of eight indices and nine entries in each slice, or 252 entries in total, under a twentieth of the array, and that number grows only with the square of the dimension. For the four separated pairs the table is unambiguous: the true pairs read and every other entry is below . A greedy chain then starts at the strongest pair and extends from each end by the strongest remaining coupling.
It finds the best storage on all three tensors. On the pairs the chain it builds is 2, 6, 3, 7, 5, 1, 4, 8, which keeps each pair together and stores 72. On the shuffled chain it recovers the exact sequence, storing 180. On the sum it builds some arbitrary order, and that costs nothing since any order is equal there.
These tensors are built to make that easy, since each coupling is either present or exactly absent. Real tensors have couplings of many strengths, and one slice through one base point can be misleading if the coupling happens to vanish there. A table made from several base points is the natural protection and it costs only linearly more. But what the measurement does establish is a large gap between what one needs to read and what the mistake costs: a few hundred entries, against a train’s factor of 115.
Other routes exist in the literature, including a statistic based on mutual information used in density-matrix methods for quantum chemistry, where orbital ordering has been a major concern for decades, and it is the same question under another name. The same matrix, numbered twice is the hierarchical-format version, in which a permutation decides whether a block partition finds any low rank at all. The order decides the memory is the sparse version. Each format is sensitive to the numbering in the way its own cuts make it, and in a train that sensitivity is at its most severe, because the penalty multiplies across crossings rather than adding.
The summary across routes shows how much is available and how cheaply it can be had. On the pairs, the natural order stores 8,322 numbers, a random order 1,584 at the median, and a slice’s order and the best both 72. On the chain the four read 8,322, 4,596, 180 and 180. On the function of the sum all four read 408. The right-hand column has been reached by reading 252 entries and sorting 28 numbers. Compare that with the first of those columns, which is what a code gets for not asking, and which is the very thing the format was brought in to avoid: holding more numbers than the tensor has entries.
Set against other costs in a working code, this is an unusual one. Most of what gets measured in this subject is a factor of a few, or a digit or two, bought at some definite cost in operations. An index order that is wrong costs two orders of magnitude in memory, and with it in everything a train then does, because a contraction’s cost goes as a power of the ranks. A rank of 50 where 3 would do makes every core operation about times dearer, and it adds nothing whatever to the accuracy. Almost no decision in this field has so little to recommend the wrong answer. The curse of dimensionality is usually spoken of as a property of a function class, and here is a form of it that an assignment of labels can create or remove.
What the title should have said
A train’s storage is linear in the number of indices once the ranks are fixed. That is exactly true and it is what the first essay showed on a family, the sum of sines, which has rank two across every cut in every order. It holds no lesson about the ordering, because that family has none to get wrong. The format notices nothing about the dimension and a great deal about the order, and a tensor whose natural labelling happens to place coupled indices far apart has an exponential cost in the number of crossing pairs.
So a person with a physical model should ask which indices are coupled before building a train. In many models that is already known: a chain of nearest-neighbour interactions has an obvious order, and an array whose indices are time, then space, then parameter has a coupling structure one can state in advance. Writing indices down in the order that a data file happens to use is the case to avoid. And a code that cannot state it should read a few slices first, since the check is far cheaper than the mistake.
A Tucker decomposition does not have this problem, because it does not have a sequence of cuts: each index is cut from all the others. It pays with a core that is exponential in the dimension instead. A train trades that core for a sensitivity to order, which is a good trade only when the order is chosen with some care.
Where this measurement stops
Eight indices of three points each is the size that allows every cut to be read, and it is too small to show what happens at a dimension where the array cannot be stored. Three points also limit each coupling’s rank to three, as the first section noted. That is what sets the largest rank to 81, and more points would raise this and raise the penalty along with it. The couplings are one smooth function, and a chain of nearest-neighbour terms and a set of pairs are two clear cases out of a large space of possible structures. Most real structures will not be separable into exact pairs, or into any single neat pattern, and no test here shows how the greedy chain copes with a tensor whose couplings are all of comparable strength, or one with a coupling between three indices at once, which no two-index slice can see.
The ranks are found by Gram–Schmidt with column pivoting rather than by a full SVD, for speed, and this can differ from a singular-value count by a small amount near the tolerance. All of the storage counts on this page are the train that ranks imply, and no train was computed, so a train’s own truncation errors, which add up over its cuts, are not part of the comparison.
Still open: a three-way coupling, and a search that is not greedy
A coupling no pair can show. A term like with three separated indices is visible in each pair’s slice only weakly. The prediction with a sign is that on a tensor of two such triples, with a coupling strength set so that the pairwise slices read about , a greedy chain still places each triple together on eight draws in ten, and that a parity-like coupling, which has no two-index signal at all at the base point, defeats it entirely: the table is flat, the chain is arbitrary, and storage is at the random median.
Is the greedy order the best? The orders here were chosen by construction and then confirmed by a chain. The prediction is that an exhaustive search across all orders, which the cut memo makes affordable, finds nothing below 72 on the pairs and nothing below 180 on the chain, so that those are true minima, and that on a mixed tensor of two pairs and a four-index chain the greedy order is within a factor of two of the true least.
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.
- A nearest point that is not there — both name numerical rank, separability, truncated svd, unfolding
- A block nobody can call sparse — both name numerical rank, truncated svd
- A factorisation that is unique for once — both name truncated svd, unfolding
- A rank that is a number of digits — both name numerical rank, truncated svd
- A rank that is not a property of the tensor — both name numerical rank, unfolding
- An iterate that must be made smaller — both name curse of dimensionality, tensor train
Named objects
A flat tag is an object no other essay names yet.
Curse of dimensionalityNumerical rankSeparabilityTensor trainTruncated SVDUnfolding