On the real line the Kantorovich–Rubinstein dual of the \(p = 1\) transport problem, \(W_1(p, q) = \sup_{Lip(f) \le 1} (\int f dp - \int f dq)\), has the closed form \(W_1(p, q) = \int |F_p(x) - F_q(x)| dx\): the transport cost is the area between the two cumulative distribution functions. No linear programme is needed, which is why this function has no solver.
Details
Two input conventions are accepted. With support given,
p and q are probability masses on that common grid, both
normalised to sum to one; the CDFs are then step functions constant
between consecutive support points, so
\(W_1 = \sum_i |P_i - Q_i| (s_{i+1} - s_i)\) with \(P\), \(Q\)
the cumulative masses. With support omitted, p and
q are raw samples and the empirical distributions are compared
by the same closed form on the pooled order statistics.
Mirrors morie.fn.wassdt on the Python side.
