int32_sort_index_low Module Subroutine

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

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: array(0:)
integer(kind=int_index_low), intent(out) :: index(0:)
integer(kind=int32), intent(out), optional :: work(0:)
integer(kind=int_index_low), intent(out), optional :: iwork(0:)
logical, intent(in), optional :: reverse

Calls

proc~~int32_sort_index_low~~CallsGraph proc~int32_sort_index_low int32_sort_index_low interface~pic_optional pic_optional proc~int32_sort_index_low->interface~pic_optional none~merge_sort~6 merge_sort proc~int32_sort_index_low->none~merge_sort~6 none~reverse_segment~6 reverse_segment proc~int32_sort_index_low->none~reverse_segment~6 proc~optional_char optional_char interface~pic_optional->proc~optional_char proc~optional_dp optional_dp interface~pic_optional->proc~optional_dp proc~optional_int32 optional_int32 interface~pic_optional->proc~optional_int32 proc~optional_int64 optional_int64 interface~pic_optional->proc~optional_int64 proc~optional_logical optional_logical interface~pic_optional->proc~optional_logical proc~optional_sp optional_sp interface~pic_optional->proc~optional_sp none~merge_sort~6->none~reverse_segment~6 none~calc_min_run~6 calc_min_run none~merge_sort~6->none~calc_min_run~6 none~collapse~6 collapse none~merge_sort~6->none~collapse~6 none~insert_head~6 insert_head none~merge_sort~6->none~insert_head~6 none~insertion_sort~6 insertion_sort none~merge_sort~6->none~insertion_sort~6

Variables

Type Visibility Attributes Name Initial
integer(kind=int_index), private :: array_size
integer(kind=int32), private, allocatable :: buf(:)
integer(kind=int_index), private :: i
integer(kind=int_index_low), private, allocatable :: ibuf(:)
integer(kind=int_index), private :: stat

Functions

pure function calc_min_run(n) result(min_run)

Returns the minimum length of a run from 32-63 so that N/MIN_RUN is less than or equal to a power of two. See https://svn.python.org/projects/python/trunk/Objects/listsort.txt

Arguments

Type IntentOptional Attributes Name
integer(kind=int_index), intent(in) :: n

Return Value integer(kind=int_index)

pure function collapse(runs) result(r)

Arguments

Type IntentOptional Attributes Name
type(run_type), intent(in), target :: runs(0:)

Return Value integer(kind=int_index)


Subroutines

pure subroutine insert_head(array, index)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: array(0:)
integer(kind=int_index_low), intent(inout) :: index(0:)

pure subroutine insertion_sort(array, index)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: array(0:)
integer(kind=int_index_low), intent(inout) :: index(0:)

pure subroutine merge(array, mid, buf, index, ibuf)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: array(0:)
integer(kind=int_index), intent(in) :: mid
integer(kind=int32), intent(inout) :: buf(0:)
integer(kind=int_index_low), intent(inout) :: index(0:)
integer(kind=int_index_low), intent(inout) :: ibuf(0:)

subroutine merge_sort(array, index, buf, ibuf)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: array(0:)
integer(kind=int_index_low), intent(inout) :: index(0:)
integer(kind=int32), intent(inout) :: buf(0:)
integer(kind=int_index_low), intent(inout) :: ibuf(0:)

pure subroutine reverse_segment(array, index)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: array(0:)
integer(kind=int_index_low), intent(inout) :: index(0:)

Source Code

      module subroutine int32_sort_index_low(array, index, work, iwork, &
                                             reverse)
!! `int32_sort_index_low( 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 input `ARRAY` in the desired direction.
         implicit none
         integer(int32), intent(inout)                     :: array(0:)
         integer(int_index_low), intent(out)                      :: index(0:)
         integer(int32), intent(out), optional             :: work(0:)
         integer(int_index_low), intent(out), optional            :: iwork(0:)
         logical, intent(in), optional             :: reverse
      end subroutine int32_sort_index_low