unique Interface
public interface unique
Return stable unique integer or real values in first-occurrence order.
Module Procedures
private pure function unique_integer(vec) result(output)
Return distinct integer values in stable first-occurrence order.
Equality is exact. The implementation performs comparisons and uses temporary storage, so it is intended for short metadata and connectivity vectors rather than large unsorted datasets.
Arguments
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in), | contiguous | :: | vec(:) |
Input sequence; it is not sorted or modified. |
Return Value integer, allocatable, (:)
Stable sequence of distinct values.
private pure function unique_real(vec) result(output)
Return numerically distinct real values in stable first-occurrence order.
Two entries are treated as equal when their absolute difference is at
most 32*epsilon(1.0_rk)*maxval(abs(vec)). The comparison is therefore
scale-relative but not transitive clustering. Complexity is .
Arguments
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rk), | intent(in), | contiguous | :: | vec(:) |
Input sequence; an empty input returns an empty result. |
Return Value real(kind=rk), allocatable, (:)
Stable sequence of tolerance-distinct values.