sort_keys_compare Interface

interface
public module function sort_keys_compare(keys, a, b, nkeys) result(c)

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.

integer, intent(in) :: nkeys

leading keys taking part.

Return Value integer

-1, 0 or +1.

Description

The same ordering as sort_row_less, three-way and WITHOUT the index tiebreaker.

Everything that must recognise "these two rows are equal" -- binary search, run detection for pf_unique/pf_rank, merging, is_sorted -- needs this one, since under the tiebreaker no two rows ever are equal. Sorting is the only caller that must NOT use it. nkeys is how many LEADING keys take part, clamped to size(keys): run detection passes a prefix because "sort by field then magnitude, but group by field alone" is one pass.