pf_merge Interface

public interface pf_merge

Merges two ALREADY-SORTED arrays into one sorted array, in O(size(a) + size(b)) rather than the O(n log n) of sorting their concatenation.

descending/nulls_first must match the order a and b are actually in -- they select the comparison, exactly as in the searches. Both inputs are checked for sortedness unless assume_sorted=.true..

Supply is_valid_a/is_valid_b whenever either input has nulls. A sorted array containing nulls is what pf_sort(..., is_valid=) produces, and a merge that is not told which elements are null compares them as ordinary values and interleaves them into the middle of the result. The precondition cannot be checked, either: a null's stored value is indistinguishable from a real one without the mask.

merged_valid reports the result's validity and is ALWAYS allocated when asked for, all .true. when neither input mask was supplied. Ties take from a first, so the result matches pf_sort of the concatenation element for element.


Module Procedures

private interface merge_i32()

Arguments

None

private interface merge_i64()

Arguments

None

private interface merge_f32()

Arguments

None

private interface merge_f64()

Arguments

None

private interface merge_bool()

Arguments

None

private interface merge_chr()

Arguments

None

private interface merge_date()

Arguments

None

private interface merge_time()

Arguments

None

private interface merge_ts()

Arguments

None