https://www.cdslab.org/paramonte/fortran/2
Current view: top level - main - pm_mathMinMax@routines.inc.F90 (source / functions) Hit Total Coverage
Test: ParaMonte 2.0.0 :: Serial Fortran - Code Coverage Report Lines: 9 10 90.0 %
Date: 2024-04-08 03:18:57 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!                                                                                                                            !!!!
       4             : !!!!    ParaMonte: Parallel Monte Carlo and Machine Learning Library.                                                           !!!!
       5             : !!!!                                                                                                                            !!!!
       6             : !!!!    Copyright (C) 2012-present, The Computational Data Science Lab                                                          !!!!
       7             : !!!!                                                                                                                            !!!!
       8             : !!!!    This file is part of the ParaMonte library.                                                                             !!!!
       9             : !!!!                                                                                                                            !!!!
      10             : !!!!    LICENSE                                                                                                                 !!!!
      11             : !!!!                                                                                                                            !!!!
      12             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/LICENSE.md                                                          !!!!
      13             : !!!!                                                                                                                            !!!!
      14             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      15             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      16             : 
      17             : !>  \brief
      18             : !>  This include file contains procedure implementations of [pm_mathMinMax](@ref pm_mathMinMax).
      19             : !>
      20             : !>  \author
      21             : !>  \AmirShahmoradi, Sunday 3:33 AM, September 19, 2021, Dallas, TX
      22             : 
      23             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      24             : 
      25             :         ! DEfine the comparison operation.
      26             : #if     LK_ENABLED
      27             : #define IS_MORE(a,b) a .and. .not. b
      28             : #elif   CK_ENABLED
      29             : #define IS_MORE(a,b) a%re > b%re .or. (a%re == b%re .and. a%im > b%im)
      30             : #else
      31             : #define IS_MORE(a,b) a > b
      32             : #endif
      33             :         ! Define the pair.
      34             : #if     Pair_ENABLED
      35             : #define a pair(1)
      36             : #define b pair(2)
      37             : #elif   !Indi_ENABLED
      38             : #error  "Unrecognized interface."
      39             : #endif
      40             :         !%%%%%%%%%%%%%%%%
      41             : #if     getMinMax_ENABLED
      42             :         !%%%%%%%%%%%%%%%%
      43             : 
      44       48036 :         if (IS_MORE(a, b)) then
      45           2 :             minMax(1) = b
      46       24654 :             minMax(2) = a
      47             :         else
      48           0 :             minMax(1) = a
      49       23382 :             minMax(2) = b
      50             :         end if
      51             : 
      52             :         !%%%%%%%%%%%%%%%%
      53             : #elif   setMinMax_ENABLED
      54             :         !%%%%%%%%%%%%%%%%
      55             : 
      56             : #if     SK_ENABLED
      57           2 :         character(max(len(a,IK),len(b,IK)),SKC) :: tmp
      58             : #elif   IK_ENABLED
      59             :         integer(IKC) :: tmp
      60             : #elif   LK_ENABLED
      61             :         logical(LKC) :: tmp
      62             : #elif   CK_ENABLED
      63             :         complex(CKC) :: tmp
      64             : #elif   RK_ENABLED
      65             :         real(RKC) :: tmp
      66             : #elif   !getMinMax_ENABLED
      67             : #error  "Unrecognized interface."
      68             : #endif
      69          16 :         if (IS_MORE(a, b)) then
      70           2 :             tmp = a
      71           2 :             a = b
      72          12 :             b = tmp
      73             :         end if
      74             : #else
      75             :         !%%%%%%%%%%%%%%%%%%%%%%%%
      76             : #error  "Unrecognized interface."
      77             :         !%%%%%%%%%%%%%%%%%%%%%%%%
      78             : #endif
      79             : #undef  IS_MORE
      80             : #undef  a
      81             : #undef  b

ParaMonte: Parallel Monte Carlo and Machine Learning Library 
The Computational Data Science Lab
© Copyright 2012 - 2024