Generate and return .true.
if any elements of the input array-like object val
are within a range specified by the input vector Set(1:2)
, otherwise, return .false.
.
The functionality of this interface is equivalent to testing whether the output of set-theoretic intersection operation \(\ms{val}\subset\ms{Set}\) is non-empty.
- Parameters
-
[in] | val | : The input scalar of
-
type
character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) or arbitrary length type parameter,
or vector of
-
type
character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) or 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
whose elements memberships in the Set will be checked. |
[in] | Set | : The input scalar of the same character type and kind as val of length-type-parameter 2 or vector of the same type and kind as val of size 2 , representing the range [Set(1) : Set(2)] with respect to which the (elemental) membership of val will be checked.
By convention,
-
If the input arguments are of type
character , integer , real , then the values are compared as defined by the standard.
-
If the input arguments are of type
complex , then the input values are elementally compared lexically (similar to string comparison).
-
If the input arguments are of type
logical , then .false. < .true. is assumed.
|
- Returns
anyMember
: The output scalar or vector of the same size as the input val
, of type logical
of default kind LK.
It is .true.
if and only if any elements of the input val
are within the input range specified by Set
.
Possible calling interfaces ⛓
anyMember = val .anyinrange. Set(1:2)
anyMember = val(:) .anyinrange. Set(1:2)
This module contains procedures and generic interfaces for assessing whether particular value(s) or a...
- Note
- Normally, the condition
Set(1) < Set(2)
is expected to hold for the input Set
argument, otherwise, the specified range corresponds to an empty set.
-
This generic interface offers a neat way of checking a value against a range returned by either getMinMax() or operator(.subadd.) or operator(.divmul.).
- See also
- operator(.in.)
operator(.allin.)
operator(.anyin.)
operator(.inrange.)
operator(.anyinrange.)
operator(.allinrange.)
operator(.divmul.)
operator(.subadd.)
getMinMax
setMinMax
pm_arraySearch
pm_arrayFind
Example usage ⛓
14 type(display_type) :: disp
15 logical(LK),
allocatable :: Member(:)
19 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%")
20 call disp%show(
"!Check character scalar.")
21 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%")
25 character(:,SKG),
allocatable :: val, Set
30 call disp%show( val, deliml
= SKG_
"""" )
32 call disp%show( Set, deliml
= SKG_
"""" )
33 call disp%show(
"val .anyinrange. Set")
34 call disp%show( val .anyinrange. Set )
39 character(:,SKG),
allocatable :: val, Set
44 call disp%show( val, deliml
= SKG_
"""" )
46 call disp%show( Set, deliml
= SKG_
"""" )
47 call disp%show(
"val .anyinrange. Set")
48 call disp%show( val .anyinrange. Set )
53 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%")
54 call disp%show(
"!Check character array.")
55 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%")
59 character(:,SKG),
allocatable :: val(:)
60 character(
2,SKG),
allocatable :: Set(:)
61 Set
= [
character(
2,SKG) ::
"aa",
"zz"]
65 call disp%show( val, deliml
= SKG_
"""" )
67 call disp%show( Set, deliml
= SKG_
"""" )
68 call disp%show(
"val .anyinrange. Set")
69 call disp%show( val .anyinrange. Set )
74 character(
9,SKG),
allocatable :: val(:)
75 character(
10,SKG),
allocatable :: Set(:)
76 Set
= [
character(
10,SKG) ::
"aa",
"zz"]
77 val
= [
character(
9,SKG) ::
"paramonte",
"ParaMonte",
"Carlo",
"carlo"]
80 call disp%show( val, deliml
= SKG_
"""" )
82 call disp%show( Set, deliml
= SKG_
"""" )
83 call disp%show(
"val .anyinrange. Set")
84 call disp%show( val .anyinrange. Set )
89 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%")
90 call disp%show(
"!Check integer array.")
91 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%")
95 integer(IKG),
allocatable :: val(:), Set(:)
99 call disp%show(
"Set = [integer(IKG) :: 1, 3]")
100 Set
= [
integer(IKG) ::
1,
3]
101 call disp%show(
"val .anyinrange. Set")
102 call disp%show( val .anyinrange. Set )
107 integer(IKG),
allocatable :: val(:), Set(:)
109 call disp%show(
"val = [integer(IKG) :: -1, 3, 5]")
110 val
= [
integer(IKG) ::
-1,
3,
5]
111 call disp%show(
"Set = [integer(IKG) :: 1, 3]")
112 Set
= [
integer(IKG) ::
1,
3]
113 call disp%show(
"val .anyinrange. Set")
114 call disp%show( val .anyinrange. Set )
119 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%")
120 call disp%show(
"!Check logical array.")
121 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%")
125 logical(LKG),
allocatable :: val(:), Set(:)
129 call disp%show(
"Set = [.false., .true.]")
130 Set
= [
.false.,
.true.]
131 call disp%show(
"val .anyinrange. Set")
132 call disp%show( val .anyinrange. Set )
137 logical(LKG),
allocatable :: val(:), Set(:)
139 call disp%show(
"val = [.false., .true., .false.]")
140 val
= [
.false.,
.true.,
.false.]
141 call disp%show(
"Set = [.true., .true.]")
142 Set
= [
.true.,
.true.]
143 call disp%show(
"val .anyinrange. Set")
144 call disp%show( val .anyinrange. Set )
149 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%")
150 call disp%show(
"!Check complex array.")
151 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%")
155 integer(IKG),
allocatable :: val(:), Set(:)
159 call disp%show(
"Set = [complex(CKG) :: (1., 0.), (1., -1.)]")
160 Set
= [
complex(CKG) :: (
1.,
0.), (
1.,
-1.)]
161 call disp%show(
"val .anyinrange. Set")
162 call disp%show( val .anyinrange. Set )
167 integer(IKG),
allocatable :: val(:), Set(:)
169 call disp%show(
"val = [(1., -1.), (0., -1.), (2., -1.)]")
170 val
= [(
1.,
-1.), (
0.,
-1.), (
2.,
-1.)]
171 call disp%show(
"Set = [complex(CKG) :: (1., 0.), (1., -1.)]")
172 Set
= [
complex(CKG) :: (
1.,
0.), (
1.,
-1.)]
173 call disp%show(
"val .anyinrange. Set")
174 call disp%show( val .anyinrange. Set )
179 call disp%show(
"!%%%%%%%%%%%%%%%%%")
180 call disp%show(
"!Check real array.")
181 call disp%show(
"!%%%%%%%%%%%%%%%%%")
185 real(RKG),
allocatable :: val(:), Set(:)
189 call disp%show(
"Set = [real(RKG) :: 1, 3]")
190 Set
= [
real(RKG) ::
1,
3]
191 call disp%show(
"val .anyinrange. Set")
192 call disp%show( val .anyinrange. Set )
197 real(RKG),
allocatable :: val(:), Set(:)
199 call disp%show(
"val = [real(RKG) :: -1, 1, 5]")
200 val
= [
real(RKG) ::
-1,
1,
5]
201 call disp%show(
"Set = [real(RKG) :: 1, 3]")
202 Set
= [
real(RKG) ::
1,
3]
203 call disp%show(
"val .anyinrange. Set")
204 call disp%show( val .anyinrange. Set )
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 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 RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter CK
The default complex kind in the ParaMonte library: real64 in Fortran, c_double_complex in C-Fortran I...
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...
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 ⛓
37"paramonte",
"ParaMonte",
"Carlo ",
"carlo "
50Set
= [
integer(IKG) ::
1,
3]
55val
= [
integer(IKG) ::
-1,
3,
5]
56Set
= [
integer(IKG) ::
1,
3]
67Set
= [
.false.,
.true.]
72val
= [
.false.,
.true.,
.false.]
84Set
= [
complex(CKG) :: (
1.,
0.), (
1.,
-1.)]
89val
= [(
1.,
-1.), (
0.,
-1.), (
2.,
-1.)]
90Set
= [
complex(CKG) :: (
1.,
0.), (
1.,
-1.)]
101Set
= [
real(RKG) ::
1,
3]
106val
= [
real(RKG) ::
-1,
1,
5]
107Set
= [
real(RKG) ::
1,
3]
- Test:
- test_pm_arrayMembership
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:
- Fatemeh Bagheri, Wednesday 1:35 PM, August 11, 2021, Dallas, TX
Definition at line 3106 of file pm_arrayMembership.F90.