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(
-3.64114785,
-8.86857033), (
-8.11884880,
-4.36031246), (
+4.97537422,
-6.99381447), (
-8.80122566,
+2.34853363), (
-4.42131805,
-8.40193558)
6(
-0.302439690,
-5.77087688), (
-0.696674347,
+8.48995018), (
-7.06794930,
-5.80740452), (
-0.631896973,
-3.14670658), (
+1.38528919,
+2.38150120)
7(
-6.67469788,
+7.87784815), (
-5.93359184,
+6.72193241), (
+4.43778801,
-5.25823689), (
-0.892185211,
+4.31091309), (
-2.90092182,
+5.64169979)
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.1662197092901394,
-0.72095293884824407), (
-2.9537437431547864,
+6.2587101011219897), (
+4.1904987624232017,
+0.20553643797187959), (
-3.4037427370964015,
-6.8184726966441307), (
-3.7163268208734084,
-2.4421549215379392)
28(
-8.2142643017548913,
-6.4185703387694453), (
+3.1937483027634919,
-3.6938618402433345), (
-5.9839226821598128,
-8.1425535199021795), (
+8.4377657965578017,
+7.6566642166096948), (
+8.8841127783054930,
-4.9915957459429592)
29(
-5.7768554009985937,
+2.1589851350166374), (
+2.7884404831160658,
+4.2932728533534608), (
+6.8621794899468416,
-4.1293819320234384), (
-7.2291477614870416,
+8.7172559033968007), (
-7.7109261331641124,
+7.1767173609297776)
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.82814150176674646970811468799907251,
-2.14916257169207978704671560486512966), (
-0.530105513863076073181589450315885913E-1,
+4.85236597223743161941973539602801124), (
-8.56972297748525836103805732151437618,
-0.591309313776889442052527646829438926), (
+4.15488682309690654204822633435156368,
+1.88007607460908193539005814660227669), (
-4.42009111546919427112741331266416617,
-8.64120478702553598700131361399351800)
50(
-6.56115370372459048336087680432872743,
-7.40582701475616728372079723994788330), (
-1.81549011214600607342218645387351956,
+8.78939171550704520221877840506128561), (
-3.61003853306250093852301277786256657,
+7.71041726479092320251988173868320422), (
+6.64191549787102745108688984070241738,
+6.83904964494849420452625855182243612), (
-7.70656221221506222403483715165684590,
-7.05641153075192824928148462390496672)
51(
+7.56734711939423288246051681072727736,
+1.65528619215756630372343576518052772), (
-5.59662269642703407272153425035798696,
-2.98970644882128843488790880126748234), (
+7.28581523224996420614309285366357984,
-8.38736714190344616542763258280323568), (
-0.956386957490712294339783187944855572,
-0.323076179016402929718966837597979630), (
-7.84572954923499202945239440150454819,
-5.58704821938918528726179389887590895)
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.