Function smawk::smawk_row_minima[][src]

pub fn smawk_row_minima<T: Ord + Copy>(matrix: &Array2<T>) -> Vec<usize>

Compute row minima in O(m + n) time.

This implements the SMAWK algorithm for finding row minima in a totally monotone matrix.

The SMAWK algorithm is from Agarwal, Klawe, Moran, Shor, and Wilbur, Geometric applications of a matrix searching algorithm, Algorithmica 2, pp. 195-208 (1987) and the code here is a translation David Eppstein's Python code.

Running time on an mn matrix: O(m + n).

Panics

It is an error to call this on a matrix with zero columns.