sort_index Interface

public interface sort_index

The generic subroutine interface implementing the SORT_INDEX algorithm, based on the "Rust" sort algorithm found in slice.rs https://github.com/rust-lang/rust/blob/90eb44a5897c39e3dff9c7e48e3973671dcd9496/src/liballoc/slice.rs#L2159 but modified to return an array of indices that would provide a stable sort of the rank one ARRAY input. (Specification)

The indices by default correspond to a non-decreasing sort, but if the optional argument REVERSE is present with a value of .TRUE. the indices correspond to a non-increasing sort.


Contents


Subroutines

private module subroutine char_sort_index(array, index, work, iwork, reverse)

char_sort_index( array, index[, work, iwork, reverse] ) sorts an input ARRAY of type character(len=*) using a hybrid sort based on the 'Rust" sort algorithm found in slice.rs and returns the sorted ARRAY and an array INDEX of indices in the order that would sort the inputARRAY` in the desired direction.

Arguments

TypeIntentOptionalAttributesName
character(len=*), intent(inout) :: array(0:)
integer(kind=int_size), intent(out) :: index(0:)
character(len=len), intent(out), optional :: work(0:)
integer(kind=int_size), intent(out), optional :: iwork(0:)
logical, intent(in), optional :: reverse

private module subroutine dp_sort_index(array, index, work, iwork, reverse)

dp_sort_index( array, index[, work, iwork, reverse] ) sorts an input ARRAY of type real(dp) using a hybrid sort based on the 'Rust" sort algorithm found in slice.rs and returns the sorted ARRAY and an array INDEX of indices in the order that would sort the inputARRAY` in the desired direction.

Arguments

TypeIntentOptionalAttributesName
real(kind=dp), intent(inout) :: array(0:)
integer(kind=int_size), intent(out) :: index(0:)
real(kind=dp), intent(out), optional :: work(0:)
integer(kind=int_size), intent(out), optional :: iwork(0:)
logical, intent(in), optional :: reverse

private module subroutine int16_sort_index(array, index, work, iwork, reverse)

int16_sort_index( array, index[, work, iwork, reverse] ) sorts an input ARRAY of type integer(int16) using a hybrid sort based on the 'Rust" sort algorithm found in slice.rs and returns the sorted ARRAY and an array INDEX of indices in the order that would sort the inputARRAY` in the desired direction.

Arguments

TypeIntentOptionalAttributesName
integer(kind=int16), intent(inout) :: array(0:)
integer(kind=int_size), intent(out) :: index(0:)
integer(kind=int16), intent(out), optional :: work(0:)
integer(kind=int_size), intent(out), optional :: iwork(0:)
logical, intent(in), optional :: reverse

private module subroutine int32_sort_index(array, index, work, iwork, reverse)

int32_sort_index( array, index[, work, iwork, reverse] ) sorts an input ARRAY of type integer(int32) using a hybrid sort based on the 'Rust" sort algorithm found in slice.rs and returns the sorted ARRAY and an array INDEX of indices in the order that would sort the inputARRAY` in the desired direction.

Arguments

TypeIntentOptionalAttributesName
integer(kind=int32), intent(inout) :: array(0:)
integer(kind=int_size), intent(out) :: index(0:)
integer(kind=int32), intent(out), optional :: work(0:)
integer(kind=int_size), intent(out), optional :: iwork(0:)
logical, intent(in), optional :: reverse

private module subroutine int64_sort_index(array, index, work, iwork, reverse)

int64_sort_index( array, index[, work, iwork, reverse] ) sorts an input ARRAY of type integer(int64) using a hybrid sort based on the 'Rust" sort algorithm found in slice.rs and returns the sorted ARRAY and an array INDEX of indices in the order that would sort the inputARRAY` in the desired direction.

Arguments

TypeIntentOptionalAttributesName
integer(kind=int64), intent(inout) :: array(0:)
integer(kind=int_size), intent(out) :: index(0:)
integer(kind=int64), intent(out), optional :: work(0:)
integer(kind=int_size), intent(out), optional :: iwork(0:)
logical, intent(in), optional :: reverse

private module subroutine int8_sort_index(array, index, work, iwork, reverse)

int8_sort_index( array, index[, work, iwork, reverse] ) sorts an input ARRAY of type integer(int8) using a hybrid sort based on the 'Rust" sort algorithm found in slice.rs and returns the sorted ARRAY and an array INDEX of indices in the order that would sort the inputARRAY` in the desired direction.

Arguments

TypeIntentOptionalAttributesName
integer(kind=int8), intent(inout) :: array(0:)
integer(kind=int_size), intent(out) :: index(0:)
integer(kind=int8), intent(out), optional :: work(0:)
integer(kind=int_size), intent(out), optional :: iwork(0:)
logical, intent(in), optional :: reverse

private module subroutine sp_sort_index(array, index, work, iwork, reverse)

sp_sort_index( array, index[, work, iwork, reverse] ) sorts an input ARRAY of type real(sp) using a hybrid sort based on the 'Rust" sort algorithm found in slice.rs and returns the sorted ARRAY and an array INDEX of indices in the order that would sort the inputARRAY` in the desired direction.

Arguments

TypeIntentOptionalAttributesName
real(kind=sp), intent(inout) :: array(0:)
integer(kind=int_size), intent(out) :: index(0:)
real(kind=sp), intent(out), optional :: work(0:)
integer(kind=int_size), intent(out), optional :: iwork(0:)
logical, intent(in), optional :: reverse

private module subroutine string_type_sort_index(array, index, work, iwork, reverse)

string_type_sort_index( array, index[, work, iwork, reverse] ) sorts an input ARRAY of type type(string_type) using a hybrid sort based on the 'Rust" sort algorithm found in slice.rs and returns the sorted ARRAY and an array INDEX of indices in the order that would sort the inputARRAY` in the desired direction.

Arguments

TypeIntentOptionalAttributesName
type(string_type), intent(inout) :: array(0:)
integer(kind=int_size), intent(out) :: index(0:)
type(string_type), intent(out), optional :: work(0:)
integer(kind=int_size), intent(out), optional :: iwork(0:)
logical, intent(in), optional :: reverse