Generate and return the component-wise location of the minimum value of (both real and imaginary parts of) the input complex
.
More...
Generate and return the component-wise location of the minimum value of (both real and imaginary parts of) the input complex
.
This generic interfaces extends the behavior of the intrinsic Fortran minloc(a, dim = dim)
for arguments of real
type to arguments of type complex
.
- Parameters
-
[in] | array | : The input array of rank (1..2) of type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128). |
[in] | dim | : The input scalar of type integer of default kind IK of value 1 <= dim <= rank(array) , representing the dimension along which the location of the minimum must be computed.
(optional. If missing, the output value is a scalar containing the location of the minimum of the entire input array .) |
- Returns
val
: The output,
-
vector of size
2
, if array
is of rank 1
or if the input argument dim
is missing,
-
array of shape
(1:2, size(array, 3 - dim))
, if array
is of rank 2
and the input argument dim
is present,
of type integer
of default kind IK.
-
The elements in the first row of
loc
contain the locations of the first occurrences of the minimum values of the corresponding real parts of the input array
.
-
The elements in the second row of
loc
contain the locations of the first occurrences of the minimum values of the corresponding imaginary parts of the input array
.
The returned locations are 0
if the input array has a zero size.
Possible calling interfaces ⛓
loc(1:2) = minloc(array)
loc(1:2) = minloc(array(:), dim)
loc(1:2, 1:size(array, 3 - dim)) = minloc(array(:,:), dim)
Generate and return the component-wise location of the minimum value of (both real and imaginary part...
This module contains procedures and generic interfaces for computing element-wise minimum/maximum val...
- Warning
- The condition
1 <= dim .and. dim <= rank(sample)
must hold for the corresponding input arguments.
This condition is verified only if the library is built with the preprocessor macro CHECK_ENABLED=1
.
-
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.
- See also
- min
max
minval
maxval
minloc
maxloc
pm_complexCompareAll
pm_complexCompareAny
pm_complexCompareLex
pm_arrayMinMax
pm_mathMinMax
Example usage ⛓
10 integer(IK) :: ndim, nsam
11 type(display_type) :: disp
16 complex(CKG),
allocatable :: array(:,:)
20 call disp%show(
"array = getUnifRand((-9._CKG, -9._CKG), (+9._CKG, +9._CKG), ndim, nsam)")
21 array
= getUnifRand((
-9._CKG,
-9._CKG), (
+9._CKG,
+9._CKG), ndim, nsam)
26 call disp%show(
"minloc(array, dim = 1_IK)")
27 call disp%show(
minloc(array,
dim = 1_IK) )
28 call disp%show(
"minloc(array, dim = 2_IK)")
29 call disp%show(
minloc(array,
dim = 2_IK) )
30 call disp%show(
"minloc([complex(CKG)::])")
31 call disp%show(
minloc([
complex(CKG)::]) )
32 call disp%show(
"minloc([complex(CKG)::], dim = 1_IK)")
33 call disp%show(
minloc([
complex(CKG)::],
dim = 1_IK) )
34 call disp%show(
"minloc([complex(CKG)::], dim = 2_IK)")
35 call disp%show(
minloc([
complex(CKG)::],
dim = 2_IK) )
41 complex(CKG),
allocatable :: array(:,:)
45 call disp%show(
"array = getUnifRand((-9._CKG, -9._CKG), (+9._CKG, +9._CKG), ndim, nsam)")
46 array
= getUnifRand((
-9._CKG,
-9._CKG), (
+9._CKG,
+9._CKG), ndim, nsam)
51 call disp%show(
"minloc(array, dim = 1_IK)")
52 call disp%show(
minloc(array,
dim = 1_IK) )
53 call disp%show(
"minloc(array, dim = 2_IK)")
54 call disp%show(
minloc(array,
dim = 2_IK) )
55 call disp%show(
"minloc([complex(CKG)::])")
56 call disp%show(
minloc([
complex(CKG)::]) )
57 call disp%show(
"minloc([complex(CKG)::], dim = 1_IK)")
58 call disp%show(
minloc([
complex(CKG)::],
dim = 1_IK) )
59 call disp%show(
"minloc([complex(CKG)::], dim = 2_IK)")
60 call disp%show(
minloc([
complex(CKG)::],
dim = 2_IK) )
66 complex(CKG),
allocatable :: array(:,:)
70 call disp%show(
"array = getUnifRand((-9._CKG, -9._CKG), (+9._CKG, +9._CKG), ndim, nsam)")
71 array
= getUnifRand((
-9._CKG,
-9._CKG), (
+9._CKG,
+9._CKG), ndim, nsam)
76 call disp%show(
"minloc(array, dim = 1_IK)")
77 call disp%show(
minloc(array,
dim = 1_IK) )
78 call disp%show(
"minloc(array, dim = 2_IK)")
79 call disp%show(
minloc(array,
dim = 2_IK) )
80 call disp%show(
"minloc([complex(CKG)::])")
81 call disp%show(
minloc([
complex(CKG)::]) )
82 call disp%show(
"minloc([complex(CKG)::], dim = 1_IK)")
83 call disp%show(
minloc([
complex(CKG)::],
dim = 1_IK) )
84 call disp%show(
"minloc([complex(CKG)::], dim = 2_IK)")
85 call disp%show(
minloc([
complex(CKG)::],
dim = 2_IK) )
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
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 computing various statistical quantities related to t...
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 CKH
The scalar integer constant of intrinsic default kind, representing the highest-precision complex kin...
integer, parameter CKS
The single-precision complex kind in Fortran mode. On most platforms, this is a 32-bit real kind.
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter CKD
The double precision complex kind in Fortran mode. On most platforms, this is a 64-bit real kind.
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 ⛓
3array
= getUnifRand((
-9._CKG,
-9._CKG), (
+9._CKG,
+9._CKG), ndim, nsam)
5(
+7.80546188,
-7.11489916), (
+2.65674305,
-7.46991920), (
+5.83922958,
-2.46984577), (
-8.32185364,
-3.39966011), (
+4.15871716,
+0.521961212)
6(
-6.38496208,
-1.60613251), (
+6.58240509,
-3.24909687), (
+0.903720856,
-8.53102875), (
-8.47382164,
+2.95141888), (
-0.805713654,
-5.68198776)
7(
-7.64053917,
-0.875088692), (
+3.69166374,
-1.70879149), (
+5.49105835,
+5.34604454), (
-7.32911682,
-5.39864063), (
+5.36340809,
-6.73990059)
10minloc(array,
dim = 1_IK)
13minloc(array,
dim = 2_IK)
16minloc([
complex(CKG)::])
18minloc([
complex(CKG)::],
dim = 1_IK)
20minloc([
complex(CKG)::],
dim = 2_IK)
25array
= getUnifRand((
-9._CKG,
-9._CKG), (
+9._CKG,
+9._CKG), ndim, nsam)
27(
-0.60099139091057197,
+0.74191477399606853), (
+4.3914741406808684,
-0.34139213672009738), (
+4.7264375634467228,
-1.0673074460926597), (
-4.3494696261479060,
+2.4925588240467960), (
-5.9138845742221289,
-6.5118290637402438)
28(
+1.3667669134682368,
+0.50038566313463129), (
+5.1322746244952064,
-7.8148083949716387), (
-3.7549432438708568,
-6.8095196777612514), (
-6.3239329787880507,
+6.7120160565742051), (
-1.8994107264764644,
+0.47601414771888528)
29(
-0.77115966321704477,
+1.2205285131378347), (
+4.1468417522162753,
+4.1196690439671482), (
+7.7727222305143622,
-4.6549071311789199), (
-8.7575352953756322,
+7.3562906306453009), (
+8.3409990219929888,
+0.87347102023435141)
32minloc(array,
dim = 1_IK)
35minloc(array,
dim = 2_IK)
38minloc([
complex(CKG)::])
40minloc([
complex(CKG)::],
dim = 1_IK)
42minloc([
complex(CKG)::],
dim = 2_IK)
47array
= getUnifRand((
-9._CKG,
-9._CKG), (
+9._CKG,
+9._CKG), ndim, nsam)
49(
+7.92369139528458744190405818662858325,
+2.60196807071590806414818201650428816), (
+6.55964541397851047017033942592550355,
+7.46518258890265294659939271430424477), (
+4.83580891805395023021458416451310061,
+7.80012801069476836742258449530654057), (
-3.01259764093830169159760260166114848,
+3.02458876160674426668661520769468153), (
+4.35640398334074948227111864457078269,
-0.765947293952277462383577122538906883)
50(
+7.36688168195617362413115541825136334,
-7.95221824498119754043286138832235375), (
+0.376764190265030475210420989347353923E-1,
+3.08379581112444124979821339150423889), (
+8.15371322828645706916767859921989892,
+0.671937385106097070332192918913334902), (
-6.20054340115675431170578734990502228,
+3.10492156384280158871022728139108208), (
-3.08837612527655639769784696366393913,
-1.20098869810352822376251220668053887)
51(
-8.93938436987142141667316365013574388,
+1.19609731699771974617620830300165411), (
-7.25113732040695903816839775381853552,
+2.18783030578039583555647035527236427), (
+1.82307346726544734884210392670389963,
-7.32018445110550292760867325585440342), (
+4.37879860978417767220863378752189386,
+0.780625530264205722765220351208774340), (
+0.552530986925038005327204021542442901,
+0.870836276458876464381762955460491617E-1)
54minloc(array,
dim = 1_IK)
57minloc(array,
dim = 2_IK)
60minloc([
complex(CKG)::])
62minloc([
complex(CKG)::],
dim = 1_IK)
64minloc([
complex(CKG)::],
dim = 2_IK)
- Test:
- test_pm_complexMinMax
- Todo:
- Normal Priority: This generic interface can be extended with optional
mask
and back
arguments to match those of the intrinsic minloc()
.
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, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas Austin
Definition at line 964 of file pm_complexMinMax.F90.