| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(sort_key_buf), | intent(in) | :: | keys(:) |
the keys, in precedence order. |
||
| integer(kind=int64), | intent(in) | :: | n |
rows. |
||
| integer(kind=int64), | intent(in) | :: | group_keys |
leading keys that decide a tie. |
||
| integer(kind=int64), | intent(inout) | :: | perm(:) |
receives |
||
| integer(kind=c_int8_t), | intent(inout) | :: | tie(:) |
1 where a row ties with its predecessor. |
Sorts, then flags where the runs of EQUAL rows begin. tie(1) is always 0.
group_keys is how many LEADING keys decide a tie; the sort itself always uses every
key. That asymmetry is what produces "grouped by field, ordered within group".