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

Generate and return .true. if the input array is sorted in strictly all ascending order (without equal elements), otherwise, generate and return .false.. More...

Detailed Description

Generate and return .true. if the input array is sorted in strictly all ascending order (without equal elements), otherwise, generate and return .false..

Parameters
[in]array: The input contiguous array of rank 1 of either
  1. type css_pdt or,
  2. type css_type or,
  3. type character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) of arbitrary length type parameter or,
  4. type integer of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64) or,
  5. type logical of kind any supported by the processor (e.g., LK) or,
  6. type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128) or,
  7. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128) or,
or,
  1. 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 a strictly all ascending order (without equal elements).
Returns
ascendingAll : The output scalar logical of default kind LK that is .true. if elements of the input array are in strictly all ascending order (without equal elements), Otherwise, it is .false..


Possible calling interfaces

ascendingAll = isAscendingAll(array)
Generate and return .true. if the input array is sorted in strictly all ascending order (without equa...
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

1program example
2
3 use pm_kind, only: SK, IK, LK ! all intrinsic types and kinds are supported.
5 use pm_io, only: display_type
6
7 implicit none
8
9 type(display_type) :: disp
10
11 disp = display_type(file = "main.out.F90")
12
13 call disp%skip()
14 call disp%show("isAscendingAll('')")
15 call disp%show( isAscendingAll('') )
16 call disp%skip()
17 call disp%show("isAscendingAll('?Aa')")
18 call disp%show( isAscendingAll('?Aa') )
19 call disp%skip()
20 call disp%show("isAscendingAll('A!b')")
21 call disp%show( isAscendingAll('A!b') )
22 call disp%skip()
23 call disp%show("isAscendingAll('zxw')")
24 call disp%show( isAscendingAll('zxw') )
25 call disp%skip()
26 call disp%show("isAscendingAll('AAA')")
27 call disp%show( isAscendingAll('AAA') )
28 call disp%skip()
29
30 call disp%skip()
31 call disp%show("isAscendingAll([character(0) ::])")
32 call disp%show( isAscendingAll([character(0) ::]) )
33 call disp%skip()
34 call disp%show("isAscendingAll(['?', 'A', 'a'])")
35 call disp%show( isAscendingAll(['?', 'A', 'a']) )
36 call disp%skip()
37 call disp%show("isAscendingAll(['A', '!', 'b'])")
38 call disp%show( isAscendingAll(['A', '!', 'b']) )
39 call disp%skip()
40 call disp%show("isAscendingAll(['z', 'x', 'w'])")
41 call disp%show( isAscendingAll(['z', 'x', 'w']) )
42 call disp%skip()
43 call disp%show("isAscendingAll(['A', 'A', 'A'])")
44 call disp%show( isAscendingAll(['A', 'A', 'A']) )
45 call disp%skip()
46
47 call disp%skip()
48 call disp%show("isAscendingAll([integer ::])")
49 call disp%show( isAscendingAll([integer ::]) )
50 call disp%skip()
51 call disp%show("isAscendingAll([+1, +2, +3])")
52 call disp%show( isAscendingAll([+1, +2, +3]) )
53 call disp%skip()
54 call disp%show("isAscendingAll([-1, -2, -3])")
55 call disp%show( isAscendingAll([-1, -2, -3]) )
56 call disp%skip()
57 call disp%show("isAscendingAll([-1, +2, -3])")
58 call disp%show( isAscendingAll([-1, +2, -3]) )
59 call disp%skip()
60 call disp%show("isAscendingAll([-1, -1, -1])")
61 call disp%show( isAscendingAll([-1, -1, -1]) )
62 call disp%skip()
63
64 call disp%skip()
65 call disp%show("isAscendingAll([logical ::])")
66 call disp%show( isAscendingAll([logical ::]) )
67 call disp%skip()
68 call disp%show("isAscendingAll([.false., .false., .true.])")
69 call disp%show( isAscendingAll([.false., .false., .true.]) )
70 call disp%skip()
71 call disp%show("isAscendingAll([.true., .false., .false.])")
72 call disp%show( isAscendingAll([.true., .false., .false.]) )
73 call disp%skip()
74 call disp%show("isAscendingAll([.false., .true., .false.])")
75 call disp%show( isAscendingAll([.false., .true., .false.]) )
76 call disp%skip()
77 call disp%show("isAscendingAll([.true., .true., .true.])")
78 call disp%show( isAscendingAll([.true., .true., .true.]) )
79 call disp%skip()
80
81 call disp%skip()
82 call disp%show("isAscendingAll([complex ::])")
83 call disp%show( isAscendingAll([complex ::]) )
84 call disp%skip()
85 call disp%show("isAscendingAll([(+1., -1.), (+2., -2.), (+3., -3.)])")
86 call disp%show( isAscendingAll([(+1., -1.), (+2., -2.), (+3., -3.)]) )
87 call disp%skip()
88 call disp%show("isAscendingAll([(-1., +1.), (-2., +2.), (-3., +3.)])")
89 call disp%show( isAscendingAll([(-1., +1.), (-2., +2.), (-3., +3.)]) )
90 call disp%skip()
91 call disp%show("isAscendingAll([(-1., +1.), (+2., -2.), (-3., +3.)])")
92 call disp%show( isAscendingAll([(-1., +1.), (+2., -2.), (-3., +3.)]) )
93 call disp%skip()
94 call disp%show("isAscendingAll([(-1., +1.), (-1., +1.), (-1., +1.)])")
95 call disp%show( isAscendingAll([(-1., +1.), (-1., +1.), (-1., +1.)]) )
96 call disp%skip()
97 call disp%show("isAscendingAll([(-1., +1.), (-1., -2.), (-1., +3.)])")
98 call disp%show( isAscendingAll([(-1., +1.), (-1., -2.), (-1., +3.)]) )
99 call disp%skip()
100
101 call disp%skip()
102 call disp%show("isAscendingAll([real ::])")
103 call disp%show( isAscendingAll([real ::]) )
104 call disp%skip()
105 call disp%show("isAscendingAll([+1., +2., +3.])")
106 call disp%show( isAscendingAll([+1., +2., +3.]) )
107 call disp%skip()
108 call disp%show("isAscendingAll([-1., -2., -3.])")
109 call disp%show( isAscendingAll([-1., -2., -3.]) )
110 call disp%skip()
111 call disp%show("isAscendingAll([-1., +2., -3.])")
112 call disp%show( isAscendingAll([-1., +2., -3.]) )
113 call disp%skip()
114 call disp%show("isAscendingAll([-1., -1., -1.])")
115 call disp%show( isAscendingAll([-1., -1., -1.]) )
116 call disp%skip()
117
118#if PDT_ENABLED
119 ! \bug
120 ! Intel ifort 2022.3 cannot handle aliases for pdt names (e.g., strc => css_pdt).
121 block
122 use pm_container, only: css_pdt
123 call disp%skip()
124 call disp%show("isAscendingAll([css_pdt('is'), css_pdt( 'sorted'), css_pdt('string')])")
125 call disp%show( isAscendingAll([css_pdt('is'), css_pdt( 'sorted'), css_pdt('string')]) )
126 call disp%skip()
127 call disp%show("isAscendingAll([css_pdt('string'), css_pdt('is'), css_pdt('sorted')])")
128 call disp%show( isAscendingAll([css_pdt('string'), css_pdt('is'), css_pdt('sorted')]) )
129 call disp%skip()
130 call disp%show("isAscendingAll([css_pdt('same string'), css_pdt('same '), css_pdt('same')])")
131 call disp%show( isAscendingAll([css_pdt('same string'), css_pdt('same '), css_pdt('same')]) )
132 call disp%skip()
133 end block
134#endif
135
136end program example
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
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...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
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 css_pdt parameterized type for generating instances of container of scalar of string obje...
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

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

Example output
1
3T
4
6T
7
9F
10
11isAscendingAll('zxw')
12F
13
14isAscendingAll('AAA')
15F
16
17
18isAscendingAll([character(0) ::])
19T
20
21isAscendingAll(['?', 'A', 'a'])
22T
23
24isAscendingAll(['A', '!', 'b'])
25F
26
27isAscendingAll(['z', 'x', 'w'])
28F
29
30isAscendingAll(['A', 'A', 'A'])
31F
32
33
34isAscendingAll([integer ::])
35T
36
37isAscendingAll([+1, +2, +3])
38T
39
40isAscendingAll([-1, -2, -3])
41F
42
43isAscendingAll([-1, +2, -3])
44F
45
46isAscendingAll([-1, -1, -1])
47F
48
49
50isAscendingAll([logical ::])
51T
52
53isAscendingAll([.false., .false., .true.])
54F
55
56isAscendingAll([.true., .false., .false.])
57F
58
59isAscendingAll([.false., .true., .false.])
60F
61
62isAscendingAll([.true., .true., .true.])
63F
64
65
66isAscendingAll([complex ::])
67T
68
69isAscendingAll([(+1., -1.), (+2., -2.), (+3., -3.)])
70T
71
72isAscendingAll([(-1., +1.), (-2., +2.), (-3., +3.)])
73F
74
75isAscendingAll([(-1., +1.), (+2., -2.), (-3., +3.)])
76F
77
78isAscendingAll([(-1., +1.), (-1., +1.), (-1., +1.)])
79F
80
81isAscendingAll([(-1., +1.), (-1., -2.), (-1., +3.)])
82F
83
84
85isAscendingAll([real ::])
86T
87
88isAscendingAll([+1., +2., +3.])
89T
90
91isAscendingAll([-1., -2., -3.])
92F
93
94isAscendingAll([-1., +2., -3.])
95F
96
97isAscendingAll([-1., -1., -1.])
98F
99
100
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.

  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, 3:54 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 231 of file pm_arraySort.F90.


The documentation for this interface was generated from the following file: