Routine for sorting an array
Note
CP2K: Please use the interface defined in util.F for calling sort(). DBCSR: Please use the interface defined in dbcsr_toollib.F for calling sort().
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | private, | parameter | :: | debug_this_module | = | .FALSE. | |
character(len=*), | private, | parameter | :: | moduleN | = | 'dbcsr_array_sort' |
Sorts an array inplace using a combination of merge- and bubble-sort. It also returns the indices, which the elements had before the sort.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
The actual sort routine. Only dbcsr_1d_d_sort and itself should call this.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
Sorts an array inplace using a combination of merge- and bubble-sort. It also returns the indices, which the elements had before the sort.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
The actual sort routine. Only dbcsr_1d_s_sort and itself should call this.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
Sorts an array inplace using a combination of merge- and bubble-sort. It also returns the indices, which the elements had before the sort.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
The actual sort routine. Only dbcsr_1d_i4_sort and itself should call this.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
Sorts an array inplace using a combination of merge- and bubble-sort. It also returns the indices, which the elements had before the sort.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
The actual sort routine. Only dbcsr_1d_i8_sort and itself should call this.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |