dbcsr_array_sort Module

Routine for sorting an array



Contents


Variables

TypeVisibilityAttributesNameInitial
logical, private, parameter:: debug_this_module =.FALSE.
character(len=*), private, parameter:: moduleN ='dbcsr_array_sort'

Subroutines

public subroutine dbcsr_1d_d_sort(arr, n, indices)

Sorts an array inplace using a combination of merge- and bubble-sort. It also returns the indices, which the elements had before the sort.

Arguments

TypeIntentOptionalAttributesName
real(kind=real_8), intent(inout), dimension(1:n):: arr

the array to sort

integer, intent(in) :: n

length of array

integer, intent(out), dimension(1:n):: indices

returns elements-indices before the sort

private recursive subroutine dbcsr_1d_d_sort_low(arr, indices, tmp_arr, tmp_idx)

The actual sort routine. Only dbcsr_1d_d_sort and itself should call this.

Arguments

TypeIntentOptionalAttributesName
real(kind=real_8), intent(inout), dimension(:):: arr

the array to sort

integer, intent(inout), dimension(size(arr)):: indices

elements-indices before the sort

real(kind=real_8), intent(inout), dimension((size(arr) + 1)/2):: tmp_arr

scratch space

integer, intent(inout), dimension((size(arr) + 1)/2):: tmp_idx

scratch space

public subroutine dbcsr_1d_s_sort(arr, n, indices)

Sorts an array inplace using a combination of merge- and bubble-sort. It also returns the indices, which the elements had before the sort.

Arguments

TypeIntentOptionalAttributesName
real(kind=real_4), intent(inout), dimension(1:n):: arr

the array to sort

integer, intent(in) :: n

length of array

integer, intent(out), dimension(1:n):: indices

returns elements-indices before the sort

private recursive subroutine dbcsr_1d_s_sort_low(arr, indices, tmp_arr, tmp_idx)

The actual sort routine. Only dbcsr_1d_s_sort and itself should call this.

Arguments

TypeIntentOptionalAttributesName
real(kind=real_4), intent(inout), dimension(:):: arr

the array to sort

integer, intent(inout), dimension(size(arr)):: indices

elements-indices before the sort

real(kind=real_4), intent(inout), dimension((size(arr) + 1)/2):: tmp_arr

scratch space

integer, intent(inout), dimension((size(arr) + 1)/2):: tmp_idx

scratch space

public subroutine dbcsr_1d_i4_sort(arr, n, indices)

Sorts an array inplace using a combination of merge- and bubble-sort. It also returns the indices, which the elements had before the sort.

Arguments

TypeIntentOptionalAttributesName
integer(kind=int_4), intent(inout), dimension(1:n):: arr

the array to sort

integer, intent(in) :: n

length of array

integer, intent(out), dimension(1:n):: indices

returns elements-indices before the sort

private recursive subroutine dbcsr_1d_i4_sort_low(arr, indices, tmp_arr, tmp_idx)

The actual sort routine. Only dbcsr_1d_i4_sort and itself should call this.

Arguments

TypeIntentOptionalAttributesName
integer(kind=int_4), intent(inout), dimension(:):: arr

the array to sort

integer, intent(inout), dimension(size(arr)):: indices

elements-indices before the sort

integer(kind=int_4), intent(inout), dimension((size(arr) + 1)/2):: tmp_arr

scratch space

integer, intent(inout), dimension((size(arr) + 1)/2):: tmp_idx

scratch space

public subroutine dbcsr_1d_i8_sort(arr, n, indices)

Sorts an array inplace using a combination of merge- and bubble-sort. It also returns the indices, which the elements had before the sort.

Arguments

TypeIntentOptionalAttributesName
integer(kind=int_8), intent(inout), dimension(1:n):: arr

the array to sort

integer, intent(in) :: n

length of array

integer, intent(out), dimension(1:n):: indices

returns elements-indices before the sort

private recursive subroutine dbcsr_1d_i8_sort_low(arr, indices, tmp_arr, tmp_idx)

The actual sort routine. Only dbcsr_1d_i8_sort and itself should call this.

Arguments

TypeIntentOptionalAttributesName
integer(kind=int_8), intent(inout), dimension(:):: arr

the array to sort

integer, intent(inout), dimension(size(arr)):: indices

elements-indices before the sort

integer(kind=int_8), intent(inout), dimension((size(arr) + 1)/2):: tmp_arr

scratch space

integer, intent(inout), dimension((size(arr) + 1)/2):: tmp_idx

scratch space