(git:6a2e663)
cp_array_sort Module Reference

Routine for sorting an array. More...

Functions/Subroutines

subroutine, public cp_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. More...
 
subroutine, public cp_1d_r_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. More...
 
subroutine, public cp_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. More...
 
subroutine, public cp_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. More...
 

Detailed Description

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().

History
12.2012 first version [ole]
Author
Ole Schuett

Function/Subroutine Documentation

◆ cp_1d_s_sort()

subroutine, public cp_array_sort::cp_1d_s_sort ( real(kind=sp), dimension(1:n), intent(inout)  arr,
integer, intent(in)  n,
integer, dimension(1:n), intent(inout)  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.

Parameters
arrthe array to sort
nlength of array
indicesreturns elements-indices before the sort
History
12.2012 created [ole]
Author
Ole Schuett

Definition at line 45 of file cp_array_sort.F.

◆ cp_1d_r_sort()

subroutine, public cp_array_sort::cp_1d_r_sort ( real(kind=dp), dimension(1:n), intent(inout)  arr,
integer, intent(in)  n,
integer, dimension(1:n), intent(inout)  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.

Parameters
arrthe array to sort
nlength of array
indicesreturns elements-indices before the sort
History
12.2012 created [ole]
Author
Ole Schuett

Definition at line 173 of file cp_array_sort.F.

◆ cp_1d_i4_sort()

subroutine, public cp_array_sort::cp_1d_i4_sort ( integer(kind=int_4), dimension(1:n), intent(inout)  arr,
integer, intent(in)  n,
integer, dimension(1:n), intent(inout)  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.

Parameters
arrthe array to sort
nlength of array
indicesreturns elements-indices before the sort
History
12.2012 created [ole]
Author
Ole Schuett

Definition at line 301 of file cp_array_sort.F.

◆ cp_1d_i8_sort()

subroutine, public cp_array_sort::cp_1d_i8_sort ( integer(kind=int_8), dimension(1:n), intent(inout)  arr,
integer, intent(in)  n,
integer, dimension(1:n), intent(inout)  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.

Parameters
arrthe array to sort
nlength of array
indicesreturns elements-indices before the sort
History
12.2012 created [ole]
Author
Ole Schuett

Definition at line 429 of file cp_array_sort.F.