unique Interface

public interface unique

The generic subroutine interface implementing the UNIQUE algorithm to compute the distinct elements of a rank-1 array.

The output array either preserves the order of first occurrence or contains the distinct elements in sorted order, depending on the value of the SORTED_OUTPUT argument. SORTED_OUTPUT is .false. by default. The SORTED_OUTPUT argument is not available for complex overloads.

For real arrays, an optional TOLERANCE argument may be supplied when SORTED_OUTPUT is .true.. Two values whose absolute difference is less than or equal to TOLERANCE are considered equal.

For complex arrays, only the unsorted implementation is available. The distinct elements are returned in the order of their first occurrence.


Subroutines

private module subroutine cdp_unique(array, output)

call cdp_unique(array, output[, sorted_output]) stores the distinct elements of the input array of type complex(dp) in output.

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(in) :: array(:)
complex(kind=dp), intent(inout), allocatable :: output(:)

private module subroutine char_unique(array, output, sorted_output)

call char_unique(array, output[, sorted_output]) stores the distinct elements of the input array of type character(len=*) in output.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: array(:)
character(len=len), intent(inout), allocatable :: output(:)
logical, intent(in), optional :: sorted_output

private module subroutine csp_unique(array, output)

call csp_unique(array, output[, sorted_output]) stores the distinct elements of the input array of type complex(sp) in output.

Arguments

Type IntentOptional Attributes Name
complex(kind=sp), intent(in) :: array(:)
complex(kind=sp), intent(inout), allocatable :: output(:)

private module subroutine dp_unique(array, output, sorted_output, tolerance)

call dp_unique(array, output[, sorted_output, tolerance]) stores the distinct elements of the input array of type real(dp) in output.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: array(:)
real(kind=dp), intent(inout), allocatable :: output(:)
logical, intent(in), optional :: sorted_output
real(kind=dp), intent(in), optional :: tolerance

private module subroutine int16_unique(array, output, sorted_output)

call int16_unique(array, output[, sorted_output]) stores the distinct elements of the input array of type integer(int16) in output.

Arguments

Type IntentOptional Attributes Name
integer(kind=int16), intent(in) :: array(:)
integer(kind=int16), intent(inout), allocatable :: output(:)
logical, intent(in), optional :: sorted_output

private module subroutine int32_unique(array, output, sorted_output)

call int32_unique(array, output[, sorted_output]) stores the distinct elements of the input array of type integer(int32) in output.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: array(:)
integer(kind=int32), intent(inout), allocatable :: output(:)
logical, intent(in), optional :: sorted_output

private module subroutine int64_unique(array, output, sorted_output)

call int64_unique(array, output[, sorted_output]) stores the distinct elements of the input array of type integer(int64) in output.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: array(:)
integer(kind=int64), intent(inout), allocatable :: output(:)
logical, intent(in), optional :: sorted_output

private module subroutine int8_unique(array, output, sorted_output)

call int8_unique(array, output[, sorted_output]) stores the distinct elements of the input array of type integer(int8) in output.

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: array(:)
integer(kind=int8), intent(inout), allocatable :: output(:)
logical, intent(in), optional :: sorted_output

private module subroutine sp_unique(array, output, sorted_output, tolerance)

call sp_unique(array, output[, sorted_output, tolerance]) stores the distinct elements of the input array of type real(sp) in output.

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in) :: array(:)
real(kind=sp), intent(inout), allocatable :: output(:)
logical, intent(in), optional :: sorted_output
real(kind=sp), intent(in), optional :: tolerance

private module subroutine string_type_unique(array, output, sorted_output)

call string_type_unique(array, output[, sorted_output]) stores the distinct elements of the input array of type type(string_type) in output.

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: array(:)
type(string_type), intent(inout), allocatable :: output(:)
logical, intent(in), optional :: sorted_output