- The paper presents an O(p n log² n)-time, O(n log n)-space algorithm for computing every partial p-Wasserstein cost on the line when p is a finite integer, improving the previous quadratic-time bound.
- The method combines compact balanced-interval representations with an FFT-preprocessed range tree that answers interval-matching cost queries in O(log n) time, avoiding explicit storage of the Θ(n²) matching edges.
- The paper proves a conditional near-quadratic barrier for p=∞ and stronger hardness results for two-interval queries, while experiments show orders-of-magnitude speedups over prior methods on large synthetic datasets.
Problem and context
The p-Wasserstein distance between two probability measures is the pth root of the minimum cost of transporting one measure into the other, where moving mass δ between points at distance d costs δdp. For discrete distributions supported on n points with uniform mass, the optimal transport profile (OT-profile) maps each α∈[0,1] to the minimum cost of a plan transporting mass α; equivalently, it is the sequence C1,…,Cn, where Ck is the minimum cost of any p0-matching between the two point sets. OT-profiles are used in noise filtering, positive-unlabeled learning, and the robust partial Wasserstein metric.
Full optimal transport on the line is trivial: after sorting, matching in order along the line is optimal for all p1. The partial case is not. Chapel and Tavenard [ICLR'25] showed that for p2 the entire OT-profile on the line can be computed in p3 time; their approach exploits the metric structure of the cost. For every p4, however, their method requires p5 time. The quadratic barrier has a structural cause: for p6, consecutive optimal partial matchings share edges (only p7 distinct edges appear across all p8), whereas for p9 convexity makes each optimal δ0-matching unique, so that δ1 and δ2 share no edges and the sequence of matchings contains δ3 distinct edges. Any algorithm that explicitly materializes all partial matchings therefore incurs quadratic work.
Main result
The paper resolves this question for all finite integer δ4: given point sets δ5 of size δ6, the δ7-partial δ8-Wasserstein distances for all δ9 are computable in d0 time using d1 space. This matches, up to a logarithmic factor, the complexity of full one-dimensional transport, and improves the prior state of the art from d2 to near-linear for every finite d3.
The algorithm follows the successive-shortest-path structure of the Hungarian algorithm specialized to the line, as in Chapel–Tavenard, but replaces the quadratic interval-cost computation with a new data structure. Two ingredients matter:
- Compact interval representation. A minimum-cost d4-matching is represented by a set of at most d5 disjoint balanced intervals (intervals containing equal numbers of red and blue points). Although the union of all partial matchings contains d6 edges, this representation uses only d7 space, and the minimum-cost d8-matching differs from the d9-matching by modifying only a constant number of intervals.
- Balanced-interval queries. Identifying which intervals to modify reduces to evaluating the minimum matching cost inside balanced intervals. The paper's main technical contribution is a data structure built in δdp0 time and δdp1 space that answers such queries in δdp2 time.
The net-cost of an augmenting step then takes a simple closed form: for an adjacent free pair δdp3, it equals δdp4 if no stored interval lies inside δdp5, and otherwise δdp6 for the unique stored interval δdp7 inside δdp8. Each iteration performs a constant number of heap operations and δdp9 queries, so the n0 iterations take n1 total; preprocessing dominates.
The FFT-based range tree
Inside any balanced interval, the optimal matching pairs points in order, so if the leftmost red point has index n2 and the leftmost blue point index n3, every matched pair has shift n4. The data structure is a binary range tree over the merged sorted order of all n5 points. Each node n6 stores, for every relevant shift n7, three quantities: the total cost of shift-n8 pairs crossing from its left child to its right child, symmetrically from right to left, and the total cost n9 of all shift-α∈[0,1]0 pairs contained in α∈[0,1]1. Since relevant shifts number α∈[0,1]2 per node, total space is α∈[0,1]3.
A query determines the shift α∈[0,1]4 of the input interval from its leftmost red and blue points, then aggregates precomputed values over the α∈[0,1]5 maximal nodes covering the interval. Correctness rests on a non-obvious decomposability property: when a node's children both intersect the query interval, every shift-α∈[0,1]6 pair crossing the node's midline lies entirely within the query interval — a consequence of balancedness combined with the order structure. Matching costs are not decomposable in general, so this property is what makes the aggregation valid.
Preprocessing avoids the naive α∈[0,1]7 enumeration of shift values via FFT: since all red points in a left child lie left of all blue points in the right child, cross-term costs expand through the binomial identity α∈[0,1]8, and each family of sums is a coefficient of a polynomial product computable by convolution. One FFT per binomial term per node yields α∈[0,1]9 per node and α0 overall; the α1 values follow bottom-up in α2.
A practical caveat: the running time carries a factor α3, and the construction relies on expanding α4, so the approach is specific to integer α5; nothing in the upper bound extends to non-integer or infinite α6.
Implementation and experiments
The authors provide an open-source C++ implementation (FFTHungarian) that computes interval costs naively below a threshold of 2048 points and queries the data structure above it. Against PAWL, the optimized numba-based implementation of Chapel–Tavenard, on synthetic instances (α7) spanning normal distributions with differing means or standard deviations and unimodal-versus-bimodal mixtures, FFTHungarian is never substantially slower and becomes orders of magnitude faster once α8 and the distributions differ. Notably, even a 10% difference in mean or standard deviation drives PAWL toward its quadratic worst case while FFTHungarian scales near-linearly. The experimental regime deliberately favors the baseline (substantial distributional overlap), strengthening the comparison; the evaluation covers synthetic data only, and hardware was a single laptop-class machine.
Conditional lower bound for α9
For C1,…,Cn0, the picture changes sharply. Assuming the C1,…,Cn1-Convolution Conjecture, no algorithm computes all C1,…,Cn2-partial C1,…,Cn3-Wasserstein matching costs for C1,…,Cn4 integer points in C1,…,Cn5 in C1,…,Cn6 time for any C1,…,Cn7. The reduction first maps arbitrary C1,…,Cn8-convolution instances to monotone C1,…,Cn9-convolution instances via the transformation Ck0, Ck1, then observes that for increasing Ck2 and decreasing Ck3 with Ck4, the Ck5-partial Ck6-Wasserstein cost equals exactly the Ck7-convolution entry Ck8.
This yields a clean separation: full Ck9-Wasserstein transport admits subquadratic exact algorithms even in two dimensions, whereas computing the entire partial profile is conditionally quadratic-hard already on the line. The lower bound also indicates that the dependence on p00 cannot be removed by refining the upper-bound techniques, since the same framework applied at p01 would require p02-convolutions.
Two further lower bounds address a strictly more general data-structure problem, the Two Intervals Matching Problem, where queries specify separate intervals for each color. Via a gadget reduction from the Hamming Distance Oracle problem (encoding bits as four-point gadgets whose Wasserstein distances distinguish equal from unequal gadgets), the paper shows: (i) unless the Combinatorial Matrix Multiplication Conjecture fails, no combinatorial data structure achieves p03 for any p04; and (ii) unconditionally up to the matrix multiplication exponent, p05. The contrast with the single-interval setting — where near-linear preprocessing and p06 queries are achieved — shows that allowing two independent query intervals provably increases the problem's difficulty.
Limitations and open questions
Several restrictions bound the applicability of the results. The upper bound requires p07 to be a positive integer, since both the running-time dependence and the binomial-expansion technique presuppose it; whether near-linear algorithms exist for fractional p08 remains open. The lower bound for p09 is conditional on the p10-Convolution Conjecture, and the Two Intervals bounds rest on matrix-multiplication conjectures, so unconditional hardness is not established anywhere in the paper. The experimental validation is confined to synthetic one-dimensional distributions with substantial overlap; behavior on real data or on distributions with little overlap is not reported. Finally, the paper leaves open whether the extra p11 factor can be removed — the authors note that an attempted unpacking of the FFT did not yield an improvement — and whether the imbalanced (unbalanced-mass) variant admits comparable guarantees; a sketch of a persistent-tree approach for imbalanced single-interval queries appears only in preliminary form without complete proofs.
Conclusion
This paper establishes that the entire OT-profile under the p12-Wasserstein cost on the line is computable in p13 time for every finite integer p14, removing the quadratic barrier that previously applied for all p15. The key enabler is an FFT-preprocessed range tree supporting balanced-interval matching queries in logarithmic time, exploiting a decomposability property special to balanced one-dimensional intervals. Together with the conditional quadratic hardness at p16 and the stronger hardness for two-interval queries, the results delineate precisely where partial optimal transport on the line retains the computational simplicity of full transport and where it does not.