Row Minima For Free

SMAWK. What does it compute, and at what cost?

A

All row minima of a totally monotone r×cr \times c matrix accessed implicitly through a cost function, in O((r+c)log⁡(r+c))O((r+c)\log(r+c)) evaluations, which is nlog⁡nn \log n for a square matrix. Divide and conquer on rows, solving the middle row first, is what achieves it.

B

All row minima of a totally monotone r×cr \times c matrix accessed implicitly through a cost function, in O(c(1+log⁡(r/c)))O(c(1 + \log(r/c))) evaluations, which is linear for a square matrix. Total monotonicity means no 2×22 \times 2 submatrix has its two row minima on opposite diagonal corners.

C

All row minima of an arbitrary r×cr \times c matrix accessed implicitly through a cost function, in O(rc/log⁡c)O(rc/\log c) evaluations, which is sublinear in the matrix size. Word-parallel comparison of packed rows is what removes the logarithmic factor.

D

The single global minimum of a totally monotone r×cr \times c matrix accessed implicitly through a cost function, in O(log⁡rlog⁡c)O(\log r \log c) evaluations, which is logarithmic for a square matrix. Total monotonicity means every row's minimum sits weakly right of the row above.