https://www.cdslab.org/paramonte/fortran/2
Current view: top level - main - pm_mathCumPropExp.F90 (source / functions) Hit Total Coverage
Test: ParaMonte 2.0.0 :: Serial Fortran - Code Coverage Report Lines: 13 13 100.0 %
Date: 2024-04-08 03:18:57 Functions: 1 1 100.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 module contains the procedures and interfaces for computing the
      19             : !>  cumulative sum of the exponential of an array without undue numerical overflow.
      20             : !>
      21             : !>  \benchmarks
      22             : !>
      23             : !>  \benchmark{getCumPropExp_vs_setCumPropExp, The runtime performance of [getCumPropExp](@ref pm_mathCumPropExp::getCumPropExp) vs. [setCumPropExp](@ref pm_mathCumPropExp::setCumPropExp)}
      24             : !>  \include{lineno} benchmark/pm_mathCumPropExp/getCumPropExp_vs_setCumPropExp/main.F90
      25             : !>  \compilefb{getCumPropExp_vs_setCumPropExp}
      26             : !>  \postprocb{getCumPropExp_vs_setCumPropExp}
      27             : !>  \include{lineno} benchmark/pm_mathCumPropExp/getCumPropExp_vs_setCumPropExp/main.py
      28             : !>  \visb{getCumPropExp_vs_setCumPropExp}
      29             : !>  \image html benchmark/pm_mathCumPropExp/getCumPropExp_vs_setCumPropExp/benchmark.getCumPropExp_vs_setCumPropExp.runtime.png width=1000
      30             : !>  \image html benchmark/pm_mathCumPropExp/getCumPropExp_vs_setCumPropExp/benchmark.getCumPropExp_vs_setCumPropExp.runtime.ratio.png width=1000
      31             : !>  \moralb{getCumPropExp_vs_setCumPropExp}
      32             : !>      -#  The procedures under the generic interface [getCumPropExp](@ref pm_mathCumPropExp::getCumPropExp) are functions while
      33             : !>          the procedures under the generic interface [setCumPropExp](@ref pm_mathCumPropExp::setCumPropExp) are subroutines.<br>
      34             : !>          From the benchmark results, it appears that the functional interface performs significantly worse than the procedural interface.<br>
      35             : !>          However, the difference appears to diminish toward larger array sizes.<br>
      36             : !>
      37             : !>  \test
      38             : !>  [test_pm_mathCumPropExp](@ref test_pm_mathCumPropExp)
      39             : !>
      40             : !>  \finmain
      41             : !>
      42             : !>  \author
      43             : !>  \AmirShahmoradi, April 25, 2015, 2:21 PM, National Institute for Fusion Studies, The University of Texas at Austin
      44             : 
      45             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      46             : 
      47             : module pm_mathCumPropExp
      48             : 
      49             :     use pm_control, only: control_type, sequence_type, sequence
      50             :     use pm_control, only: selection_type, selection
      51             :     use pm_array, only: direction_type, action_type
      52             :     use pm_array, only: backward, backward_type
      53             :     use pm_array, only: forward, forward_type
      54             :     use pm_array, only: reverse, reverse_type
      55             :     use pm_array, only: nothing, nothing_type
      56             :     use pm_kind, only: SK, IK, LK
      57             :     implicit none
      58             : 
      59             :     character(*, SK), parameter :: MODULE_NAME = "@pm_mathCumPropExp"
      60             : 
      61             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      62             : 
      63             :     !>  \brief
      64             :     !>  Generate and return the cumulative sum of the proportions of the exponential of the input array,
      65             :     !>  optionally in the backward direction and, optionally reverse the output cumulative sum upon return.
      66             :     !>
      67             :     !>  \details
      68             :     !>  The returned array is normalized such that all of its elements fall in the range \f$[0,1]\f$.<br>
      69             :     !>  All operations are performed while avoiding arithmetic overflow.<br>
      70             :     !>
      71             :     !>  \param[in]  array       :   The input `contiguous` array of shape `(:)` of type `real` of kind \RKALL
      72             :     !>                              whose cumulative proportional sum will have to be computed.
      73             :     !>  \param[in]  maxArray    :   The input scalar of the same type and kind as the input `array` representing
      74             :     !>                              the maximum value in `array` (i.e., `maxArray = maxval(array)`).
      75             :     !>  \param[in]  control     :   The input scalar object that can be,
      76             :     !>                              <ol>
      77             :     !>                                  <li>    the constant [sequence](@ref pm_control::sequence) or equivalently,
      78             :     !>                                          an object of type [sequence_type](@ref pm_control::sequence_type).<br>
      79             :     !>                                          Specifying this value forces the algorithm to skip runtime underflow checks.<br>
      80             :     !>                                          This means all exponentiation operations will be carried out for each element.<br>
      81             :     !>                                          Specifying this value can aid runtime efficiency when the divisions of none or very few
      82             :     !>                                          of the elements of `array` (for example, half or less) by `maxArray` causes underflow.<br>
      83             :     !>                                          In such cases, the potentially expensive runtime branching is avoided at the cost of performing a very few exponentiation operations.<br>
      84             :     !>                                          The typical cost of an if-branch is 7-20 CPU cycles on the contemporary architecture while exponentiation typically costs ~200 CPU cycles.<br>
      85             :     !>                                          See [the relevant benchmark here](#benchmark-setCumPropExp).<br>
      86             :     !>                                  <li>    the constant [selection](@ref pm_control::selection) or equivalently,
      87             :     !>                                          an object of type [selection_type](@ref pm_control::selection_type).<br>
      88             :     !>                                          Enabling this option can aid runtime efficiency when the division of a significant
      89             :     !>                                          number of elements of `array` (for example, half or more) by `maxArray` causes underflow.<br>
      90             :     !>                                          In such cases, the exponentiation is avoided if `control` = selection` leading to faster runtime
      91             :     !>                                          by avoiding exponentiation since it is highly expensive (on the order of ~200 CPU cycles).<br>
      92             :     !>                                          See [the relevant benchmark here](#benchmark-setCumPropExp).<br>
      93             :     !>                              </ol>
      94             :     !>                              (**optional**, default = [sequence](@ref pm_control::sequence))
      95             :     !>  \param[in]  direction   :   The input scalar object that can be,
      96             :     !>                              <ol>
      97             :     !>                                  <li>    the constant [forward](@ref pm_array::forward) or equivalently, an object of type [forward_type](@ref pm_array::forward_type),
      98             :     !>                                          implying that the output cumulative sum has be computed from the **first element** to the **last element** of the input `array`.<br>
      99             :     !>                                          even though the increments will still be written from the first element of `cumPropExp` to the last.<br>
     100             :     !>                                  <li>    the constant [backward](@ref pm_array::backward) or equivalently, an object of type [backward_type](@ref pm_array::backward_type),
     101             :     !>                                          implying that the output cumulative sum has be computed from the **last element** to the **first element** of the input `array`
     102             :     !>                                          even though the increments will still be written from the first element of `cumPropExp` to the last.<br>
     103             :     !>                              </ol>
     104             :     !>                              (**optional**, default = [sequence](@ref pm_control::sequence))
     105             :     !>  \param[in]  action      :   The input scalar object that can be,
     106             :     !>                              <ol>
     107             :     !>                                  <li>    the constant [nothing](@ref pm_array::nothing) or equivalently, an object of type [nothing_type](@ref pm_array::nothing_type),
     108             :     !>                                          implying no action to be performed on the elements of the output `cumPropExp` will have be reversed upon return.<br>
     109             :     !>                                  <li>    the constant [reverse](@ref pm_array::reverse) or equivalently, an object of type [reverse_type](@ref pm_array::reverse_type),
     110             :     !>                                          implying that the order of the elements of the output `cumPropExp` will have be reversed upon return,
     111             :     !>                                          such that its last element becomes the first.<br>
     112             :     !>                              </ol>
     113             :     !>                              (**optional**, default = [nothing](@ref pm_array::nothing))
     114             :     !>
     115             :     !>  \return
     116             :     !>  `cumPropExp`            :   The output array of the same size, shape, type, and kind as the input `array`
     117             :     !>                              containing the cumulative sum of proportions of `array` in the specified direction.
     118             :     !>
     119             :     !>  \interface{getCumPropExp}
     120             :     !>  \code{.F90}
     121             :     !>
     122             :     !>      use pm_mathCumPropExp, only: getCumPropExp, sequence, selection, forward, backward, nothing, reverse
     123             :     !>
     124             :     !>      cumPropExp(:) = getCumPropExp(array(:)          , maxArray = maxArray, direction = direction, action = action)
     125             :     !>      cumPropExp(:) = getCumPropExp(array(:), control , maxArray = maxArray, direction = direction, action = action)
     126             :     !>
     127             :     !>  \endcode
     128             :     !>
     129             :     !>  \warning
     130             :     !>  The condition `maxArray == maxval(array)` must hold for the corresponding arguments.<br>
     131             :     !>  \vericon
     132             :     !>
     133             :     !>  \warnpure
     134             :     !>
     135             :     !>  \note
     136             :     !>  The functionalities of the procedures under this generic interface,
     137             :     !>  \code{.F90}
     138             :     !>      block
     139             :     !>          use pm_mathCumPropExp, only: getCumPropExp
     140             :     !>          cumPropExp = getCumPropExp(array)
     141             :     !>          cumPropExp = getCumPropExp(array, direction = backward)
     142             :     !>          cumPropExp = getCumPropExp(array, direction = backward, action = reversed)
     143             :     !>          cumPropExp = getCumPropExp(array, direction = forward, action = reversed)
     144             :     !>      end block
     145             :     !>      !
     146             :     !>  \endcode
     147             :     !>  are equivalent to the following lines respectively,
     148             :     !>  \code{.F90}
     149             :     !>      block
     150             :     !>          use pm_mathCumPropExp, only: getCumSum
     151             :     !>          cumPropExp = getCumSum(exp(array - maxval(array))); cumPropExp = cumPropExp / cumPropExp(size(array, maxArray, 1, IK))
     152             :     !>          cumPropExp = getCumSum(exp(array - maxval(array)), direction = backward); cumPropExp = cumPropExp / cumPropExp(size(array, maxArray, 1, IK))
     153             :     !>          cumPropExp = getCumSum(exp(array - maxval(array)), direction = backward, action = reversed); cumPropExp = cumPropExp / cumPropExp(1)
     154             :     !>          cumPropExp = getCumSum(exp(array - maxval(array)), direction = forward, action = reversed); cumPropExp = cumPropExp / cumPropExp(1)
     155             :     !>      end block
     156             :     !>      !
     157             :     !>  \endcode
     158             :     !>
     159             :     !>  \see
     160             :     !>  [getCumSum](@ref pm_mathCumSum::getCumSum)<br>
     161             :     !>  [setCumSum](@ref pm_mathCumSum::setCumSum)<br>
     162             :     !>  [getCumPropExp](@ref pm_mathCumPropExp::getCumPropExp)<br>
     163             :     !>  [setCumPropExp](@ref pm_mathCumPropExp::setCumPropExp)<br>
     164             :     !>
     165             :     !>  \example{getCumPropExp}
     166             :     !>  \include{lineno} example/pm_mathCumPropExp/getCumPropExp/main.F90
     167             :     !>  \compilef{getCumPropExp}
     168             :     !>  \output{getCumPropExp}
     169             :     !>  \include{lineno} example/pm_mathCumPropExp/getCumPropExp/main.out.F90
     170             :     !>
     171             :     !>  \test
     172             :     !>  [test_pm_mathCumPropExp](@ref test_pm_mathCumPropExp)
     173             :     !>
     174             :     !>  \finmain{getCumPropExp}
     175             :     !>
     176             :     !>  \author
     177             :     !>  \AmirShahmoradi, April 25, 2015, 2:21 PM, National Institute for Fusion Studies, The University of Texas at Austin
     178             :     interface getCumPropExp
     179             : 
     180             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     181             : 
     182             : 
     183             : #if RK5_ENABLED
     184             :     PURE module function getCumPropExpDef_RK5(array, maxArray, direction, action) result(cumPropExp)
     185             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     186             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpDef_RK5
     187             : #endif
     188             :         use pm_kind, only: RKC => RK5
     189             :         real(RKC)               , intent(in), contiguous    :: array(:)
     190             :         real(RKC)               , intent(in)                :: maxArray
     191             :         class(direction_type)   , intent(in), optional      :: direction
     192             :         class(action_type)      , intent(in), optional      :: action
     193             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     194             :     end function
     195             : #endif
     196             : 
     197             : #if RK4_ENABLED
     198             :     PURE module function getCumPropExpDef_RK4(array, maxArray, direction, action) result(cumPropExp)
     199             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     200             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpDef_RK4
     201             : #endif
     202             :         use pm_kind, only: RKC => RK4
     203             :         real(RKC)               , intent(in), contiguous    :: array(:)
     204             :         real(RKC)               , intent(in)                :: maxArray
     205             :         class(direction_type)   , intent(in), optional      :: direction
     206             :         class(action_type)      , intent(in), optional      :: action
     207             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     208             :     end function
     209             : #endif
     210             : 
     211             : #if RK3_ENABLED
     212             :     PURE module function getCumPropExpDef_RK3(array, maxArray, direction, action) result(cumPropExp)
     213             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     214             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpDef_RK3
     215             : #endif
     216             :         use pm_kind, only: RKC => RK3
     217             :         real(RKC)               , intent(in), contiguous    :: array(:)
     218             :         real(RKC)               , intent(in)                :: maxArray
     219             :         class(direction_type)   , intent(in), optional      :: direction
     220             :         class(action_type)      , intent(in), optional      :: action
     221             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     222             :     end function
     223             : #endif
     224             : 
     225             : #if RK2_ENABLED
     226             :     PURE module function getCumPropExpDef_RK2(array, maxArray, direction, action) result(cumPropExp)
     227             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     228             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpDef_RK2
     229             : #endif
     230             :         use pm_kind, only: RKC => RK2
     231             :         real(RKC)               , intent(in), contiguous    :: array(:)
     232             :         real(RKC)               , intent(in)                :: maxArray
     233             :         class(direction_type)   , intent(in), optional      :: direction
     234             :         class(action_type)      , intent(in), optional      :: action
     235             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     236             :     end function
     237             : #endif
     238             : 
     239             : #if RK1_ENABLED
     240             :     PURE module function getCumPropExpDef_RK1(array, maxArray, direction, action) result(cumPropExp)
     241             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     242             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpDef_RK1
     243             : #endif
     244             :         use pm_kind, only: RKC => RK1
     245             :         real(RKC)               , intent(in), contiguous    :: array(:)
     246             :         real(RKC)               , intent(in)                :: maxArray
     247             :         class(direction_type)   , intent(in), optional      :: direction
     248             :         class(action_type)      , intent(in), optional      :: action
     249             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     250             :     end function
     251             : #endif
     252             : 
     253             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     254             : 
     255             : #if RK5_ENABLED
     256             :     PURE module function getCumPropExpSel_RK5(array, maxArray, control, direction, action) result(cumPropExp)
     257             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     258             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpSel_RK5
     259             : #endif
     260             :         use pm_kind, only: RKC => RK5
     261             :         real(RKC)               , intent(in), contiguous    :: array(:)
     262             :         real(RKC)               , intent(in)                :: maxArray
     263             :         type(selection_type)    , intent(in)                :: control
     264             :         class(direction_type)   , intent(in), optional      :: direction
     265             :         class(action_type)      , intent(in), optional      :: action
     266             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     267             :     end function
     268             : #endif
     269             : 
     270             : #if RK4_ENABLED
     271             :     PURE module function getCumPropExpSel_RK4(array, maxArray, control, direction, action) result(cumPropExp)
     272             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     273             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpSel_RK4
     274             : #endif
     275             :         use pm_kind, only: RKC => RK4
     276             :         real(RKC)               , intent(in), contiguous    :: array(:)
     277             :         real(RKC)               , intent(in)                :: maxArray
     278             :         type(selection_type)    , intent(in)                :: control
     279             :         class(direction_type)   , intent(in), optional      :: direction
     280             :         class(action_type)      , intent(in), optional      :: action
     281             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     282             :     end function
     283             : #endif
     284             : 
     285             : #if RK3_ENABLED
     286             :     PURE module function getCumPropExpSel_RK3(array, maxArray, control, direction, action) result(cumPropExp)
     287             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     288             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpSel_RK3
     289             : #endif
     290             :         use pm_kind, only: RKC => RK3
     291             :         real(RKC)               , intent(in), contiguous    :: array(:)
     292             :         real(RKC)               , intent(in)                :: maxArray
     293             :         type(selection_type)    , intent(in)                :: control
     294             :         class(direction_type)   , intent(in), optional      :: direction
     295             :         class(action_type)      , intent(in), optional      :: action
     296             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     297             :     end function
     298             : #endif
     299             : 
     300             : #if RK2_ENABLED
     301             :     PURE module function getCumPropExpSel_RK2(array, maxArray, control, direction, action) result(cumPropExp)
     302             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     303             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpSel_RK2
     304             : #endif
     305             :         use pm_kind, only: RKC => RK2
     306             :         real(RKC)               , intent(in), contiguous    :: array(:)
     307             :         real(RKC)               , intent(in)                :: maxArray
     308             :         type(selection_type)    , intent(in)                :: control
     309             :         class(direction_type)   , intent(in), optional      :: direction
     310             :         class(action_type)      , intent(in), optional      :: action
     311             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     312             :     end function
     313             : #endif
     314             : 
     315             : #if RK1_ENABLED
     316             :     PURE module function getCumPropExpSel_RK1(array, maxArray, control, direction, action) result(cumPropExp)
     317             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     318             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpSel_RK1
     319             : #endif
     320             :         use pm_kind, only: RKC => RK1
     321             :         real(RKC)               , intent(in), contiguous    :: array(:)
     322             :         real(RKC)               , intent(in)                :: maxArray
     323             :         type(selection_type)    , intent(in)                :: control
     324             :         class(direction_type)   , intent(in), optional      :: direction
     325             :         class(action_type)      , intent(in), optional      :: action
     326             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     327             :     end function
     328             : #endif
     329             : 
     330             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     331             : 
     332             : #if RK5_ENABLED
     333             :     PURE module function getCumPropExpSeq_RK5(array, maxArray, control, direction, action) result(cumPropExp)
     334             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     335             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpSeq_RK5
     336             : #endif
     337             :         use pm_kind, only: RKC => RK5
     338             :         real(RKC)               , intent(in), contiguous    :: array(:)
     339             :         real(RKC)               , intent(in)                :: maxArray
     340             :         type(sequence_type)     , intent(in)                :: control
     341             :         class(direction_type)   , intent(in), optional      :: direction
     342             :         class(action_type)      , intent(in), optional      :: action
     343             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     344             :     end function
     345             : #endif
     346             : 
     347             : #if RK4_ENABLED
     348             :     PURE module function getCumPropExpSeq_RK4(array, maxArray, control, direction, action) result(cumPropExp)
     349             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     350             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpSeq_RK4
     351             : #endif
     352             :         use pm_kind, only: RKC => RK4
     353             :         real(RKC)               , intent(in), contiguous    :: array(:)
     354             :         real(RKC)               , intent(in)                :: maxArray
     355             :         type(sequence_type)     , intent(in)                :: control
     356             :         class(direction_type)   , intent(in), optional      :: direction
     357             :         class(action_type)      , intent(in), optional      :: action
     358             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     359             :     end function
     360             : #endif
     361             : 
     362             : #if RK3_ENABLED
     363             :     PURE module function getCumPropExpSeq_RK3(array, maxArray, control, direction, action) result(cumPropExp)
     364             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     365             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpSeq_RK3
     366             : #endif
     367             :         use pm_kind, only: RKC => RK3
     368             :         real(RKC)               , intent(in), contiguous    :: array(:)
     369             :         real(RKC)               , intent(in)                :: maxArray
     370             :         type(sequence_type)     , intent(in)                :: control
     371             :         class(direction_type)   , intent(in), optional      :: direction
     372             :         class(action_type)      , intent(in), optional      :: action
     373             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     374             :     end function
     375             : #endif
     376             : 
     377             : #if RK2_ENABLED
     378             :     PURE module function getCumPropExpSeq_RK2(array, maxArray, control, direction, action) result(cumPropExp)
     379             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     380             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpSeq_RK2
     381             : #endif
     382             :         use pm_kind, only: RKC => RK2
     383             :         real(RKC)               , intent(in), contiguous    :: array(:)
     384             :         real(RKC)               , intent(in)                :: maxArray
     385             :         type(sequence_type)     , intent(in)                :: control
     386             :         class(direction_type)   , intent(in), optional      :: direction
     387             :         class(action_type)      , intent(in), optional      :: action
     388             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     389             :     end function
     390             : #endif
     391             : 
     392             : #if RK1_ENABLED
     393             :     PURE module function getCumPropExpSeq_RK1(array, maxArray, control, direction, action) result(cumPropExp)
     394             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     395             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExpSeq_RK1
     396             : #endif
     397             :         use pm_kind, only: RKC => RK1
     398             :         real(RKC)               , intent(in), contiguous    :: array(:)
     399             :         real(RKC)               , intent(in)                :: maxArray
     400             :         type(sequence_type)     , intent(in)                :: control
     401             :         class(direction_type)   , intent(in), optional      :: direction
     402             :         class(action_type)      , intent(in), optional      :: action
     403             :         real(RKC)                                           :: cumPropExp(size(array, 1, IK))
     404             :     end function
     405             : #endif
     406             : 
     407             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     408             : 
     409             :     end interface getCumPropExp
     410             : 
     411             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     412             : 
     413             :     !>  \brief
     414             :     !>  Return the cumulative sum of the proportions of the exponential of the input array,
     415             :     !>  optionally in the backward direction and, optionally reverse the output cumulative sum upon return.
     416             :     !>
     417             :     !>  \details
     418             :     !>  The returned array is normalized such that all of its elements fall in the range \f$[0,1]\f$.<br>
     419             :     !>  All operations are performed while avoiding arithmetic overflow.
     420             :     !>
     421             :     !>  \param[out]     cumPropExp      :   The output array of the same size, shape, type, and kind as the input `array`
     422             :     !>                                      containing the cumulative sum of proportions of `array` in the specified direction.<br>
     423             :     !>                                      (**optional**, if missing, the result will be written to the input/output argument `array`.)
     424             :     !>  \param[inout]   array           :   The `contiguous` array of shape `(:)` of type `real` of kind \RKALL
     425             :     !>                                      whose cumulative proportional sum will have to be computed.<br>
     426             :     !>                                      <ul>
     427             :     !>                                          <li>    If `cumPropExp` is present, then `array` has `intent(in)`.<br>
     428             :     !>                                          <li>    If `cumPropExp` is missing, then `array` has `intent(inout)`.<br>
     429             :     !>                                                  On output, the contents of `array` will be completely overwritten by the computed `cumPropExp`.<br>
     430             :     !>                                      </ul>
     431             :     !>  \param[in]      maxArray        :   The input scalar of the same type and kind as the input `array` representing
     432             :     !>                                      the maximum value in `array` (i.e., `maxArray = maxval(array)`).
     433             :     !>  \param[in]      control         :   The input scalar object that can be,
     434             :     !>                                      <ol>
     435             :     !>                                          <li>    the constant [sequence](@ref pm_control::sequence) or equivalently,
     436             :     !>                                                  an object of type [sequence_type](@ref pm_control::sequence_type).<br>
     437             :     !>                                                  Specifying this value forces the algorithm to skip runtime underflow checks.<br>
     438             :     !>                                                  This means all exponentiation operations will be carried out for each element.<br>
     439             :     !>                                                  Specifying this value can aid runtime efficiency when the divisions of none or very few
     440             :     !>                                                  of the elements of `array` (for example, half or less) by `maxArray` causes underflow.<br>
     441             :     !>                                                  In such cases, the potentially expensive runtime branching is avoided at the cost of performing a very few exponentiation operations.<br>
     442             :     !>                                                  The typical cost of an if-branch is 7-20 CPU cycles on the contemporary architecture while exponentiation typically costs ~200 CPU cycles.<br>
     443             :     !>                                                  See [the relevant benchmark here](#benchmark-setCumPropExp).<br>
     444             :     !>                                          <li>    the constant [selection](@ref pm_control::selection) or equivalently,
     445             :     !>                                                  an object of type [selection_type](@ref pm_control::selection_type).<br>
     446             :     !>                                                  Enabling this option can aid runtime efficiency when the division of a significant
     447             :     !>                                                  number of elements of `array` (for example, half or more) by `maxArray` causes underflow.<br>
     448             :     !>                                                  In such cases, the exponentiation is avoided if `control` = selection` leading to faster runtime
     449             :     !>                                                  by avoiding exponentiation since it is highly expensive (on the order of ~200 CPU cycles).<br>
     450             :     !>                                                  See [the relevant benchmark here](#benchmark-setCumPropExp).<br>
     451             :     !>                                      </ol>
     452             :     !>  \param[in]      direction       :   The input scalar object that can be,
     453             :     !>                                      <ol>
     454             :     !>                                          <li>    the constant [forward](@ref pm_array::forward) or equivalently, an object of type [forward_type](@ref pm_array::forward_type),
     455             :     !>                                                  implying that the output cumulative sum has be computed from the **first element** to the **last element** of the input `array`.<br>
     456             :     !>                                                  even though the increments will still be written from the first element of `cumPropExp` to the last.<br>
     457             :     !>                                          <li>    the constant [backward](@ref pm_array::backward) or equivalently, an object of type [backward_type](@ref pm_array::backward_type),
     458             :     !>                                                  implying that the output cumulative sum has be computed from the **last element** to the **first element** of the input `array`
     459             :     !>                                                  even though the increments will still be written from the first element of `cumPropExp` to the last.<br>
     460             :     !>                                      </ol>
     461             :     !>                                      (**optional**, default = [sequence](@ref pm_control::sequence). It must be present **if and only if** the input argument `action` is also present.)
     462             :     !>  \param[in]      action          :   The input scalar object that can be,
     463             :     !>                                      <ol>
     464             :     !>                                          <li>    the constant [nothing](@ref pm_array::nothing) or equivalently, an object of type [nothing_type](@ref pm_array::nothing_type),
     465             :     !>                                                  implying no action to be performed on the elements of the output `cumPropExp` will have be reversed upon return.<br>
     466             :     !>                                          <li>    the constant [reverse](@ref pm_array::reverse) or equivalently, an object of type [reverse_type](@ref pm_array::reverse_type),
     467             :     !>                                                  implying that the order of the elements of the output `cumPropExp` will have be reversed upon return,
     468             :     !>                                                  such that its last element becomes the first.<br>
     469             :     !>                                      </ol>
     470             :     !>                                      (**optional**, default = [nothing](@ref pm_array::nothing). It must be present **if and only if** the input argument `direction` is also present.)
     471             :     !>
     472             :     !>  \interface{setCumPropExp}
     473             :     !>  \code{.F90}
     474             :     !>
     475             :     !>      use pm_mathCumPropExp, only: setCumPropExp
     476             :     !>      use pm_mathCumPropExp, only: selection, sequence, forward, backward, nothing, reverse
     477             :     !>
     478             :     !>      ! overwrite input array.
     479             :     !>
     480             :     !>      call setCumPropExp(array(:), maxArray, control)
     481             :     !>      call setCumPropExp(array(:), maxArray, control, direction, action)
     482             :     !>
     483             :     !>      ! write to new array.
     484             :     !>
     485             :     !>      call setCumPropExp(cumPropExp(:), array(:), maxArray, control)
     486             :     !>      call setCumPropExp(cumPropExp(:), array(:), maxArray, control, direction, action)
     487             :     !>
     488             :     !>  \endcode
     489             :     !>
     490             :     !>  \warning
     491             :     !>  The condition `0 < size(array)` must hold for the corresponding arguments.<br>
     492             :     !>  The condition `maxArray == maxval(array)` must hold for the corresponding arguments.<br>
     493             :     !>  The condition `size(array) == size(cumPropExp)` must hold for the corresponding arguments.<br>
     494             :     !>  \vericons
     495             :     !>
     496             :     !>  \warnpure
     497             :     !>
     498             :     !>  \note
     499             :     !>  The functionalities of the procedures under this generic interface,
     500             :     !>  \code{.F90}
     501             :     !>      block
     502             :     !>          use pm_mathCumPropExp, only: setCumPropExp
     503             :     !>          call setCumPropExp(cumPropExp, array, maxArray, control)
     504             :     !>          call setCumPropExp(cumPropExp, array, maxArray, control, direction = backward)
     505             :     !>          call setCumPropExp(cumPropExp, array, maxArray, control, direction = backward, action = reverse)
     506             :     !>          call setCumPropExp(cumPropExp, array, maxArray, control, direction = forward, action = reverse)
     507             :     !>      end block
     508             :     !>      !
     509             :     !>  \endcode
     510             :     !>  are equivalent to the following lines respectively,
     511             :     !>  \code{.F90}
     512             :     !>      block
     513             :     !>          use pm_mathCumPropExp, only: getCumSum
     514             :     !>          cumPropExp = getCumSum(exp(array - maxval(array))); cumPropExp = cumPropExp / cumPropExp(size(array, maxArray, 1, IK))
     515             :     !>          cumPropExp = getCumSum(exp(array - maxval(array)), direction = backward); cumPropExp = cumPropExp / cumPropExp(size(array, maxArray, 1, IK))
     516             :     !>          cumPropExp = getCumSum(exp(array - maxval(array)), direction = backward, action = reversed); cumPropExp = cumPropExp / cumPropExp(1)
     517             :     !>          cumPropExp = getCumSum(exp(array - maxval(array)), direction = forward, action = reversed); cumPropExp = cumPropExp / cumPropExp(1)
     518             :     !>      end block
     519             :     !>      !
     520             :     !>  \endcode
     521             :     !>
     522             :     !>  \see
     523             :     !>  [getCumSum](@ref pm_mathCumSum::getCumSum)<br>
     524             :     !>  [setCumSum](@ref pm_mathCumSum::setCumSum)<br>
     525             :     !>  [getCumPropExp](@ref pm_mathCumPropExp::getCumPropExp)<br>
     526             :     !>  [setCumPropExp](@ref pm_mathCumPropExp::setCumPropExp)<br>
     527             :     !>
     528             :     !>  \example{setCumPropExp}
     529             :     !>  \include{lineno} example/pm_mathCumPropExp/setCumPropExp/main.F90
     530             :     !>  \compilef{setCumPropExp}
     531             :     !>  \output{setCumPropExp}
     532             :     !>  \include{lineno} example/pm_mathCumPropExp/setCumPropExp/main.out.F90
     533             :     !>
     534             :     !>  \benchmarks
     535             :     !>
     536             :     !>  \benchmark{setCumPropExp, The effects of `control` on runtime efficiency}
     537             :     !>      The following program compares the runtime performance of [setCumPropExp](@ref pm_mathCumPropExp::setCumPropExp)
     538             :     !>      algorithm with and without checking for underflows.
     539             :     !>  \include{lineno} benchmark/pm_mathCumPropExp/setCumPropExp/main.F90
     540             :     !>  \compilefb{setCumPropExp}
     541             :     !>  \postprocb{setCumPropExp}
     542             :     !>  \include{lineno} benchmark/pm_mathCumPropExp/setCumPropExp/main.py
     543             :     !>  \visb{setCumPropExp}
     544             :     !>  \image html benchmark/pm_mathCumPropExp/setCumPropExp/benchmark.setCumPropExp.normal.png width=1000
     545             :     !>  \image html benchmark/pm_mathCumPropExp/setCumPropExp/benchmark.setCumPropExp.underflow.png width=1000
     546             :     !>  \moralb{setCumPropExp}
     547             :     !>      -#  If the input array has many (half the size of array or more) elements whose division by the `maxval(array)` causes underflow,
     548             :     !>          then setting `control = selection` when calling [setCumPropExp](@ref pm_mathCumPropExp::setCumPropExp) will likely result in a faster runtime.<br>
     549             :     !>          Conversely, if the divisions are not expected to cause any or too many underflows, then set `control = selection`
     550             :     !>          to improve cache coherence and runtime performance (at the expense of occasional expensive but redundant exponentiations).<br>
     551             :     !>      -#  If the input array size is less than 10-20 elements and [setCumPropExp](@ref pm_mathCumPropExp::setCumPropExp) is to be
     552             :     !>          called billions of times, then it would make sense to manually inline the procedure implementation in your code as
     553             :     !>          procedure call and processing of optional arguments will have a non-negligible performance overhead.
     554             :     !>
     555             :     !>  \test
     556             :     !>  [test_pm_mathCumPropExp](@ref test_pm_mathCumPropExp)
     557             :     !>
     558             :     !>  \todo
     559             :     !>  \plow
     560             :     !>  This generic interface can be expanded to include input arrays with `Weight`s.
     561             :     !>
     562             :     !>  \finmain{setCumPropExp}
     563             :     !>
     564             :     !>  \author
     565             :     !>  \AmirShahmoradi, April 25, 2015, 2:21 PM, National Institute for Fusion Studies, The University of Texas at Austin
     566             : 
     567             :     ! seq, old, new, default
     568             : 
     569             :     interface setCumPropExp
     570             : 
     571             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     572             : 
     573             : #if RK5_ENABLED
     574             :     PURE module subroutine setCumPropExpSeqOldDefDef_RK5(array, maxArray, control)
     575             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     576             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldDefDef_RK5
     577             : #endif
     578             :         use pm_kind, only: RKC => RK5
     579             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     580             :         real(RKC)           , intent(in)                    :: maxArray
     581             :         type(sequence_type) , intent(in)                    :: control
     582             :     end subroutine
     583             : #endif
     584             : 
     585             : #if RK4_ENABLED
     586             :     PURE module subroutine setCumPropExpSeqOldDefDef_RK4(array, maxArray, control)
     587             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     588             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldDefDef_RK4
     589             : #endif
     590             :         use pm_kind, only: RKC => RK4
     591             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     592             :         real(RKC)           , intent(in)                    :: maxArray
     593             :         type(sequence_type) , intent(in)                    :: control
     594             :     end subroutine
     595             : #endif
     596             : 
     597             : #if RK3_ENABLED
     598             :     PURE module subroutine setCumPropExpSeqOldDefDef_RK3(array, maxArray, control)
     599             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     600             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldDefDef_RK3
     601             : #endif
     602             :         use pm_kind, only: RKC => RK3
     603             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     604             :         real(RKC)           , intent(in)                    :: maxArray
     605             :         type(sequence_type) , intent(in)                    :: control
     606             :     end subroutine
     607             : #endif
     608             : 
     609             : #if RK2_ENABLED
     610             :     PURE module subroutine setCumPropExpSeqOldDefDef_RK2(array, maxArray, control)
     611             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     612             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldDefDef_RK2
     613             : #endif
     614             :         use pm_kind, only: RKC => RK2
     615             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     616             :         real(RKC)           , intent(in)                    :: maxArray
     617             :         type(sequence_type) , intent(in)                    :: control
     618             :     end subroutine
     619             : #endif
     620             : 
     621             : #if RK1_ENABLED
     622             :     PURE module subroutine setCumPropExpSeqOldDefDef_RK1(array, maxArray, control)
     623             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     624             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldDefDef_RK1
     625             : #endif
     626             :         use pm_kind, only: RKC => RK1
     627             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     628             :         real(RKC)           , intent(in)                    :: maxArray
     629             :         type(sequence_type) , intent(in)                    :: control
     630             :     end subroutine
     631             : #endif
     632             : 
     633             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     634             : 
     635             : #if RK5_ENABLED
     636             :     PURE module subroutine setCumPropExpSeqNewDefDef_RK5(cumPropExp, array, maxArray, control)
     637             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     638             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewDefDef_RK5
     639             : #endif
     640             :         use pm_kind, only: RKC => RK5
     641             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
     642             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
     643             :         real(RKC)           , intent(in)                    :: maxArray
     644             :         type(sequence_type) , intent(in)                    :: control
     645             :     end subroutine
     646             : #endif
     647             : 
     648             : #if RK4_ENABLED
     649             :     PURE module subroutine setCumPropExpSeqNewDefDef_RK4(cumPropExp, array, maxArray, control)
     650             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     651             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewDefDef_RK4
     652             : #endif
     653             :         use pm_kind, only: RKC => RK4
     654             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
     655             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
     656             :         real(RKC)           , intent(in)                    :: maxArray
     657             :         type(sequence_type) , intent(in)                    :: control
     658             :     end subroutine
     659             : #endif
     660             : 
     661             : #if RK3_ENABLED
     662             :     PURE module subroutine setCumPropExpSeqNewDefDef_RK3(cumPropExp, array, maxArray, control)
     663             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     664             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewDefDef_RK3
     665             : #endif
     666             :         use pm_kind, only: RKC => RK3
     667             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
     668             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
     669             :         real(RKC)           , intent(in)                    :: maxArray
     670             :         type(sequence_type) , intent(in)                    :: control
     671             :     end subroutine
     672             : #endif
     673             : 
     674             : #if RK2_ENABLED
     675             :     PURE module subroutine setCumPropExpSeqNewDefDef_RK2(cumPropExp, array, maxArray, control)
     676             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     677             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewDefDef_RK2
     678             : #endif
     679             :         use pm_kind, only: RKC => RK2
     680             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
     681             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
     682             :         real(RKC)           , intent(in)                    :: maxArray
     683             :         type(sequence_type) , intent(in)                    :: control
     684             :     end subroutine
     685             : #endif
     686             : 
     687             : #if RK1_ENABLED
     688             :     PURE module subroutine setCumPropExpSeqNewDefDef_RK1(cumPropExp, array, maxArray, control)
     689             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     690             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewDefDef_RK1
     691             : #endif
     692             :         use pm_kind, only: RKC => RK1
     693             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
     694             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
     695             :         real(RKC)           , intent(in)                    :: maxArray
     696             :         type(sequence_type) , intent(in)                    :: control
     697             :     end subroutine
     698             : #endif
     699             : 
     700             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     701             : 
     702             :     end interface
     703             : 
     704             :     ! seq, old, forward
     705             : 
     706             :     interface setCumPropExp
     707             : 
     708             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     709             : 
     710             : #if RK5_ENABLED
     711             :     PURE module subroutine setCumPropExpSeqOldForNon_RK5(array, maxArray, control, direction, action)
     712             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     713             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldForNon_RK5
     714             : #endif
     715             :         use pm_kind, only: RKC => RK5
     716             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     717             :         real(RKC)           , intent(in)                    :: maxArray
     718             :         type(forward_type)  , intent(in)                    :: direction
     719             :         type(nothing_type)  , intent(in)                    :: action
     720             :         type(sequence_type) , intent(in)                    :: control
     721             :     end subroutine
     722             : #endif
     723             : 
     724             : #if RK4_ENABLED
     725             :     PURE module subroutine setCumPropExpSeqOldForNon_RK4(array, maxArray, control, direction, action)
     726             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     727             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldForNon_RK4
     728             : #endif
     729             :         use pm_kind, only: RKC => RK4
     730             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     731             :         real(RKC)           , intent(in)                    :: maxArray
     732             :         type(forward_type)  , intent(in)                    :: direction
     733             :         type(nothing_type)  , intent(in)                    :: action
     734             :         type(sequence_type) , intent(in)                    :: control
     735             :     end subroutine
     736             : #endif
     737             : 
     738             : #if RK3_ENABLED
     739             :     PURE module subroutine setCumPropExpSeqOldForNon_RK3(array, maxArray, control, direction, action)
     740             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     741             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldForNon_RK3
     742             : #endif
     743             :         use pm_kind, only: RKC => RK3
     744             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     745             :         real(RKC)           , intent(in)                    :: maxArray
     746             :         type(forward_type)  , intent(in)                    :: direction
     747             :         type(nothing_type)  , intent(in)                    :: action
     748             :         type(sequence_type) , intent(in)                    :: control
     749             :     end subroutine
     750             : #endif
     751             : 
     752             : #if RK2_ENABLED
     753             :     PURE module subroutine setCumPropExpSeqOldForNon_RK2(array, maxArray, control, direction, action)
     754             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     755             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldForNon_RK2
     756             : #endif
     757             :         use pm_kind, only: RKC => RK2
     758             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     759             :         real(RKC)           , intent(in)                    :: maxArray
     760             :         type(forward_type)  , intent(in)                    :: direction
     761             :         type(nothing_type)  , intent(in)                    :: action
     762             :         type(sequence_type) , intent(in)                    :: control
     763             :     end subroutine
     764             : #endif
     765             : 
     766             : #if RK1_ENABLED
     767             :     PURE module subroutine setCumPropExpSeqOldForNon_RK1(array, maxArray, control, direction, action)
     768             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     769             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldForNon_RK1
     770             : #endif
     771             :         use pm_kind, only: RKC => RK1
     772             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     773             :         real(RKC)           , intent(in)                    :: maxArray
     774             :         type(forward_type)  , intent(in)                    :: direction
     775             :         type(nothing_type)  , intent(in)                    :: action
     776             :         type(sequence_type) , intent(in)                    :: control
     777             :     end subroutine
     778             : #endif
     779             : 
     780             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     781             : 
     782             : #if RK5_ENABLED
     783             :     PURE module subroutine setCumPropExpSeqOldForRev_RK5(array, maxArray, control, direction, action)
     784             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     785             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldForRev_RK5
     786             : #endif
     787             :         use pm_kind, only: RKC => RK5
     788             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     789             :         real(RKC)           , intent(in)                    :: maxArray
     790             :         type(forward_type)  , intent(in)                    :: direction
     791             :         type(reverse_type)  , intent(in)                    :: action
     792             :         type(sequence_type) , intent(in)                    :: control
     793             :     end subroutine
     794             : #endif
     795             : 
     796             : #if RK4_ENABLED
     797             :     PURE module subroutine setCumPropExpSeqOldForRev_RK4(array, maxArray, control, direction, action)
     798             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     799             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldForRev_RK4
     800             : #endif
     801             :         use pm_kind, only: RKC => RK4
     802             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     803             :         real(RKC)           , intent(in)                    :: maxArray
     804             :         type(forward_type)  , intent(in)                    :: direction
     805             :         type(reverse_type)  , intent(in)                    :: action
     806             :         type(sequence_type) , intent(in)                    :: control
     807             :     end subroutine
     808             : #endif
     809             : 
     810             : #if RK3_ENABLED
     811             :     PURE module subroutine setCumPropExpSeqOldForRev_RK3(array, maxArray, control, direction, action)
     812             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     813             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldForRev_RK3
     814             : #endif
     815             :         use pm_kind, only: RKC => RK3
     816             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     817             :         real(RKC)           , intent(in)                    :: maxArray
     818             :         type(forward_type)  , intent(in)                    :: direction
     819             :         type(reverse_type)  , intent(in)                    :: action
     820             :         type(sequence_type) , intent(in)                    :: control
     821             :     end subroutine
     822             : #endif
     823             : 
     824             : #if RK2_ENABLED
     825             :     PURE module subroutine setCumPropExpSeqOldForRev_RK2(array, maxArray, control, direction, action)
     826             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     827             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldForRev_RK2
     828             : #endif
     829             :         use pm_kind, only: RKC => RK2
     830             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     831             :         real(RKC)           , intent(in)                    :: maxArray
     832             :         type(forward_type)  , intent(in)                    :: direction
     833             :         type(reverse_type)  , intent(in)                    :: action
     834             :         type(sequence_type) , intent(in)                    :: control
     835             :     end subroutine
     836             : #endif
     837             : 
     838             : #if RK1_ENABLED
     839             :     PURE module subroutine setCumPropExpSeqOldForRev_RK1(array, maxArray, control, direction, action)
     840             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     841             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldForRev_RK1
     842             : #endif
     843             :         use pm_kind, only: RKC => RK1
     844             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     845             :         real(RKC)           , intent(in)                    :: maxArray
     846             :         type(forward_type)  , intent(in)                    :: direction
     847             :         type(reverse_type)  , intent(in)                    :: action
     848             :         type(sequence_type) , intent(in)                    :: control
     849             :     end subroutine
     850             : #endif
     851             : 
     852             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     853             : 
     854             :     end interface
     855             : 
     856             :     ! seq, old, backward
     857             : 
     858             :     interface setCumPropExp
     859             : 
     860             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     861             : 
     862             : #if RK5_ENABLED
     863             :     PURE module subroutine setCumPropExpSeqOldBacNon_RK5(array, maxArray, control, direction, action)
     864             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     865             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldBacNon_RK5
     866             : #endif
     867             :         use pm_kind, only: RKC => RK5
     868             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     869             :         real(RKC)           , intent(in)                    :: maxArray
     870             :         type(backward_type) , intent(in)                    :: direction
     871             :         type(nothing_type)  , intent(in)                    :: action
     872             :         type(sequence_type) , intent(in)                    :: control
     873             :     end subroutine
     874             : #endif
     875             : 
     876             : #if RK4_ENABLED
     877             :     PURE module subroutine setCumPropExpSeqOldBacNon_RK4(array, maxArray, control, direction, action)
     878             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     879             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldBacNon_RK4
     880             : #endif
     881             :         use pm_kind, only: RKC => RK4
     882             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     883             :         real(RKC)           , intent(in)                    :: maxArray
     884             :         type(backward_type) , intent(in)                    :: direction
     885             :         type(nothing_type)  , intent(in)                    :: action
     886             :         type(sequence_type) , intent(in)                    :: control
     887             :     end subroutine
     888             : #endif
     889             : 
     890             : #if RK3_ENABLED
     891             :     PURE module subroutine setCumPropExpSeqOldBacNon_RK3(array, maxArray, control, direction, action)
     892             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     893             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldBacNon_RK3
     894             : #endif
     895             :         use pm_kind, only: RKC => RK3
     896             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     897             :         real(RKC)           , intent(in)                    :: maxArray
     898             :         type(backward_type) , intent(in)                    :: direction
     899             :         type(nothing_type)  , intent(in)                    :: action
     900             :         type(sequence_type) , intent(in)                    :: control
     901             :     end subroutine
     902             : #endif
     903             : 
     904             : #if RK2_ENABLED
     905             :     PURE module subroutine setCumPropExpSeqOldBacNon_RK2(array, maxArray, control, direction, action)
     906             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     907             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldBacNon_RK2
     908             : #endif
     909             :         use pm_kind, only: RKC => RK2
     910             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     911             :         real(RKC)           , intent(in)                    :: maxArray
     912             :         type(backward_type) , intent(in)                    :: direction
     913             :         type(nothing_type)  , intent(in)                    :: action
     914             :         type(sequence_type) , intent(in)                    :: control
     915             :     end subroutine
     916             : #endif
     917             : 
     918             : #if RK1_ENABLED
     919             :     PURE module subroutine setCumPropExpSeqOldBacNon_RK1(array, maxArray, control, direction, action)
     920             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     921             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldBacNon_RK1
     922             : #endif
     923             :         use pm_kind, only: RKC => RK1
     924             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     925             :         real(RKC)           , intent(in)                    :: maxArray
     926             :         type(backward_type) , intent(in)                    :: direction
     927             :         type(nothing_type)  , intent(in)                    :: action
     928             :         type(sequence_type) , intent(in)                    :: control
     929             :     end subroutine
     930             : #endif
     931             : 
     932             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     933             : 
     934             : #if RK5_ENABLED
     935             :     PURE module subroutine setCumPropExpSeqOldBacRev_RK5(array, maxArray, control, direction, action)
     936             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     937             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldBacRev_RK5
     938             : #endif
     939             :         use pm_kind, only: RKC => RK5
     940             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     941             :         real(RKC)           , intent(in)                    :: maxArray
     942             :         type(backward_type) , intent(in)                    :: direction
     943             :         type(reverse_type)  , intent(in)                    :: action
     944             :         type(sequence_type) , intent(in)                    :: control
     945             :     end subroutine
     946             : #endif
     947             : 
     948             : #if RK4_ENABLED
     949             :     PURE module subroutine setCumPropExpSeqOldBacRev_RK4(array, maxArray, control, direction, action)
     950             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     951             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldBacRev_RK4
     952             : #endif
     953             :         use pm_kind, only: RKC => RK4
     954             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     955             :         real(RKC)           , intent(in)                    :: maxArray
     956             :         type(backward_type) , intent(in)                    :: direction
     957             :         type(reverse_type)  , intent(in)                    :: action
     958             :         type(sequence_type) , intent(in)                    :: control
     959             :     end subroutine
     960             : #endif
     961             : 
     962             : #if RK3_ENABLED
     963             :     PURE module subroutine setCumPropExpSeqOldBacRev_RK3(array, maxArray, control, direction, action)
     964             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     965             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldBacRev_RK3
     966             : #endif
     967             :         use pm_kind, only: RKC => RK3
     968             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     969             :         real(RKC)           , intent(in)                    :: maxArray
     970             :         type(backward_type) , intent(in)                    :: direction
     971             :         type(reverse_type)  , intent(in)                    :: action
     972             :         type(sequence_type) , intent(in)                    :: control
     973             :     end subroutine
     974             : #endif
     975             : 
     976             : #if RK2_ENABLED
     977             :     PURE module subroutine setCumPropExpSeqOldBacRev_RK2(array, maxArray, control, direction, action)
     978             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     979             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldBacRev_RK2
     980             : #endif
     981             :         use pm_kind, only: RKC => RK2
     982             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     983             :         real(RKC)           , intent(in)                    :: maxArray
     984             :         type(backward_type) , intent(in)                    :: direction
     985             :         type(reverse_type)  , intent(in)                    :: action
     986             :         type(sequence_type) , intent(in)                    :: control
     987             :     end subroutine
     988             : #endif
     989             : 
     990             : #if RK1_ENABLED
     991             :     PURE module subroutine setCumPropExpSeqOldBacRev_RK1(array, maxArray, control, direction, action)
     992             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     993             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqOldBacRev_RK1
     994             : #endif
     995             :         use pm_kind, only: RKC => RK1
     996             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
     997             :         real(RKC)           , intent(in)                    :: maxArray
     998             :         type(backward_type) , intent(in)                    :: direction
     999             :         type(reverse_type)  , intent(in)                    :: action
    1000             :         type(sequence_type) , intent(in)                    :: control
    1001             :     end subroutine
    1002             : #endif
    1003             : 
    1004             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1005             : 
    1006             :     end interface
    1007             : 
    1008             :     ! seq, new, forward
    1009             : 
    1010             :     interface setCumPropExp
    1011             : 
    1012             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1013             : 
    1014             : #if RK5_ENABLED
    1015             :     PURE module subroutine setCumPropExpSeqNewForNon_RK5(cumPropExp, array, maxArray, control, direction, action)
    1016             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1017             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewForNon_RK5
    1018             : #endif
    1019             :         use pm_kind, only: RKC => RK5
    1020             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1021             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1022             :         real(RKC)           , intent(in)                    :: maxArray
    1023             :         type(forward_type)  , intent(in)                    :: direction
    1024             :         type(nothing_type)  , intent(in)                    :: action
    1025             :         type(sequence_type) , intent(in)                    :: control
    1026             :     end subroutine
    1027             : #endif
    1028             : 
    1029             : #if RK4_ENABLED
    1030             :     PURE module subroutine setCumPropExpSeqNewForNon_RK4(cumPropExp, array, maxArray, control, direction, action)
    1031             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1032             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewForNon_RK4
    1033             : #endif
    1034             :         use pm_kind, only: RKC => RK4
    1035             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1036             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1037             :         real(RKC)           , intent(in)                    :: maxArray
    1038             :         type(forward_type)  , intent(in)                    :: direction
    1039             :         type(nothing_type)  , intent(in)                    :: action
    1040             :         type(sequence_type) , intent(in)                    :: control
    1041             :     end subroutine
    1042             : #endif
    1043             : 
    1044             : #if RK3_ENABLED
    1045             :     PURE module subroutine setCumPropExpSeqNewForNon_RK3(cumPropExp, array, maxArray, control, direction, action)
    1046             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1047             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewForNon_RK3
    1048             : #endif
    1049             :         use pm_kind, only: RKC => RK3
    1050             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1051             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1052             :         real(RKC)           , intent(in)                    :: maxArray
    1053             :         type(forward_type)  , intent(in)                    :: direction
    1054             :         type(nothing_type)  , intent(in)                    :: action
    1055             :         type(sequence_type) , intent(in)                    :: control
    1056             :     end subroutine
    1057             : #endif
    1058             : 
    1059             : #if RK2_ENABLED
    1060             :     PURE module subroutine setCumPropExpSeqNewForNon_RK2(cumPropExp, array, maxArray, control, direction, action)
    1061             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1062             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewForNon_RK2
    1063             : #endif
    1064             :         use pm_kind, only: RKC => RK2
    1065             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1066             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1067             :         real(RKC)           , intent(in)                    :: maxArray
    1068             :         type(forward_type)  , intent(in)                    :: direction
    1069             :         type(nothing_type)  , intent(in)                    :: action
    1070             :         type(sequence_type) , intent(in)                    :: control
    1071             :     end subroutine
    1072             : #endif
    1073             : 
    1074             : #if RK1_ENABLED
    1075             :     PURE module subroutine setCumPropExpSeqNewForNon_RK1(cumPropExp, array, maxArray, control, direction, action)
    1076             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1077             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewForNon_RK1
    1078             : #endif
    1079             :         use pm_kind, only: RKC => RK1
    1080             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1081             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1082             :         real(RKC)           , intent(in)                    :: maxArray
    1083             :         type(forward_type)  , intent(in)                    :: direction
    1084             :         type(nothing_type)  , intent(in)                    :: action
    1085             :         type(sequence_type) , intent(in)                    :: control
    1086             :     end subroutine
    1087             : #endif
    1088             : 
    1089             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1090             : 
    1091             : #if RK5_ENABLED
    1092             :     PURE module subroutine setCumPropExpSeqNewForRev_RK5(cumPropExp, array, maxArray, control, direction, action)
    1093             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1094             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewForRev_RK5
    1095             : #endif
    1096             :         use pm_kind, only: RKC => RK5
    1097             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1098             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1099             :         real(RKC)           , intent(in)                    :: maxArray
    1100             :         type(forward_type)  , intent(in)                    :: direction
    1101             :         type(reverse_type)  , intent(in)                    :: action
    1102             :         type(sequence_type) , intent(in)                    :: control
    1103             :     end subroutine
    1104             : #endif
    1105             : 
    1106             : #if RK4_ENABLED
    1107             :     PURE module subroutine setCumPropExpSeqNewForRev_RK4(cumPropExp, array, maxArray, control, direction, action)
    1108             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1109             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewForRev_RK4
    1110             : #endif
    1111             :         use pm_kind, only: RKC => RK4
    1112             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1113             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1114             :         real(RKC)           , intent(in)                    :: maxArray
    1115             :         type(forward_type)  , intent(in)                    :: direction
    1116             :         type(reverse_type)  , intent(in)                    :: action
    1117             :         type(sequence_type) , intent(in)                    :: control
    1118             :     end subroutine
    1119             : #endif
    1120             : 
    1121             : #if RK3_ENABLED
    1122             :     PURE module subroutine setCumPropExpSeqNewForRev_RK3(cumPropExp, array, maxArray, control, direction, action)
    1123             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1124             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewForRev_RK3
    1125             : #endif
    1126             :         use pm_kind, only: RKC => RK3
    1127             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1128             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1129             :         real(RKC)           , intent(in)                    :: maxArray
    1130             :         type(forward_type)  , intent(in)                    :: direction
    1131             :         type(reverse_type)  , intent(in)                    :: action
    1132             :         type(sequence_type) , intent(in)                    :: control
    1133             :     end subroutine
    1134             : #endif
    1135             : 
    1136             : #if RK2_ENABLED
    1137             :     PURE module subroutine setCumPropExpSeqNewForRev_RK2(cumPropExp, array, maxArray, control, direction, action)
    1138             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1139             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewForRev_RK2
    1140             : #endif
    1141             :         use pm_kind, only: RKC => RK2
    1142             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1143             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1144             :         real(RKC)           , intent(in)                    :: maxArray
    1145             :         type(forward_type)  , intent(in)                    :: direction
    1146             :         type(reverse_type)  , intent(in)                    :: action
    1147             :         type(sequence_type) , intent(in)                    :: control
    1148             :     end subroutine
    1149             : #endif
    1150             : 
    1151             : #if RK1_ENABLED
    1152             :     PURE module subroutine setCumPropExpSeqNewForRev_RK1(cumPropExp, array, maxArray, control, direction, action)
    1153             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1154             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewForRev_RK1
    1155             : #endif
    1156             :         use pm_kind, only: RKC => RK1
    1157             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1158             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1159             :         real(RKC)           , intent(in)                    :: maxArray
    1160             :         type(forward_type)  , intent(in)                    :: direction
    1161             :         type(reverse_type)  , intent(in)                    :: action
    1162             :         type(sequence_type) , intent(in)                    :: control
    1163             :     end subroutine
    1164             : #endif
    1165             : 
    1166             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1167             : 
    1168             :     end interface
    1169             : 
    1170             :     ! seq, new, backward
    1171             : 
    1172             :     interface setCumPropExp
    1173             : 
    1174             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1175             : 
    1176             : #if RK5_ENABLED
    1177             :     PURE module subroutine setCumPropExpSeqNewBacNon_RK5(cumPropExp, array, maxArray, control, direction, action)
    1178             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1179             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewBacNon_RK5
    1180             : #endif
    1181             :         use pm_kind, only: RKC => RK5
    1182             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1183             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1184             :         real(RKC)           , intent(in)                    :: maxArray
    1185             :         type(backward_type) , intent(in)                    :: direction
    1186             :         type(nothing_type)  , intent(in)                    :: action
    1187             :         type(sequence_type) , intent(in)                    :: control
    1188             :     end subroutine
    1189             : #endif
    1190             : 
    1191             : #if RK4_ENABLED
    1192             :     PURE module subroutine setCumPropExpSeqNewBacNon_RK4(cumPropExp, array, maxArray, control, direction, action)
    1193             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1194             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewBacNon_RK4
    1195             : #endif
    1196             :         use pm_kind, only: RKC => RK4
    1197             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1198             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1199             :         real(RKC)           , intent(in)                    :: maxArray
    1200             :         type(backward_type) , intent(in)                    :: direction
    1201             :         type(nothing_type)  , intent(in)                    :: action
    1202             :         type(sequence_type) , intent(in)                    :: control
    1203             :     end subroutine
    1204             : #endif
    1205             : 
    1206             : #if RK3_ENABLED
    1207             :     PURE module subroutine setCumPropExpSeqNewBacNon_RK3(cumPropExp, array, maxArray, control, direction, action)
    1208             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1209             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewBacNon_RK3
    1210             : #endif
    1211             :         use pm_kind, only: RKC => RK3
    1212             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1213             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1214             :         real(RKC)           , intent(in)                    :: maxArray
    1215             :         type(backward_type) , intent(in)                    :: direction
    1216             :         type(nothing_type)  , intent(in)                    :: action
    1217             :         type(sequence_type) , intent(in)                    :: control
    1218             :     end subroutine
    1219             : #endif
    1220             : 
    1221             : #if RK2_ENABLED
    1222             :     PURE module subroutine setCumPropExpSeqNewBacNon_RK2(cumPropExp, array, maxArray, control, direction, action)
    1223             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1224             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewBacNon_RK2
    1225             : #endif
    1226             :         use pm_kind, only: RKC => RK2
    1227             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1228             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1229             :         real(RKC)           , intent(in)                    :: maxArray
    1230             :         type(backward_type) , intent(in)                    :: direction
    1231             :         type(nothing_type)  , intent(in)                    :: action
    1232             :         type(sequence_type) , intent(in)                    :: control
    1233             :     end subroutine
    1234             : #endif
    1235             : 
    1236             : #if RK1_ENABLED
    1237             :     PURE module subroutine setCumPropExpSeqNewBacNon_RK1(cumPropExp, array, maxArray, control, direction, action)
    1238             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1239             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewBacNon_RK1
    1240             : #endif
    1241             :         use pm_kind, only: RKC => RK1
    1242             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1243             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1244             :         real(RKC)           , intent(in)                    :: maxArray
    1245             :         type(backward_type) , intent(in)                    :: direction
    1246             :         type(nothing_type)  , intent(in)                    :: action
    1247             :         type(sequence_type) , intent(in)                    :: control
    1248             :     end subroutine
    1249             : #endif
    1250             : 
    1251             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1252             : 
    1253             : #if RK5_ENABLED
    1254             :     PURE module subroutine setCumPropExpSeqNewBacRev_RK5(cumPropExp, array, maxArray, control, direction, action)
    1255             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1256             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewBacRev_RK5
    1257             : #endif
    1258             :         use pm_kind, only: RKC => RK5
    1259             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1260             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1261             :         real(RKC)           , intent(in)                    :: maxArray
    1262             :         type(backward_type) , intent(in)                    :: direction
    1263             :         type(reverse_type)  , intent(in)                    :: action
    1264             :         type(sequence_type) , intent(in)                    :: control
    1265             :     end subroutine
    1266             : #endif
    1267             : 
    1268             : #if RK4_ENABLED
    1269             :     PURE module subroutine setCumPropExpSeqNewBacRev_RK4(cumPropExp, array, maxArray, control, direction, action)
    1270             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1271             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewBacRev_RK4
    1272             : #endif
    1273             :         use pm_kind, only: RKC => RK4
    1274             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1275             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1276             :         real(RKC)           , intent(in)                    :: maxArray
    1277             :         type(backward_type) , intent(in)                    :: direction
    1278             :         type(reverse_type)  , intent(in)                    :: action
    1279             :         type(sequence_type) , intent(in)                    :: control
    1280             :     end subroutine
    1281             : #endif
    1282             : 
    1283             : #if RK3_ENABLED
    1284             :     PURE module subroutine setCumPropExpSeqNewBacRev_RK3(cumPropExp, array, maxArray, control, direction, action)
    1285             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1286             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewBacRev_RK3
    1287             : #endif
    1288             :         use pm_kind, only: RKC => RK3
    1289             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1290             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1291             :         real(RKC)           , intent(in)                    :: maxArray
    1292             :         type(backward_type) , intent(in)                    :: direction
    1293             :         type(reverse_type)  , intent(in)                    :: action
    1294             :         type(sequence_type) , intent(in)                    :: control
    1295             :     end subroutine
    1296             : #endif
    1297             : 
    1298             : #if RK2_ENABLED
    1299             :     PURE module subroutine setCumPropExpSeqNewBacRev_RK2(cumPropExp, array, maxArray, control, direction, action)
    1300             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1301             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewBacRev_RK2
    1302             : #endif
    1303             :         use pm_kind, only: RKC => RK2
    1304             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1305             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1306             :         real(RKC)           , intent(in)                    :: maxArray
    1307             :         type(backward_type) , intent(in)                    :: direction
    1308             :         type(reverse_type)  , intent(in)                    :: action
    1309             :         type(sequence_type) , intent(in)                    :: control
    1310             :     end subroutine
    1311             : #endif
    1312             : 
    1313             : #if RK1_ENABLED
    1314             :     PURE module subroutine setCumPropExpSeqNewBacRev_RK1(cumPropExp, array, maxArray, control, direction, action)
    1315             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1316             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSeqNewBacRev_RK1
    1317             : #endif
    1318             :         use pm_kind, only: RKC => RK1
    1319             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1320             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1321             :         real(RKC)           , intent(in)                    :: maxArray
    1322             :         type(backward_type) , intent(in)                    :: direction
    1323             :         type(reverse_type)  , intent(in)                    :: action
    1324             :         type(sequence_type) , intent(in)                    :: control
    1325             :     end subroutine
    1326             : #endif
    1327             : 
    1328             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1329             : 
    1330             :     end interface
    1331             : 
    1332             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1333             : 
    1334             :     ! sel, old, new, default
    1335             : 
    1336             :     interface setCumPropExp
    1337             : 
    1338             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1339             : 
    1340             : #if RK5_ENABLED
    1341             :     PURE module subroutine setCumPropExpSelOldDefDef_RK5(array, maxArray, control)
    1342             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1343             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldDefDef_RK5
    1344             : #endif
    1345             :         use pm_kind, only: RKC => RK5
    1346             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1347             :         real(RKC)           , intent(in)                    :: maxArray
    1348             :         type(selection_type), intent(in)                    :: control
    1349             :     end subroutine
    1350             : #endif
    1351             : 
    1352             : #if RK4_ENABLED
    1353             :     PURE module subroutine setCumPropExpSelOldDefDef_RK4(array, maxArray, control)
    1354             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1355             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldDefDef_RK4
    1356             : #endif
    1357             :         use pm_kind, only: RKC => RK4
    1358             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1359             :         real(RKC)           , intent(in)                    :: maxArray
    1360             :         type(selection_type), intent(in)                    :: control
    1361             :     end subroutine
    1362             : #endif
    1363             : 
    1364             : #if RK3_ENABLED
    1365             :     PURE module subroutine setCumPropExpSelOldDefDef_RK3(array, maxArray, control)
    1366             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1367             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldDefDef_RK3
    1368             : #endif
    1369             :         use pm_kind, only: RKC => RK3
    1370             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1371             :         real(RKC)           , intent(in)                    :: maxArray
    1372             :         type(selection_type), intent(in)                    :: control
    1373             :     end subroutine
    1374             : #endif
    1375             : 
    1376             : #if RK2_ENABLED
    1377             :     PURE module subroutine setCumPropExpSelOldDefDef_RK2(array, maxArray, control)
    1378             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1379             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldDefDef_RK2
    1380             : #endif
    1381             :         use pm_kind, only: RKC => RK2
    1382             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1383             :         real(RKC)           , intent(in)                    :: maxArray
    1384             :         type(selection_type), intent(in)                    :: control
    1385             :     end subroutine
    1386             : #endif
    1387             : 
    1388             : #if RK1_ENABLED
    1389             :     PURE module subroutine setCumPropExpSelOldDefDef_RK1(array, maxArray, control)
    1390             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1391             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldDefDef_RK1
    1392             : #endif
    1393             :         use pm_kind, only: RKC => RK1
    1394             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1395             :         real(RKC)           , intent(in)                    :: maxArray
    1396             :         type(selection_type), intent(in)                    :: control
    1397             :     end subroutine
    1398             : #endif
    1399             : 
    1400             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1401             : 
    1402             : #if RK5_ENABLED
    1403             :     PURE module subroutine setCumPropExpSelNewDefDef_RK5(cumPropExp, array, maxArray, control)
    1404             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1405             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewDefDef_RK5
    1406             : #endif
    1407             :         use pm_kind, only: RKC => RK5
    1408             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1409             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1410             :         real(RKC)           , intent(in)                    :: maxArray
    1411             :         type(selection_type), intent(in)                    :: control
    1412             :     end subroutine
    1413             : #endif
    1414             : 
    1415             : #if RK4_ENABLED
    1416             :     PURE module subroutine setCumPropExpSelNewDefDef_RK4(cumPropExp, array, maxArray, control)
    1417             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1418             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewDefDef_RK4
    1419             : #endif
    1420             :         use pm_kind, only: RKC => RK4
    1421             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1422             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1423             :         real(RKC)           , intent(in)                    :: maxArray
    1424             :         type(selection_type), intent(in)                    :: control
    1425             :     end subroutine
    1426             : #endif
    1427             : 
    1428             : #if RK3_ENABLED
    1429             :     PURE module subroutine setCumPropExpSelNewDefDef_RK3(cumPropExp, array, maxArray, control)
    1430             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1431             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewDefDef_RK3
    1432             : #endif
    1433             :         use pm_kind, only: RKC => RK3
    1434             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1435             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1436             :         real(RKC)           , intent(in)                    :: maxArray
    1437             :         type(selection_type), intent(in)                    :: control
    1438             :     end subroutine
    1439             : #endif
    1440             : 
    1441             : #if RK2_ENABLED
    1442             :     PURE module subroutine setCumPropExpSelNewDefDef_RK2(cumPropExp, array, maxArray, control)
    1443             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1444             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewDefDef_RK2
    1445             : #endif
    1446             :         use pm_kind, only: RKC => RK2
    1447             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1448             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1449             :         real(RKC)           , intent(in)                    :: maxArray
    1450             :         type(selection_type), intent(in)                    :: control
    1451             :     end subroutine
    1452             : #endif
    1453             : 
    1454             : #if RK1_ENABLED
    1455             :     PURE module subroutine setCumPropExpSelNewDefDef_RK1(cumPropExp, array, maxArray, control)
    1456             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1457             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewDefDef_RK1
    1458             : #endif
    1459             :         use pm_kind, only: RKC => RK1
    1460             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1461             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1462             :         real(RKC)           , intent(in)                    :: maxArray
    1463             :         type(selection_type), intent(in)                    :: control
    1464             :     end subroutine
    1465             : #endif
    1466             : 
    1467             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1468             : 
    1469             :     end interface
    1470             : 
    1471             :     ! sel, old, forward
    1472             : 
    1473             :     interface setCumPropExp
    1474             : 
    1475             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1476             : 
    1477             : #if RK5_ENABLED
    1478             :     PURE module subroutine setCumPropExpSelOldForNon_RK5(array, maxArray, control, direction, action)
    1479             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1480             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldForNon_RK5
    1481             : #endif
    1482             :         use pm_kind, only: RKC => RK5
    1483             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1484             :         real(RKC)           , intent(in)                    :: maxArray
    1485             :         type(forward_type)  , intent(in)                    :: direction
    1486             :         type(nothing_type)  , intent(in)                    :: action
    1487             :         type(selection_type), intent(in)                    :: control
    1488             :     end subroutine
    1489             : #endif
    1490             : 
    1491             : #if RK4_ENABLED
    1492             :     PURE module subroutine setCumPropExpSelOldForNon_RK4(array, maxArray, control, direction, action)
    1493             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1494             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldForNon_RK4
    1495             : #endif
    1496             :         use pm_kind, only: RKC => RK4
    1497             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1498             :         real(RKC)           , intent(in)                    :: maxArray
    1499             :         type(forward_type)  , intent(in)                    :: direction
    1500             :         type(nothing_type)  , intent(in)                    :: action
    1501             :         type(selection_type), intent(in)                    :: control
    1502             :     end subroutine
    1503             : #endif
    1504             : 
    1505             : #if RK3_ENABLED
    1506             :     PURE module subroutine setCumPropExpSelOldForNon_RK3(array, maxArray, control, direction, action)
    1507             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1508             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldForNon_RK3
    1509             : #endif
    1510             :         use pm_kind, only: RKC => RK3
    1511             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1512             :         real(RKC)           , intent(in)                    :: maxArray
    1513             :         type(forward_type)  , intent(in)                    :: direction
    1514             :         type(nothing_type)  , intent(in)                    :: action
    1515             :         type(selection_type), intent(in)                    :: control
    1516             :     end subroutine
    1517             : #endif
    1518             : 
    1519             : #if RK2_ENABLED
    1520             :     PURE module subroutine setCumPropExpSelOldForNon_RK2(array, maxArray, control, direction, action)
    1521             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1522             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldForNon_RK2
    1523             : #endif
    1524             :         use pm_kind, only: RKC => RK2
    1525             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1526             :         real(RKC)           , intent(in)                    :: maxArray
    1527             :         type(forward_type)  , intent(in)                    :: direction
    1528             :         type(nothing_type)  , intent(in)                    :: action
    1529             :         type(selection_type), intent(in)                    :: control
    1530             :     end subroutine
    1531             : #endif
    1532             : 
    1533             : #if RK1_ENABLED
    1534             :     PURE module subroutine setCumPropExpSelOldForNon_RK1(array, maxArray, control, direction, action)
    1535             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1536             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldForNon_RK1
    1537             : #endif
    1538             :         use pm_kind, only: RKC => RK1
    1539             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1540             :         real(RKC)           , intent(in)                    :: maxArray
    1541             :         type(forward_type)  , intent(in)                    :: direction
    1542             :         type(nothing_type)  , intent(in)                    :: action
    1543             :         type(selection_type), intent(in)                    :: control
    1544             :     end subroutine
    1545             : #endif
    1546             : 
    1547             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1548             : 
    1549             : #if RK5_ENABLED
    1550             :     PURE module subroutine setCumPropExpSelOldForRev_RK5(array, maxArray, control, direction, action)
    1551             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1552             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldForRev_RK5
    1553             : #endif
    1554             :         use pm_kind, only: RKC => RK5
    1555             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1556             :         real(RKC)           , intent(in)                    :: maxArray
    1557             :         type(forward_type)  , intent(in)                    :: direction
    1558             :         type(reverse_type)  , intent(in)                    :: action
    1559             :         type(selection_type), intent(in)                    :: control
    1560             :     end subroutine
    1561             : #endif
    1562             : 
    1563             : #if RK4_ENABLED
    1564             :     PURE module subroutine setCumPropExpSelOldForRev_RK4(array, maxArray, control, direction, action)
    1565             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1566             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldForRev_RK4
    1567             : #endif
    1568             :         use pm_kind, only: RKC => RK4
    1569             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1570             :         real(RKC)           , intent(in)                    :: maxArray
    1571             :         type(forward_type)  , intent(in)                    :: direction
    1572             :         type(reverse_type)  , intent(in)                    :: action
    1573             :         type(selection_type), intent(in)                    :: control
    1574             :     end subroutine
    1575             : #endif
    1576             : 
    1577             : #if RK3_ENABLED
    1578             :     PURE module subroutine setCumPropExpSelOldForRev_RK3(array, maxArray, control, direction, action)
    1579             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1580             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldForRev_RK3
    1581             : #endif
    1582             :         use pm_kind, only: RKC => RK3
    1583             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1584             :         real(RKC)           , intent(in)                    :: maxArray
    1585             :         type(forward_type)  , intent(in)                    :: direction
    1586             :         type(reverse_type)  , intent(in)                    :: action
    1587             :         type(selection_type), intent(in)                    :: control
    1588             :     end subroutine
    1589             : #endif
    1590             : 
    1591             : #if RK2_ENABLED
    1592             :     PURE module subroutine setCumPropExpSelOldForRev_RK2(array, maxArray, control, direction, action)
    1593             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1594             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldForRev_RK2
    1595             : #endif
    1596             :         use pm_kind, only: RKC => RK2
    1597             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1598             :         real(RKC)           , intent(in)                    :: maxArray
    1599             :         type(forward_type)  , intent(in)                    :: direction
    1600             :         type(reverse_type)  , intent(in)                    :: action
    1601             :         type(selection_type), intent(in)                    :: control
    1602             :     end subroutine
    1603             : #endif
    1604             : 
    1605             : #if RK1_ENABLED
    1606             :     PURE module subroutine setCumPropExpSelOldForRev_RK1(array, maxArray, control, direction, action)
    1607             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1608             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldForRev_RK1
    1609             : #endif
    1610             :         use pm_kind, only: RKC => RK1
    1611             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1612             :         real(RKC)           , intent(in)                    :: maxArray
    1613             :         type(forward_type)  , intent(in)                    :: direction
    1614             :         type(reverse_type)  , intent(in)                    :: action
    1615             :         type(selection_type), intent(in)                    :: control
    1616             :     end subroutine
    1617             : #endif
    1618             : 
    1619             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1620             : 
    1621             :     end interface
    1622             : 
    1623             :     ! sel, old, backward
    1624             : 
    1625             :     interface setCumPropExp
    1626             : 
    1627             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1628             : 
    1629             : #if RK5_ENABLED
    1630             :     PURE module subroutine setCumPropExpSelOldBacNon_RK5(array, maxArray, control, direction, action)
    1631             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1632             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldBacNon_RK5
    1633             : #endif
    1634             :         use pm_kind, only: RKC => RK5
    1635             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1636             :         real(RKC)           , intent(in)                    :: maxArray
    1637             :         type(backward_type) , intent(in)                    :: direction
    1638             :         type(nothing_type)  , intent(in)                    :: action
    1639             :         type(selection_type), intent(in)                    :: control
    1640             :     end subroutine
    1641             : #endif
    1642             : 
    1643             : #if RK4_ENABLED
    1644             :     PURE module subroutine setCumPropExpSelOldBacNon_RK4(array, maxArray, control, direction, action)
    1645             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1646             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldBacNon_RK4
    1647             : #endif
    1648             :         use pm_kind, only: RKC => RK4
    1649             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1650             :         real(RKC)           , intent(in)                    :: maxArray
    1651             :         type(backward_type) , intent(in)                    :: direction
    1652             :         type(nothing_type)  , intent(in)                    :: action
    1653             :         type(selection_type), intent(in)                    :: control
    1654             :     end subroutine
    1655             : #endif
    1656             : 
    1657             : #if RK3_ENABLED
    1658             :     PURE module subroutine setCumPropExpSelOldBacNon_RK3(array, maxArray, control, direction, action)
    1659             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1660             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldBacNon_RK3
    1661             : #endif
    1662             :         use pm_kind, only: RKC => RK3
    1663             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1664             :         real(RKC)           , intent(in)                    :: maxArray
    1665             :         type(backward_type) , intent(in)                    :: direction
    1666             :         type(nothing_type)  , intent(in)                    :: action
    1667             :         type(selection_type), intent(in)                    :: control
    1668             :     end subroutine
    1669             : #endif
    1670             : 
    1671             : #if RK2_ENABLED
    1672             :     PURE module subroutine setCumPropExpSelOldBacNon_RK2(array, maxArray, control, direction, action)
    1673             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1674             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldBacNon_RK2
    1675             : #endif
    1676             :         use pm_kind, only: RKC => RK2
    1677             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1678             :         real(RKC)           , intent(in)                    :: maxArray
    1679             :         type(backward_type) , intent(in)                    :: direction
    1680             :         type(nothing_type)  , intent(in)                    :: action
    1681             :         type(selection_type), intent(in)                    :: control
    1682             :     end subroutine
    1683             : #endif
    1684             : 
    1685             : #if RK1_ENABLED
    1686             :     PURE module subroutine setCumPropExpSelOldBacNon_RK1(array, maxArray, control, direction, action)
    1687             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1688             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldBacNon_RK1
    1689             : #endif
    1690             :         use pm_kind, only: RKC => RK1
    1691             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1692             :         real(RKC)           , intent(in)                    :: maxArray
    1693             :         type(backward_type) , intent(in)                    :: direction
    1694             :         type(nothing_type)  , intent(in)                    :: action
    1695             :         type(selection_type), intent(in)                    :: control
    1696             :     end subroutine
    1697             : #endif
    1698             : 
    1699             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1700             : 
    1701             : #if RK5_ENABLED
    1702             :     PURE module subroutine setCumPropExpSelOldBacRev_RK5(array, maxArray, control, direction, action)
    1703             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1704             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldBacRev_RK5
    1705             : #endif
    1706             :         use pm_kind, only: RKC => RK5
    1707             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1708             :         real(RKC)           , intent(in)                    :: maxArray
    1709             :         type(backward_type) , intent(in)                    :: direction
    1710             :         type(reverse_type)  , intent(in)                    :: action
    1711             :         type(selection_type), intent(in)                    :: control
    1712             :     end subroutine
    1713             : #endif
    1714             : 
    1715             : #if RK4_ENABLED
    1716             :     PURE module subroutine setCumPropExpSelOldBacRev_RK4(array, maxArray, control, direction, action)
    1717             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1718             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldBacRev_RK4
    1719             : #endif
    1720             :         use pm_kind, only: RKC => RK4
    1721             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1722             :         real(RKC)           , intent(in)                    :: maxArray
    1723             :         type(backward_type) , intent(in)                    :: direction
    1724             :         type(reverse_type)  , intent(in)                    :: action
    1725             :         type(selection_type), intent(in)                    :: control
    1726             :     end subroutine
    1727             : #endif
    1728             : 
    1729             : #if RK3_ENABLED
    1730             :     PURE module subroutine setCumPropExpSelOldBacRev_RK3(array, maxArray, control, direction, action)
    1731             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1732             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldBacRev_RK3
    1733             : #endif
    1734             :         use pm_kind, only: RKC => RK3
    1735             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1736             :         real(RKC)           , intent(in)                    :: maxArray
    1737             :         type(backward_type) , intent(in)                    :: direction
    1738             :         type(reverse_type)  , intent(in)                    :: action
    1739             :         type(selection_type), intent(in)                    :: control
    1740             :     end subroutine
    1741             : #endif
    1742             : 
    1743             : #if RK2_ENABLED
    1744             :     PURE module subroutine setCumPropExpSelOldBacRev_RK2(array, maxArray, control, direction, action)
    1745             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1746             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldBacRev_RK2
    1747             : #endif
    1748             :         use pm_kind, only: RKC => RK2
    1749             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1750             :         real(RKC)           , intent(in)                    :: maxArray
    1751             :         type(backward_type) , intent(in)                    :: direction
    1752             :         type(reverse_type)  , intent(in)                    :: action
    1753             :         type(selection_type), intent(in)                    :: control
    1754             :     end subroutine
    1755             : #endif
    1756             : 
    1757             : #if RK1_ENABLED
    1758             :     PURE module subroutine setCumPropExpSelOldBacRev_RK1(array, maxArray, control, direction, action)
    1759             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1760             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelOldBacRev_RK1
    1761             : #endif
    1762             :         use pm_kind, only: RKC => RK1
    1763             :         real(RKC)           , intent(inout) , contiguous    :: array(:)
    1764             :         real(RKC)           , intent(in)                    :: maxArray
    1765             :         type(backward_type) , intent(in)                    :: direction
    1766             :         type(reverse_type)  , intent(in)                    :: action
    1767             :         type(selection_type), intent(in)                    :: control
    1768             :     end subroutine
    1769             : #endif
    1770             : 
    1771             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1772             : 
    1773             :     end interface
    1774             : 
    1775             :     ! sel, new, forward
    1776             : 
    1777             :     interface setCumPropExp
    1778             : 
    1779             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1780             : 
    1781             : #if RK5_ENABLED
    1782             :     PURE module subroutine setCumPropExpSelNewForNon_RK5(cumPropExp, array, maxArray, control, direction, action)
    1783             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1784             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewForNon_RK5
    1785             : #endif
    1786             :         use pm_kind, only: RKC => RK5
    1787             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1788             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1789             :         real(RKC)           , intent(in)                    :: maxArray
    1790             :         type(forward_type)  , intent(in)                    :: direction
    1791             :         type(nothing_type)  , intent(in)                    :: action
    1792             :         type(selection_type), intent(in)                    :: control
    1793             :     end subroutine
    1794             : #endif
    1795             : 
    1796             : #if RK4_ENABLED
    1797             :     PURE module subroutine setCumPropExpSelNewForNon_RK4(cumPropExp, array, maxArray, control, direction, action)
    1798             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1799             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewForNon_RK4
    1800             : #endif
    1801             :         use pm_kind, only: RKC => RK4
    1802             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1803             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1804             :         real(RKC)           , intent(in)                    :: maxArray
    1805             :         type(forward_type)  , intent(in)                    :: direction
    1806             :         type(nothing_type)  , intent(in)                    :: action
    1807             :         type(selection_type), intent(in)                    :: control
    1808             :     end subroutine
    1809             : #endif
    1810             : 
    1811             : #if RK3_ENABLED
    1812             :     PURE module subroutine setCumPropExpSelNewForNon_RK3(cumPropExp, array, maxArray, control, direction, action)
    1813             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1814             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewForNon_RK3
    1815             : #endif
    1816             :         use pm_kind, only: RKC => RK3
    1817             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1818             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1819             :         real(RKC)           , intent(in)                    :: maxArray
    1820             :         type(forward_type)  , intent(in)                    :: direction
    1821             :         type(nothing_type)  , intent(in)                    :: action
    1822             :         type(selection_type), intent(in)                    :: control
    1823             :     end subroutine
    1824             : #endif
    1825             : 
    1826             : #if RK2_ENABLED
    1827             :     PURE module subroutine setCumPropExpSelNewForNon_RK2(cumPropExp, array, maxArray, control, direction, action)
    1828             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1829             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewForNon_RK2
    1830             : #endif
    1831             :         use pm_kind, only: RKC => RK2
    1832             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1833             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1834             :         real(RKC)           , intent(in)                    :: maxArray
    1835             :         type(forward_type)  , intent(in)                    :: direction
    1836             :         type(nothing_type)  , intent(in)                    :: action
    1837             :         type(selection_type), intent(in)                    :: control
    1838             :     end subroutine
    1839             : #endif
    1840             : 
    1841             : #if RK1_ENABLED
    1842             :     PURE module subroutine setCumPropExpSelNewForNon_RK1(cumPropExp, array, maxArray, control, direction, action)
    1843             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1844             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewForNon_RK1
    1845             : #endif
    1846             :         use pm_kind, only: RKC => RK1
    1847             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1848             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1849             :         real(RKC)           , intent(in)                    :: maxArray
    1850             :         type(forward_type)  , intent(in)                    :: direction
    1851             :         type(nothing_type)  , intent(in)                    :: action
    1852             :         type(selection_type), intent(in)                    :: control
    1853             :     end subroutine
    1854             : #endif
    1855             : 
    1856             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1857             : 
    1858             : #if RK5_ENABLED
    1859             :     PURE module subroutine setCumPropExpSelNewForRev_RK5(cumPropExp, array, maxArray, control, direction, action)
    1860             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1861             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewForRev_RK5
    1862             : #endif
    1863             :         use pm_kind, only: RKC => RK5
    1864             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1865             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1866             :         real(RKC)           , intent(in)                    :: maxArray
    1867             :         type(forward_type)  , intent(in)                    :: direction
    1868             :         type(reverse_type)  , intent(in)                    :: action
    1869             :         type(selection_type), intent(in)                    :: control
    1870             :     end subroutine
    1871             : #endif
    1872             : 
    1873             : #if RK4_ENABLED
    1874             :     PURE module subroutine setCumPropExpSelNewForRev_RK4(cumPropExp, array, maxArray, control, direction, action)
    1875             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1876             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewForRev_RK4
    1877             : #endif
    1878             :         use pm_kind, only: RKC => RK4
    1879             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1880             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1881             :         real(RKC)           , intent(in)                    :: maxArray
    1882             :         type(forward_type)  , intent(in)                    :: direction
    1883             :         type(reverse_type)  , intent(in)                    :: action
    1884             :         type(selection_type), intent(in)                    :: control
    1885             :     end subroutine
    1886             : #endif
    1887             : 
    1888             : #if RK3_ENABLED
    1889             :     PURE module subroutine setCumPropExpSelNewForRev_RK3(cumPropExp, array, maxArray, control, direction, action)
    1890             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1891             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewForRev_RK3
    1892             : #endif
    1893             :         use pm_kind, only: RKC => RK3
    1894             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1895             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1896             :         real(RKC)           , intent(in)                    :: maxArray
    1897             :         type(forward_type)  , intent(in)                    :: direction
    1898             :         type(reverse_type)  , intent(in)                    :: action
    1899             :         type(selection_type), intent(in)                    :: control
    1900             :     end subroutine
    1901             : #endif
    1902             : 
    1903             : #if RK2_ENABLED
    1904             :     PURE module subroutine setCumPropExpSelNewForRev_RK2(cumPropExp, array, maxArray, control, direction, action)
    1905             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1906             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewForRev_RK2
    1907             : #endif
    1908             :         use pm_kind, only: RKC => RK2
    1909             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1910             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1911             :         real(RKC)           , intent(in)                    :: maxArray
    1912             :         type(forward_type)  , intent(in)                    :: direction
    1913             :         type(reverse_type)  , intent(in)                    :: action
    1914             :         type(selection_type), intent(in)                    :: control
    1915             :     end subroutine
    1916             : #endif
    1917             : 
    1918             : #if RK1_ENABLED
    1919             :     PURE module subroutine setCumPropExpSelNewForRev_RK1(cumPropExp, array, maxArray, control, direction, action)
    1920             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1921             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewForRev_RK1
    1922             : #endif
    1923             :         use pm_kind, only: RKC => RK1
    1924             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1925             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1926             :         real(RKC)           , intent(in)                    :: maxArray
    1927             :         type(forward_type)  , intent(in)                    :: direction
    1928             :         type(reverse_type)  , intent(in)                    :: action
    1929             :         type(selection_type), intent(in)                    :: control
    1930             :     end subroutine
    1931             : #endif
    1932             : 
    1933             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1934             : 
    1935             :     end interface
    1936             : 
    1937             :     ! sel, new, backward
    1938             : 
    1939             :     interface setCumPropExp
    1940             : 
    1941             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1942             : 
    1943             : #if RK5_ENABLED
    1944             :     PURE module subroutine setCumPropExpSelNewBacNon_RK5(cumPropExp, array, maxArray, control, direction, action)
    1945             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1946             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewBacNon_RK5
    1947             : #endif
    1948             :         use pm_kind, only: RKC => RK5
    1949             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1950             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1951             :         real(RKC)           , intent(in)                    :: maxArray
    1952             :         type(backward_type) , intent(in)                    :: direction
    1953             :         type(nothing_type)  , intent(in)                    :: action
    1954             :         type(selection_type), intent(in)                    :: control
    1955             :     end subroutine
    1956             : #endif
    1957             : 
    1958             : #if RK4_ENABLED
    1959             :     PURE module subroutine setCumPropExpSelNewBacNon_RK4(cumPropExp, array, maxArray, control, direction, action)
    1960             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1961             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewBacNon_RK4
    1962             : #endif
    1963             :         use pm_kind, only: RKC => RK4
    1964             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1965             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1966             :         real(RKC)           , intent(in)                    :: maxArray
    1967             :         type(backward_type) , intent(in)                    :: direction
    1968             :         type(nothing_type)  , intent(in)                    :: action
    1969             :         type(selection_type), intent(in)                    :: control
    1970             :     end subroutine
    1971             : #endif
    1972             : 
    1973             : #if RK3_ENABLED
    1974             :     PURE module subroutine setCumPropExpSelNewBacNon_RK3(cumPropExp, array, maxArray, control, direction, action)
    1975             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1976             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewBacNon_RK3
    1977             : #endif
    1978             :         use pm_kind, only: RKC => RK3
    1979             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1980             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1981             :         real(RKC)           , intent(in)                    :: maxArray
    1982             :         type(backward_type) , intent(in)                    :: direction
    1983             :         type(nothing_type)  , intent(in)                    :: action
    1984             :         type(selection_type), intent(in)                    :: control
    1985             :     end subroutine
    1986             : #endif
    1987             : 
    1988             : #if RK2_ENABLED
    1989             :     PURE module subroutine setCumPropExpSelNewBacNon_RK2(cumPropExp, array, maxArray, control, direction, action)
    1990             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1991             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewBacNon_RK2
    1992             : #endif
    1993             :         use pm_kind, only: RKC => RK2
    1994             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    1995             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    1996             :         real(RKC)           , intent(in)                    :: maxArray
    1997             :         type(backward_type) , intent(in)                    :: direction
    1998             :         type(nothing_type)  , intent(in)                    :: action
    1999             :         type(selection_type), intent(in)                    :: control
    2000             :     end subroutine
    2001             : #endif
    2002             : 
    2003             : #if RK1_ENABLED
    2004             :     PURE module subroutine setCumPropExpSelNewBacNon_RK1(cumPropExp, array, maxArray, control, direction, action)
    2005             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    2006             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewBacNon_RK1
    2007             : #endif
    2008             :         use pm_kind, only: RKC => RK1
    2009             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    2010             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    2011             :         real(RKC)           , intent(in)                    :: maxArray
    2012             :         type(backward_type) , intent(in)                    :: direction
    2013             :         type(nothing_type)  , intent(in)                    :: action
    2014             :         type(selection_type), intent(in)                    :: control
    2015             :     end subroutine
    2016             : #endif
    2017             : 
    2018             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2019             : 
    2020             : #if RK5_ENABLED
    2021             :     PURE module subroutine setCumPropExpSelNewBacRev_RK5(cumPropExp, array, maxArray, control, direction, action)
    2022             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    2023             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewBacRev_RK5
    2024             : #endif
    2025             :         use pm_kind, only: RKC => RK5
    2026             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    2027             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    2028             :         real(RKC)           , intent(in)                    :: maxArray
    2029             :         type(backward_type) , intent(in)                    :: direction
    2030             :         type(reverse_type)  , intent(in)                    :: action
    2031             :         type(selection_type), intent(in)                    :: control
    2032             :     end subroutine
    2033             : #endif
    2034             : 
    2035             : #if RK4_ENABLED
    2036             :     PURE module subroutine setCumPropExpSelNewBacRev_RK4(cumPropExp, array, maxArray, control, direction, action)
    2037             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    2038             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewBacRev_RK4
    2039             : #endif
    2040             :         use pm_kind, only: RKC => RK4
    2041             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    2042             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    2043             :         real(RKC)           , intent(in)                    :: maxArray
    2044             :         type(backward_type) , intent(in)                    :: direction
    2045             :         type(reverse_type)  , intent(in)                    :: action
    2046             :         type(selection_type), intent(in)                    :: control
    2047             :     end subroutine
    2048             : #endif
    2049             : 
    2050             : #if RK3_ENABLED
    2051             :     PURE module subroutine setCumPropExpSelNewBacRev_RK3(cumPropExp, array, maxArray, control, direction, action)
    2052             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    2053             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewBacRev_RK3
    2054             : #endif
    2055             :         use pm_kind, only: RKC => RK3
    2056             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    2057             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    2058             :         real(RKC)           , intent(in)                    :: maxArray
    2059             :         type(backward_type) , intent(in)                    :: direction
    2060             :         type(reverse_type)  , intent(in)                    :: action
    2061             :         type(selection_type), intent(in)                    :: control
    2062             :     end subroutine
    2063             : #endif
    2064             : 
    2065             : #if RK2_ENABLED
    2066             :     PURE module subroutine setCumPropExpSelNewBacRev_RK2(cumPropExp, array, maxArray, control, direction, action)
    2067             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    2068             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewBacRev_RK2
    2069             : #endif
    2070             :         use pm_kind, only: RKC => RK2
    2071             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    2072             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    2073             :         real(RKC)           , intent(in)                    :: maxArray
    2074             :         type(backward_type) , intent(in)                    :: direction
    2075             :         type(reverse_type)  , intent(in)                    :: action
    2076             :         type(selection_type), intent(in)                    :: control
    2077             :     end subroutine
    2078             : #endif
    2079             : 
    2080             : #if RK1_ENABLED
    2081             :     PURE module subroutine setCumPropExpSelNewBacRev_RK1(cumPropExp, array, maxArray, control, direction, action)
    2082             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    2083             :         !DEC$ ATTRIBUTES DLLEXPORT :: setCumPropExpSelNewBacRev_RK1
    2084             : #endif
    2085             :         use pm_kind, only: RKC => RK1
    2086             :         real(RKC)           , intent(out)   , contiguous    :: cumPropExp(:)
    2087             :         real(RKC)           , intent(in)    , contiguous    :: array(:)
    2088             :         real(RKC)           , intent(in)                    :: maxArray
    2089             :         type(backward_type) , intent(in)                    :: direction
    2090             :         type(reverse_type)  , intent(in)                    :: action
    2091             :         type(selection_type), intent(in)                    :: control
    2092             :     end subroutine
    2093             : #endif
    2094             : 
    2095             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2096             : 
    2097             :     end interface
    2098             : 
    2099             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2100             : 
    2101             : contains
    2102             : 
    2103             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2104             : 
    2105             :     !>  \brief
    2106             :     !>  \legacy
    2107             :     !>  Generate and return the normalized cumulative sum (i.e., Cumulative Density Function (CDF)) of the exponentials
    2108             :     !>  of the input real vector robustly (without overflow or underflow). The last element of the returned vector is one.
    2109             :     !>
    2110             :     !>  \param[in]  array       :   The input `contiguous` vector of log-values whose log-sum-exp must be computed.
    2111             :     !>  \param[in]  maxArray    :   The maximum of the input `array` argument (`maxArray = maxval(array)`).
    2112             :     !>  \param[in]  lenArray    :   The length of the input array.
    2113             :     !>
    2114             :     !>  \return
    2115             :     !>  `cumPropExp`            :   A real vector of the same length as the input array `array`.
    2116             :     !>
    2117             :     !>  \warning
    2118             :     !>  This routine is only kept for backward compatibility and should not be used in production code.
    2119             :     !>  Instead, use the procedures under the generic interface [setCumPropExp](@ref pm_mathCumPropExp::setCumPropExp).
    2120             :     !>
    2121             :     !>  \finmain
    2122             :     !>
    2123             :     !>  \test
    2124             :     !>  [test_pm_mathCumPropExp](@ref test_pm_mathCumPropExp)
    2125             :     !>
    2126             :     !>  \author
    2127             :     !>  \AmirShahmoradi, April 25, 2015, 2:21 PM, National Institute for Fusion Studies, The University of Texas at Austin
    2128         200 :     pure function getCumPropExp_RK(array, maxArray, lenArray) result(cumPropExp)
    2129             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    2130             :         !DEC$ ATTRIBUTES DLLEXPORT :: getCumPropExp_RK
    2131             : #endif
    2132             :         use pm_kind, only: RKC => RK
    2133             :         real(RKC)   , parameter     :: LOGTINY_RK = log(tiny(0._RKC))
    2134             :         integer(IK) , intent(in)    :: lenArray
    2135             :         real(RKC)   , intent(in)    :: array(lenArray)
    2136             :         real(RKC)   , intent(in)    :: maxArray
    2137             :         real(RKC)                   :: cumPropExp(lenArray)
    2138             :         real(RKC)                   :: cumPropExpInv
    2139             :         integer(IK)                 :: i
    2140         200 :         cumPropExp(1) = array(1) - maxArray
    2141         200 :         if (cumPropExp(1) < LOGTINY_RK) then
    2142          82 :             cumPropExp(1) = 0._RKC
    2143             :         else
    2144         118 :             cumPropExp(1) = exp(cumPropExp(1))
    2145             :         end if
    2146        1040 :         do i = 2, lenArray
    2147         840 :             cumPropExp(i) = array(i) - maxArray
    2148        1040 :             if (cumPropExp(i) < LOGTINY_RK) then
    2149         436 :                 cumPropExp(i) = cumPropExp(i-1)
    2150             :             else
    2151         404 :                 cumPropExp(i) = cumPropExp(i-1) + exp(cumPropExp(i))
    2152             :             end if
    2153             :         end do
    2154         200 :         cumPropExpInv = 1._RKC / cumPropExp(lenArray)
    2155        1240 :         cumPropExp = cumPropExp * cumPropExpInv
    2156         200 :     end function
    2157             : 
    2158             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2159             : 
    2160             : end module pm_mathCumPropExp ! LCOV_EXCL_LINE

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