Generate and return the component-wise maximum value of (both real and imaginary parts of) the input complex
.
More...
Generate and return the component-wise maximum value of (both real and imaginary parts of) the input complex
.
This generic interfaces extends the behavior of the intrinsic Fortran maxval(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 maximum must be computed.
(optional. If missing, the output value is a scalar containing the maximum of the entire input array .) |
- Returns
val
: The output object of the same type and kind as the input array
of rank rank(array) - 1
whose real and imaginary parts are the maximum values of the corresponding real and imaginary parts of the input array
.
The returned values are -huge(real(0, kind(array))
if the input array
has zero size along the dimension of interest.
Possible calling interfaces ⛓
val = maxval(array)
val = maxval(array, dim) ! = cmplx(maxval(array%re, dim), maxval(array%im, dim), kind(array))
Generate and return the component-wise maximum value of (both real and imaginary parts of) the input ...
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(
"maxval(array, dim = 1_IK)")
27 call disp%show(
maxval(array,
dim = 1_IK) )
28 call disp%show(
"maxval(array, dim = 2_IK)")
29 call disp%show(
maxval(array,
dim = 2_IK) )
30 call disp%show(
"maxval([complex(CKG)::])")
31 call disp%show(
maxval([
complex(CKG)::]) )
32 call disp%show(
"maxval([complex(CKG)::], dim = 1_IK)")
33 call disp%show(
maxval([
complex(CKG)::],
dim = 1_IK) )
34 call disp%show(
"maxval([complex(CKG)::], dim = 2_IK)")
35 call disp%show(
maxval([
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(
"maxval(array, dim = 1_IK)")
52 call disp%show(
maxval(array,
dim = 1_IK) )
53 call disp%show(
"maxval(array, dim = 2_IK)")
54 call disp%show(
maxval(array,
dim = 2_IK) )
55 call disp%show(
"maxval([complex(CKG)::])")
56 call disp%show(
maxval([
complex(CKG)::]) )
57 call disp%show(
"maxval([complex(CKG)::], dim = 1_IK)")
58 call disp%show(
maxval([
complex(CKG)::],
dim = 1_IK) )
59 call disp%show(
"maxval([complex(CKG)::], dim = 2_IK)")
60 call disp%show(
maxval([
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(
"maxval(array, dim = 1_IK)")
77 call disp%show(
maxval(array,
dim = 1_IK) )
78 call disp%show(
"maxval(array, dim = 2_IK)")
79 call disp%show(
maxval(array,
dim = 2_IK) )
80 call disp%show(
"maxval([complex(CKG)::])")
81 call disp%show(
maxval([
complex(CKG)::]) )
82 call disp%show(
"maxval([complex(CKG)::], dim = 1_IK)")
83 call disp%show(
maxval([
complex(CKG)::],
dim = 1_IK) )
84 call disp%show(
"maxval([complex(CKG)::], dim = 2_IK)")
85 call disp%show(
maxval([
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.26138496,
-7.63509226), (
-3.60302639,
+6.34494019), (
+3.66101670,
-4.01944828), (
-7.83281898,
-8.78109169), (
-8.55279732,
+3.12572098)
6(
+1.94009018,
-4.78941536), (
+4.82917786,
+6.76107121), (
+2.19351673,
+2.37474632), (
+3.02538681,
-7.95628548), (
+0.398342133,
+3.10937881)
7(
+4.07444572,
+6.29988480), (
-0.759868622E-1,
+1.48970509), (
+2.41040039,
-4.69532681), (
-1.95439243,
+4.22284412), (
+7.06819725,
-4.02341461)
9(
+7.06819725,
+6.76107121)
10maxval(array,
dim = 1_IK)
11(
+4.26138496,
+6.29988480), (
+4.82917786,
+6.76107121), (
+3.66101670,
+2.37474632), (
+3.02538681,
+4.22284412), (
+7.06819725,
+3.12572098)
12maxval(array,
dim = 2_IK)
13(
+4.26138496,
+6.34494019), (
+4.82917786,
+6.76107121), (
+7.06819725,
+6.29988480)
14maxval([
complex(CKG)::])
15(
-0.340282347E+39,
-0.340282347E+39)
16maxval([
complex(CKG)::],
dim = 1_IK)
17(
-0.340282347E+39,
-0.340282347E+39)
18maxval([
complex(CKG)::],
dim = 2_IK)
19(
-0.340282347E+39,
-0.340282347E+39)
23array
= getUnifRand((
-9._CKG,
-9._CKG), (
+9._CKG,
+9._CKG), ndim, nsam)
25(
-1.1837541322223153,
+5.9171331511831937), (
+5.5864780830109915,
+6.5924523695937332), (
+1.9326968544389143,
+6.4977540108590528), (
-8.3851087822187296,
+7.6326672562243472), (
-0.55526566776130437E-1,
+6.3438837976101574)
26(
-1.9741874285487380,
+1.6251824573845930), (
-1.7493077005380666,
+5.3249062396390272), (
-1.5589757271053237,
-4.0918155612658200), (
+1.3014538768398083,
+7.4820873432149995), (
+5.7872672902206368,
-7.2196074013217313)
27(
-2.9794387620691105,
+5.6253233616703557), (
+0.49015114854415209,
+7.0670007282080940), (
-1.9753023376591674,
-6.2374186849497040), (
+3.5998561215334965,
+0.43664864558347993), (
+1.7849196172053730,
-3.6807637708276246)
29(
+5.7872672902206368,
+7.6326672562243472)
30maxval(array,
dim = 1_IK)
31(
-1.1837541322223153,
+5.9171331511831937), (
+5.5864780830109915,
+7.0670007282080940), (
+1.9326968544389143,
+6.4977540108590528), (
+3.5998561215334965,
+7.6326672562243472), (
+5.7872672902206368,
+6.3438837976101574)
32maxval(array,
dim = 2_IK)
33(
+5.5864780830109915,
+7.6326672562243472), (
+5.7872672902206368,
+7.4820873432149995), (
+3.5998561215334965,
+7.0670007282080940)
34maxval([
complex(CKG)::])
35(
-0.17976931348623157E+309,
-0.17976931348623157E+309)
36maxval([
complex(CKG)::],
dim = 1_IK)
37(
-0.17976931348623157E+309,
-0.17976931348623157E+309)
38maxval([
complex(CKG)::],
dim = 2_IK)
39(
-0.17976931348623157E+309,
-0.17976931348623157E+309)
43array
= getUnifRand((
-9._CKG,
-9._CKG), (
+9._CKG,
+9._CKG), ndim, nsam)
45(
-4.06485311095114125414908818292372411,
-0.162743380175149154249231152769296923), (
-8.38108673277496802477057227848020807,
-0.242911075229596546843163398642206153), (
+6.65100260983573134616147297174599385,
+2.42267977097133052542064327060713560), (
-2.63221518516574896334876932664103961,
-7.00087858431508233235420248332534933), (
+3.97054242144035269529176691584596125,
+0.651971695727090927026006730895624119)
46(
-2.64891157787664954304734916188964312,
-1.27103213701863283970212167841530050), (
+4.27036852600944813816093608854716488,
-1.05025288386525821307723604896231378), (
-0.553199474717277655547532917969349053,
-7.94668406585890374436877918412169018), (
+6.17814415548251700735955211755342647,
+5.59154262882225036465073611921417421), (
+1.80647047503606189920549419189156163,
-5.79380918800378482841290705937695078)
47(
-0.712649935840984667203179376929196155,
-7.91040566142524179788475981542316704), (
-7.30513074826826051189414259990509744,
-7.11602468622909367137636519728505159), (
-3.79064076959665900051560993431246189,
+0.271766737129032178817411608558247338), (
-1.13224776593465758512194274629081328,
+1.95520199534057967361811335140230603), (
+3.09396759485186285442026564028708267,
-7.26888927652889418993114613121523684)
49(
+6.65100260983573134616147297174599385,
+5.59154262882225036465073611921417421)
50maxval(array,
dim = 1_IK)
51(
-0.712649935840984667203179376929196155,
-0.162743380175149154249231152769296923), (
+4.27036852600944813816093608854716488,
-0.242911075229596546843163398642206153), (
+6.65100260983573134616147297174599385,
+2.42267977097133052542064327060713560), (
+6.17814415548251700735955211755342647,
+5.59154262882225036465073611921417421), (
+3.97054242144035269529176691584596125,
+0.651971695727090927026006730895624119)
52maxval(array,
dim = 2_IK)
53(
+6.65100260983573134616147297174599385,
+2.42267977097133052542064327060713560), (
+6.17814415548251700735955211755342647,
+5.59154262882225036465073611921417421), (
+3.09396759485186285442026564028708267,
+1.95520199534057967361811335140230603)
54maxval([
complex(CKG)::])
55(
-0.118973149535723176508575932662800702E+4933,
-0.118973149535723176508575932662800702E+4933)
56maxval([
complex(CKG)::],
dim = 1_IK)
57(
-0.118973149535723176508575932662800702E+4933,
-0.118973149535723176508575932662800702E+4933)
58maxval([
complex(CKG)::],
dim = 2_IK)
59(
-0.118973149535723176508575932662800702E+4933,
-0.118973149535723176508575932662800702E+4933)
- Test:
- test_pm_complexMinMax
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 646 of file pm_complexMinMax.F90.