dp_sort_index_default Module Subroutine

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

Arguments

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

Calls

proc~~dp_sort_index_default~~CallsGraph proc~dp_sort_index_default dp_sort_index_default interface~pic_optional pic_optional proc~dp_sort_index_default->interface~pic_optional none~merge_sort~4 merge_sort proc~dp_sort_index_default->none~merge_sort~4 none~reverse_segment~4 reverse_segment proc~dp_sort_index_default->none~reverse_segment~4 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~4->none~reverse_segment~4 none~calc_min_run~4 calc_min_run none~merge_sort~4->none~calc_min_run~4 none~collapse~4 collapse none~merge_sort~4->none~collapse~4 none~insert_head~4 insert_head none~merge_sort~4->none~insert_head~4 none~insertion_sort~4 insertion_sort none~merge_sort~4->none~insertion_sort~4

Variables

Type Visibility Attributes Name Initial
integer(kind=int_index), private :: array_size
real(kind=dp), private, allocatable :: buf(:)
integer(kind=int_index), private :: i
integer(kind=int_index), 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
real(kind=dp), intent(inout) :: array(0:)
integer(kind=int_index), intent(inout) :: index(0:)

pure subroutine insertion_sort(array, index)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: array(0:)
integer(kind=int_index), intent(inout) :: index(0:)

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

Arguments

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

subroutine merge_sort(array, index, buf, ibuf)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: array(0:)
integer(kind=int_index), intent(inout) :: index(0:)
real(kind=dp), intent(inout) :: buf(0:)
integer(kind=int_index), intent(inout) :: ibuf(0:)

pure subroutine reverse_segment(array, index)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: array(0:)
integer(kind=int_index), intent(inout) :: index(0:)

Source Code

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