ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_arraySort Module Reference

This module contains procedures and generic interfaces for various sorting tasks.
More...

Data Types

type  bubble_type
 
interface  getSorted
 Generate and return the sorted elements of the input scalar string or contiguous vector in ascending order, or the sorted indices of the input scalar string or contiguous array of rank 1 in ascending order or in the user-specified order. More...
 
type  heap_type
 
type  heapi_type
 
type  heapr_type
 
type  insertion_type
 
type  insertionb_type
 
type  insertionl_type
 
interface  isAscending
 Generate and return .true. if the input array is sorted in ascending order (with the possibility of elements being equal), otherwise, generate and return .false.. More...
 
interface  isAscendingAll
 Generate and return .true. if the input array is sorted in strictly all ascending order (without equal elements), otherwise, generate and return .false.. More...
 
interface  isDescending
 Generate and return .true. if the input array is sorted in descending order (with the possibility of elements being equal), otherwise, generate and return .false.. More...
 
interface  isDescendingAll
 Generate and return .true. if the input array is sorted in strictly all descending order (without equal elements), otherwise, generate and return .false.. More...
 
type  isort_type
 
interface  isSorted
 Return .true. if the input array is sorted, either ascending or descending, or all equal. More...
 
type  merger_type
 
type  qsort_type
 
type  qsorti_type
 
type  qsortr_type
 
type  qsortrdp_type
 
type  selection_type
 
interface  setSorted
 Sort the input scalar string or contiguous vector in ascending order, or return the sorted indices of the input scalar string or contiguous array of rank 1 in ascending order or in the user-specified order. More...
 
type  shell_type
 
type  sort_type
 

Variables

character(*, SK), parameter MODULE_NAME = "@pm_arraySort"
 
type(isort_type), parameter isort = isort_type()
 
type(qsorti_type), parameter qsorti = qsorti_type()
 
type(qsortr_type), parameter qsortr = qsortr_type()
 
type(qsortrdp_type), parameter qsortrdp = qsortrdp_type()
 
type(bubble_type), parameter bubble = bubble_type()
 
type(heapi_type), parameter heapi = heapi_type()
 
type(heapr_type), parameter heapr = heapr_type()
 
type(insertionl_type), parameter insertionl = insertionl_type()
 
type(insertionb_type), parameter insertionb = insertionb_type()
 
type(merger_type), parameter merger = merger_type()
 
type(selection_type), parameter selection = selection_type()
 
type(shell_type), parameter shell = shell_type()
 

Detailed Description

This module contains procedures and generic interfaces for various sorting tasks.

Specifically, the generic interfaces of this module fall into three categories:

  1. Testing whether an array of intrinsic type and kind is in
    1. ascending,
    2. descending,
    3. sorted (i.e., either ascending or descending),
    4. all ascending (i.e., strictly ascending with no duplicates),
    5. all descending (i.e., strictly descending with no duplicates),
    6. user-specified,
    order.
  2. Sorting the indices of an array of intrinsic type and kind in ascending order.
  3. Sorting the elements of an array of intrinsic type and kind in ascending order.
  4. Generating sorted indices of an array of intrinsic type and kind in ascending order.
  5. Generating sorted elements of an array of intrinsic type and kind in ascending order.

There are currently twelve different sorting algorithms implemented in this module in addition to index sorting and sort checking algorithms.

Note
Recommended routines for sorting arrays:
The procedures under the generic interface setSorted with default
Benchmarks:


Benchmark :: sorting

The following is program to test the performance of the different sorting algorithms in this module.
1! Test the performance of different sorting algorithms in pm_arraySort.
2program benchmark
3
4 use pm_kind, only: IK, LK, RK, SK
5 use pm_bench, only: bench_type
6
7 implicit none
8
9 logical(LK) :: issorted
10 integer(IK) :: i
11 integer(IK) :: iarr
12 integer(IK) :: fileUnitRandom
13 integer(IK) :: fileUnitSorted
14 integer(IK) , parameter :: NARR = 12_IK
15 integer(IK) , parameter :: NBENCH = 11_IK
16 integer(IK) :: arraySize(NARR)
17 real(RK) , allocatable :: array(:)
18 type(bench_type) :: bench(2,NBENCH)
21
22 bench(1:2, 1) = bench_type(name = SK_"setSortedQsorti ", exec = setSortedQsorti , overhead = setOverhead)
23 bench(1:2, 2) = bench_type(name = SK_"setSortedQsortr ", exec = setSortedQsortr , overhead = setOverhead)
24 bench(1:2, 4) = bench_type(name = SK_"setSortedQsortrdp ", exec = setSortedQsortrdp , overhead = setOverhead)
25 bench(1:2, 3) = bench_type(name = SK_"setSortedBubble ", exec = setSortedBubble , overhead = setOverhead)
26 bench(1:2, 5) = bench_type(name = SK_"setSortedHeapi ", exec = setSortedHeapi , overhead = setOverhead)
27 bench(1:2, 6) = bench_type(name = SK_"setSortedHeapr ", exec = setSortedHeapr , overhead = setOverhead)
28 bench(1:2, 7) = bench_type(name = SK_"setSortedInsertionl ", exec = setSortedInsertionl , overhead = setOverhead)
29 bench(1:2, 8) = bench_type(name = SK_"setSortedInsertionb ", exec = setSortedInsertionb , overhead = setOverhead)
30 bench(1:2, 9) = bench_type(name = SK_"setSortedMerge ", exec = setSortedMerge , overhead = setOverhead)
31 bench(1:2,10) = bench_type(name = SK_"setSortedSelection ", exec = setSortedSelection , overhead = setOverhead)
32 bench(1:2,11) = bench_type(name = SK_"setSortedShell ", exec = setSortedShell , overhead = setOverhead)
33
34 arraySize = [( 2_IK**iarr, iarr = 3_IK, NARR + 2_IK )]
35
36 write(*,"(*(g0,:,' '))")
37 write(*,"(*(g0,:,' '))") "setSorted() vs. others."
38 write(*,"(*(g0,:,' '))")
39
40 open(newunit = fileUnitRandom, file = "main.random.out", status = "replace")
41 open(newunit = fileUnitSorted, file = "main.sorted.out", status = "replace")
42
43 write(fileUnitRandom ,"(*(g0,:,','))") "arraySize", (bench(1,i)%name, i = 1, NBENCH)
44 write(fileUnitSorted,"(*(g0,:,','))") "arraySize", (bench(2,i)%name, i = 1, NBENCH)
45
46 loopOverArraySize: do iarr = 1, NARR
47
48 allocate(array(arraySize(iarr)))
49 write(*,"(*(g0,:,' '))") "Benchmarking sorting algorithms with array size", arraySize(iarr)
50
51 ! Time sorting algorithms against the default setSorted() procedures.
52
53 issorted = .false._LK
54 do i = 1, NBENCH
55 bench(1,i)%timing = bench(1,i)%getTiming()
56 end do
57 write(fileUnitRandom,"(*(g0,:,','))") arraySize(iarr), (bench(1,i)%timing%mean, i = 1, NBENCH)
58
59 ! Time sorting algorithms with sorted input arrays against unordered input arrays.
60
61 issorted = .true._LK
62 do i = 1, NBENCH
63 bench(2,i)%timing = bench(2,i)%getTiming()
64 end do
65 write(fileUnitSorted,"(*(g0,:,','))") arraySize(iarr), (bench(2,i)%timing%mean, i = 1, NBENCH)
66
67 deallocate(array)
68
69 end do loopOverArraySize
70 write(*,"(*(g0,:,' '))")
71
72 close(fileUnitSorted)
73 close(fileUnitRandom)
74
75contains
76
77 ! sorting procedure wrappers.
78
79 subroutine setOverhead()
80 call setArray()
81 end subroutine
82
83 subroutine setArray()
84 use pm_arraySpace, only: getLinSpace
85 if (issorted) then
86 array(:) = getLinSpace(0._RK, 1._RK, count = size(array, kind = IK))
87 else
88 call random_number(array)
89 end if
90 end subroutine
91
92 subroutine setSortedQsorti()
93 call setArray()
94 block; use pm_arraySort, only: setSorted, qsorti; call setSorted(array, qsorti); end block
95 end subroutine
96
97 subroutine setSortedQsortr()
98 call setArray()
99 block; use pm_arraySort, only: setSorted, qsortr; call setSorted(array, qsortr); end block
100 end subroutine
101
102 subroutine setSortedQsortrdp()
103 call setArray()
104 block; use pm_arraySort, only: setSorted, qsortrdp; call setSorted(array, qsortrdp); end block
105 end subroutine
106
107 subroutine setSortedBubble()
108 call setArray()
109 block; use pm_arraySort, only: setSorted, bubble; call setSorted(array, bubble); end block
110 end subroutine
111
112 subroutine setSortedHeapi()
113 call setArray()
114 block; use pm_arraySort, only: setSorted, heapi; call setSorted(array, heapi); end block
115 end subroutine
116
117 subroutine setSortedHeapr()
118 call setArray()
119 block; use pm_arraySort, only: setSorted, heapr; call setSorted(array, heapr); end block
120 end subroutine
121
122 subroutine setSortedInsertionl()
123 call setArray()
124 block; use pm_arraySort, only: setSorted, insertionl; call setSorted(array, insertionl); end block
125 end subroutine
126
127 subroutine setSortedInsertionb()
128 call setArray()
129 block; use pm_arraySort, only: setSorted, insertionb; call setSorted(array, insertionb); end block
130 end subroutine
131
132 subroutine setSortedMerge()
133 call setArray()
134 block; use pm_arraySort, only: setSorted, merger; call setSorted(array, merger); end block
135 end subroutine
136
137 subroutine setSortedSelection()
138 call setArray()
139 block; use pm_arraySort, only: setSorted, selection; call setSorted(array, selection); end block
140 end subroutine
141
142 subroutine setSortedShell()
143 call setArray()
144 block; use pm_arraySort, only: setSorted, shell; call setSorted(array, shell); end block
145 end subroutine
146
147end program benchmark
Sort the input scalar string or contiguous vector in ascending order, or return the sorted indices of...
Generate count evenly spaced points over the interval [x1, x2] if x1 < x2, or [x2,...
Generate and return an object of type timing_type containing the benchmark timing information and sta...
Definition: pm_bench.F90:574
This module contains procedures and generic interfaces for various sorting tasks.
type(qsorti_type), parameter qsorti
type(shell_type), parameter shell
type(bubble_type), parameter bubble
type(qsortr_type), parameter qsortr
type(insertionl_type), parameter insertionl
type(heapi_type), parameter heapi
type(selection_type), parameter selection
type(qsortrdp_type), parameter qsortrdp
type(heapr_type), parameter heapr
type(insertionb_type), parameter insertionb
type(merger_type), parameter merger
This module contains procedures and generic interfaces for generating arrays with linear or logarithm...
This module contains abstract interfaces and types that facilitate benchmarking of different procedur...
Definition: pm_bench.F90:41
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
Definition: pm_kind.F90:543
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
This is the class for creating benchmark and performance-profiling objects.
Definition: pm_bench.F90:386

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Postprocessing of the benchmark output
1#!/usr/bin/env python
2
3import matplotlib.pyplot as plt
4import pandas as pd
5import numpy as np
6
7fontsize = 15
8
9colnames = [ "setSortedQsorti"
10 , "setSortedQsortr"
11 , "setSortedQsortrdp"
12 , "setSortedBubble"
13 , "setSortedHeapi"
14 , "setSortedInsertionl"
15 , "setSortedInsertionb"
16 , "setSortedMerge"
17 , "setSortedSelection"
18 , "setSortedShell"
19 ]
20
21dtypes = ["random", "sorted"]
22
23
24
25df = {}
26
27for dtype in dtypes:
28
29 df[dtype] = pd.read_csv("main.{}.out".format(dtype))
30 colnames = list(df[dtype].columns.values[1:])
31
32 ax = plt.figure(figsize = 1.25 * np.array([9.4,4.8]), dpi = 200)
33 ax = plt.subplot()
34
35 for colname in colnames:
36 plt.plot( df[dtype].values[:, 0]
37 , df[dtype][colname].values / df[dtype]["setSortedQsorti"].values
38 , linewidth = 2
39 )
40
41 plt.xticks(fontsize = fontsize)
42 plt.yticks(fontsize = fontsize)
43 ax.set_xlabel("Array Size (# elements)", fontsize = fontsize)
44 ax.set_ylabel("Time normalized to qsorti timing", fontsize = fontsize)
45 ax.set_title("Benchmarking of sorting algorithms compared to qsorti.\nInput data is " + r"$\mathrm{\bf{" + dtype + "}}$. Lower is better.", fontsize = fontsize)
46 ax.set_xscale("log")
47 ax.set_yscale("log")
48 plt.minorticks_on()
49 plt.grid(visible = True, which = "both", axis = "both", color = "0.85", linestyle = "-")
50 ax.tick_params(axis = "y", which = "minor")
51 ax.tick_params(axis = "x", which = "minor")
52 ax.legend ( colnames
53 , loc='center left'
54 , bbox_to_anchor=(1, 0.5)
55 , fontsize = fontsize
56 )
57
58 plt.tight_layout()
59 plt.savefig("benchmark.sorting.{}.png".format(dtype))
60
61
62
63ax = plt.figure(figsize = 1.25 * np.array([9.4,4.8]), dpi = 200)
64ax = plt.subplot()
65
66for colname in colnames:
67 plt.plot( df["random"].values[:, 0]
68 , df["sorted"][colname].values / df["random"][colname].values
69 , linewidth = 2
70 )
71
72plt.xticks(fontsize = fontsize)
73plt.yticks(fontsize = fontsize)
74ax.set_xlabel("Array Size (# elements)", fontsize = fontsize)
75ax.set_ylabel("Sorting Time Ratio ( Sorted / Random Input Array )", fontsize = fontsize)
76ax.set_title("Sorted / Random input-arrays sorting-time ratio. Lower is better.", fontsize = fontsize)
77ax.set_xscale("log")
78ax.set_yscale("log")
79plt.minorticks_on()
80plt.grid(visible = True, which = "both", axis = "both", color = "0.85", linestyle = "-")
81ax.tick_params(axis = "y", which = "minor")
82ax.tick_params(axis = "x", which = "minor")
83ax.legend ( colnames
84 , loc='center left'
85 , bbox_to_anchor=(1, 0.5)
86 , fontsize = fontsize
87 )
88
89plt.tight_layout()
90plt.savefig("benchmark.sorting.random.sorted.ratio.png")

Visualization of the benchmark output


Benchmark :: sorting vs. indexing

The following program generates a performance comparison of the setSorted algorithm for various sorting methods.
1program benchmark
2
3 use pm_kind, only: IK, LK, RKG => RK
5 use pm_distUnif, only: getUnifRand
6 use pm_arraySort, only: setSorted
7 use pm_bench, only: bench_type
8
9 implicit none
10
11 integer(IK) :: i,iarr
12 integer(IK) :: fileUnitRandom
13 integer(IK) :: fileUnitSorted
14 integer(IK) , parameter :: NARR = 12_IK
15 integer(IK) , parameter :: NBENCH = 3_IK
16 integer(IK) :: arraySize(NARR)
17 real(RKG) , allocatable :: array(:)
18 integer(IK) , allocatable :: index(:)
19 logical(LK) :: issorted
20 type(bench_type) :: bench(2,NBENCH)
21
22 bench(:,1) = bench_type("setSortedArray", setSortedArray, setOverhead)
23 bench(:,2) = bench_type("setSortedIndex", setSortedIndex, setOverhead)
24 bench(:,3) = bench_type("setSortedindexWithSorting", setSortedindexWithSorting, setOverhead)
25
26 arraySize = [( 2_IK**i, i = 3_IK, NARR + 2_IK )]
27
28 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29 ! Time the setSortedArray() against setSortedIndex() for different array sizes.
30 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31
32 write(*,"(*(g0,:,' '))")
33 write(*,"(*(g0,:,' '))") "setSortedArray() vs. setSortedIndex()."
34 write(*,"(*(g0,:,' '))")
35
36 open(newunit = fileUnitRandom, file = "main.random.out", status = "replace")
37 open(newunit = fileUnitSorted, file = "main.sorted.out", status = "replace")
38 write(fileUnitRandom,"(*(g0,:,','))") "arraySize", (bench(1,i)%name, i = 1, NBENCH)
39 write(fileUnitSorted,"(*(g0,:,','))") "arraySize", (bench(2,i)%name, i = 1, NBENCH)
40
41 loopOverarraySize: do iarr = 1, NARR
42
43 write(*,"(*(g0,:,' '))") "Benchmarking with array size", arraySize(iarr)
44
45 array = getUnifRand(1._RKG, 2._RKG, arraySize(iarr))
46 call setResized(index, arraySize(iarr))
47
48 issorted = .false._LK
49 do i = 1, NBENCH
50 bench(1,i)%timing = bench(1,i)%getTiming()
51 end do
52
53 write(fileUnitRandom,"(*(g0,:,','))") arraySize(iarr), (bench(1,i)%timing%mean, i = 1, NBENCH)
54
55 issorted = .true._LK
56 do i = 1, NBENCH
57 bench(2,i)%timing = bench(2,i)%getTiming()
58 end do
59
60 write(fileUnitSorted,"(*(g0,:,','))") arraySize(iarr), (bench(2,i)%timing%mean, i = 1, NBENCH)
61
62 end do loopOverarraySize
63
64 close(fileUnitRandom)
65 close(fileUnitSorted)
66
67contains
68
69 subroutine setarray()
70 use pm_arraySpace, only: getLinSpace
71 if (issorted) then
72 array(:) = getLinSpace(0._RKG, 1._RKG, count = size(array, kind = IK))
73 else
74 call random_number(array)
75 end if
76 end subroutine
77
78 subroutine setOverhead()
79 call setarray()
80 end subroutine
81
82 subroutine setSortedArray()
83 call setSorted(array)
84 end subroutine
85
86 subroutine setSortedIndex()
87 call setSorted(array, index)
88 end subroutine
89
90 subroutine setSortedindexWithSorting()
91 call setSorted(array, index)
92 array(:) = array(index)
93 end subroutine
94
95end program benchmark
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
This module contains classes and procedures for computing various statistical quantities related to t...

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Postprocessing of the benchmark output
1#!/usr/bin/env python
2
3import matplotlib.pyplot as plt
4import pandas as pd
5import numpy as np
6
7fontsize = 15
8
9
10
11dtypes = ["random", "sorted"]
12
13for dtype in dtypes:
14
15 df = pd.read_csv("main.{}.out".format(dtype))
16
17
18
19 ax = plt.figure(figsize = 1.25 * np.array([9.4,4.8]), dpi = 200)
20 ax = plt.subplot()
21
22 for colname in df.columns[1:]:
23 plt.plot( df.values[:, 0]
24 , df[colname].values
25 , linewidth = 2
26 )
27
28 plt.xticks(fontsize = fontsize)
29 plt.yticks(fontsize = fontsize)
30 ax.set_xlabel("Array Size (# elements)", fontsize = fontsize)
31 ax.set_ylabel("Time [ seconds ]", fontsize = fontsize)
32 ax.set_title("timing of setSortedArray() vs. setSortedIndex(). Input data is {}.\n Lower is better.".format(dtype), fontsize = fontsize)
33 ax.set_xscale("log")
34 ax.set_yscale("log")
35 plt.minorticks_on()
36 plt.grid(visible = True, which = "both", axis = "both", color = "0.85", linestyle = "-")
37 ax.tick_params(axis = "y", which = "minor")
38 ax.tick_params(axis = "x", which = "minor")
39 ax.legend ( df.columns[1:]
40 #, loc='center left'
41 #, bbox_to_anchor=(1, 0.5)
42 , fontsize = fontsize
43 )
44
45 plt.tight_layout()
46 plt.savefig("benchmark.sorting_vs_indexing.{}.png".format(dtype))
47
48
49
50 ax = plt.figure(figsize = 1.25 * np.array([9.4,4.8]), dpi = 200)
51 ax = plt.subplot()
52
53 start = 0
54
55 plt.plot( df.values[:, 0]
56 , np.ones(len(df.values[:, 0]))
57 , linestyle = "--"
58 , linewidth = 2
59 #, color = "black"
60 )
61 for colname in df.columns[2:]:
62 plt.plot( df.values[start:,0]
63 , df[colname].values[start:] / df["setSortedArray"].values[start:]
64 , linewidth = 2
65 )
66
67 plt.xticks(fontsize = fontsize)
68 plt.yticks(fontsize = fontsize)
69 ax.set_xlabel("Array Size (# elements)", fontsize = fontsize)
70 ax.set_ylabel("Time Ratio ( setSortedIndex() / setSortedArray() )", fontsize = fontsize)
71 ax.set_title("Ratio of timing of setSortedIndex() to setSortedArray(). Input data is {}.".format(dtype), fontsize = fontsize)
72 ax.set_xscale("log")
73 #ax.set_yscale("log")
74 plt.minorticks_on()
75 plt.grid(visible = True, which = "both", axis = "both", color = "0.85", linestyle = "-")
76 ax.tick_params(axis = "y", which = "minor")
77 ax.tick_params(axis = "x", which = "minor")
78 ax.legend ( ["setSortedArray"] + list(df.columns[2:])
79 #, bbox_to_anchor=(1, 0.5)
80 #, loc='center left'
81 , fontsize = fontsize
82 )
83
84 plt.tight_layout()
85 plt.savefig("benchmark.sorting_vs_indexing.{}.ratio.png".format(dtype))
86
87

Visualization of the benchmark output
Todo:
Very Low Priority: An equivalent functional versions of setSorted and setSorted could be added along with the relevant benchmarks.
Remarks
The sorting routines of this module are inspired by (although substantially different from),


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, April 21, 2017, 1:54 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas Austin

Variable Documentation

◆ bubble

type(bubble_type), parameter pm_arraySort::bubble = bubble_type()

Definition at line 134 of file pm_arraySort.F90.

◆ heapi

type(heapi_type), parameter pm_arraySort::heapi = heapi_type()

Definition at line 138 of file pm_arraySort.F90.

◆ heapr

type(heapr_type), parameter pm_arraySort::heapr = heapr_type()

Definition at line 142 of file pm_arraySort.F90.

◆ insertionb

type(insertionb_type), parameter pm_arraySort::insertionb = insertionb_type()

Definition at line 150 of file pm_arraySort.F90.

◆ insertionl

type(insertionl_type), parameter pm_arraySort::insertionl = insertionl_type()

Definition at line 146 of file pm_arraySort.F90.

◆ isort

type(isort_type), parameter pm_arraySort::isort = isort_type()

Definition at line 117 of file pm_arraySort.F90.

◆ merger

type(merger_type), parameter pm_arraySort::merger = merger_type()

Definition at line 154 of file pm_arraySort.F90.

◆ MODULE_NAME

character(*,SK), parameter pm_arraySort::MODULE_NAME = "@pm_arraySort"

Definition at line 95 of file pm_arraySort.F90.

◆ qsorti

type(qsorti_type), parameter pm_arraySort::qsorti = qsorti_type()

Definition at line 122 of file pm_arraySort.F90.

◆ qsortr

type(qsortr_type), parameter pm_arraySort::qsortr = qsortr_type()

Definition at line 126 of file pm_arraySort.F90.

◆ qsortrdp

type(qsortrdp_type), parameter pm_arraySort::qsortrdp = qsortrdp_type()

Definition at line 130 of file pm_arraySort.F90.

◆ selection

type(selection_type), parameter pm_arraySort::selection = selection_type()

Definition at line 158 of file pm_arraySort.F90.

◆ shell

type(shell_type), parameter pm_arraySort::shell = shell_type()

Definition at line 162 of file pm_arraySort.F90.