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.
.
- Parameters
-
[in] | array | : The input contiguous array of rank 1 of either
-
type css_pdt or,
-
type css_type or,
-
type
character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) of arbitrary length type parameter or,
-
type
integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64) or,
-
type
logical of kind any supported by the processor (e.g., LK) or,
-
type
complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128) or,
-
type
real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128) or,
or,
-
a scalar of type
character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) of arbitrary length type parameter,
whose elements will be checked for an all descending order (with the possibility of elements being equal). |
- Returns
ascending
: An output logical
of default kind LK that is .true.
if all elements of the input array are in descending order (with the possibility of elements being equal) or all equal. Otherwise, it is .false.
.
Possible calling interfaces ⛓
Generate and return .true. if the input array is sorted in ascending order (with the possibility of e...
This module contains procedures and generic interfaces for various sorting tasks.
- Warning
- The output of this procedure is
.true.
when the input array has zero length.
-
The
pure
procedure(s) documented herein become impure
when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1
.
By default, these procedures are pure
in release
build and impure
in debug
and testing
builds. The procedures under this generic interface are always impure
when the input argument isSorted()
is present.
- See also
- isSorted
isDescending
setSorted
setSorted
Example usage ⛓
9 type(display_type) :: disp
31 call disp%show(
"isAscending([character(0) ::])")
34 call disp%show(
"isAscending(['?', 'A', 'a'])")
37 call disp%show(
"isAscending(['A', '!', 'b'])")
40 call disp%show(
"isAscending(['z', 'x', 'w'])")
43 call disp%show(
"isAscending(['A', 'A', 'A'])")
48 call disp%show(
"isAscending([integer ::])")
51 call disp%show(
"isAscending([+1, +2, +3])")
54 call disp%show(
"isAscending([-1, -2, -3])")
57 call disp%show(
"isAscending([-1, +2, -3])")
60 call disp%show(
"isAscending([-1, -1, -1])")
65 call disp%show(
"isAscending([logical ::])")
68 call disp%show(
"isAscending([.false., .false., .true.])")
71 call disp%show(
"isAscending([.true., .false., .false.])")
74 call disp%show(
"isAscending([.false., .true., .false.])")
77 call disp%show(
"isAscending([.true., .true., .true.])")
82 call disp%show(
"isAscending([complex ::])")
85 call disp%show(
"isAscending([(+1., -1.), (+2., -2.), (+3., -3.)])")
88 call disp%show(
"isAscending([(-1., +1.), (-2., +2.), (-3., +3.)])")
91 call disp%show(
"isAscending([(-1., +1.), (+2., -2.), (-3., +3.)])")
94 call disp%show(
"isAscending([(-1., +1.), (-1., +1.), (-1., +1.)])")
97 call disp%show(
"isAscending([(-1., +1.), (-1., -2.), (-1., +3.)])")
102 call disp%show(
"isAscending([real ::])")
105 call disp%show(
"isAscending([+1., +2., +3.])")
108 call disp%show(
"isAscending([-1., -2., -3.])")
111 call disp%show(
"isAscending([-1., +2., -3.])")
114 call disp%show(
"isAscending([-1., -1., -1.])")
124 call disp%show(
"isAscending([css_pdt('is'), css_pdt( 'sorted'), css_pdt('string')])")
127 call disp%show(
"isAscending([css_pdt('string'), css_pdt('is'), css_pdt('sorted')])")
130 call disp%show(
"isAscending([css_pdt('same string'), css_pdt('same '), css_pdt('same')])")
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains the derived types for generating allocatable containers of scalar,...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
This is the css_pdt parameterized type for generating instances of container of scalar of string obje...
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
- Test:
- test_pm_arraySort
- Todo:
- This interface can be extended to scalar containers of strings.
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.
-
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.
-
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.
- Copyright
- Computational Data Science Lab
- Author:
- Amir Shahmoradi, April 21, 2017, 3:54 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin
Definition at line 1229 of file pm_arraySort.F90.