sort_row_less Interface

interface
public module function sort_row_less(keys, a, b) result(less)

Arguments

Type IntentOptional Attributes Name
type(sort_key_buf), intent(in) :: keys(:)

the keys, in precedence order.

integer(kind=int64), intent(in) :: a

first row, 1-based.

integer(kind=int64), intent(in) :: b

second row, 1-based.

Return Value logical

.true. when a sorts before b.

Description

THE sort comparator: every key in precedence order, then the row index as tiebreaker.

The index tiebreaker makes this a TOTAL ORDER in which no two distinct rows compare equal, which is what makes an unstable sort produce the stable answer, makes nth_element deterministic, and makes a parallel result bit-identical to a serial one by construction. Keep it beside sort_keys_compare -- feature_risks.md Risk-34.