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(
+4.24501514,
-5.07276344), (
-4.04023266,
-0.345758438), (
-5.18898296,
-2.73521614), (
+5.18146801,
-6.66910267), (
+3.44779491,
-1.78996372)
6(
-0.844077110,
+6.32013321), (
+6.66871166,
-0.966129303), (
+7.87586594,
-6.59477425), (
-7.14750290,
+6.63950348), (
+3.87361932,
-7.31502914)
7(
+8.75380707,
+7.87720871), (
+5.35705280,
-2.70938611), (
-4.15980339,
-6.45905113), (
-7.88371849,
-8.11260605), (
+8.16955757,
+0.146844864)
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(
+5.9190967428409564,
-6.1310331355138050), (
-3.3711492117902329,
+8.7018496710884854), (
-5.9825170501591458,
-6.7645298485164460), (
+2.7157122221073795,
-7.1837085257257876), (
+8.6362589260311573,
-2.0039417795582470)
28(
+2.7179540137154738,
-5.0451605370278543), (
-4.7410564270045619,
+2.6260614516478178), (
-8.3636754163676272,
+3.9816003722022142), (
-7.3416838127327866,
+4.9739458961982344), (
-5.1189299054940030,
+1.2739960309438736)
29(
+7.1506779056007979,
-3.7016392204779929), (
-0.56571861454591499,
-1.4535211197921392), (
-3.8860198226535672,
+1.5623926958657566), (
+1.2219012880037652,
-6.3988652613877441), (
-0.31361367863332745,
-2.9431757928258855)
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(
+8.57279381156968663913666832457575822,
-4.18522490397847422099866502599578656), (
-3.33564383981924823351374446838010063,
-0.166035679712108436133938159897315192), (
+0.586360147823234138936179924864871020,
+2.44780092530691201249457258296480670), (
+6.37556183960350040645945587892478275,
+7.59759208772057784713174339958056052), (
+2.48554458729780934011180741149320135,
+0.505911665280943180194976795937491781)
50(
+6.06917627596176409916545518653312226,
+7.26436694527182699896652501768845758), (
+2.19778105177054081642341884292972792,
+5.57035141760516102674976166153864935), (
+6.57457087548539193328733860331279795,
+4.87716694170380204209919084232124093), (
+6.15404512205558779357271020965109749,
+8.05441422501102630059764351999497051), (
-6.09230775607923655826124779097141407,
-1.18007791329349651183568736326204228)
51(
+1.76624206733609801977471525696479974,
+6.28054245164450139953638261507580503), (
-7.99100825506121892456103684792050317,
+8.48076637322395916229737024676903738), (
-7.75756854350422091643980021068773484,
+4.81791674057369647845855566732458155), (
+0.586779026802607075156725682580197979,
-2.85644263419594856474061474453933551), (
-6.24879459300879739698757959365496041,
+7.84856003223038331201840299813570654)
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 at Austin
Definition at line 964 of file pm_complexMinMax.F90.