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

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!                                                                                                                            !!!!
       4             : !!!!    ParaMonte: Parallel Monte Carlo and Machine Learning Library.                                                           !!!!
       5             : !!!!                                                                                                                            !!!!
       6             : !!!!    Copyright (C) 2012-present, The Computational Data Science Lab                                                          !!!!
       7             : !!!!                                                                                                                            !!!!
       8             : !!!!    This file is part of the ParaMonte library.                                                                             !!!!
       9             : !!!!                                                                                                                            !!!!
      10             : !!!!    LICENSE                                                                                                                 !!!!
      11             : !!!!                                                                                                                            !!!!
      12             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/LICENSE.md                                                          !!!!
      13             : !!!!                                                                                                                            !!!!
      14             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      15             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      16             : 
      17             : !>  \brief
      18             : !>  This include file contains procedure implementation of [getLinSpace](@ref pm_arraySpace::getLinSpace).
      19             : !>
      20             : !>  \finmain
      21             : !>
      22             : !>  \author
      23             : !>  \AmirShahmoradi, Sunday 3:33 PM, September 19, 2021, Dallas, TX
      24             : 
      25             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      26             : 
      27             :         !%%%%%%%%%%%%%%%%%%
      28             : #if     getLinSpace_ENABLED
      29             :         !%%%%%%%%%%%%%%%%%%
      30             : 
      31        1637 :         CHECK_ASSERTION(__LINE__, 0 <= count, SK_"@getLinSpace(): The condition `0 <= count` must hold. count = "//getStr(count))
      32        1637 :         call setLinSpace(linSpace, x1, x2, fopen, lopen)
      33             : 
      34             :         !%%%%%%%%%%%%%%%%%%
      35             : #elif   setLinSpace_ENABLED
      36             :         !%%%%%%%%%%%%%%%%%%
      37             : 
      38             : #if     CK_ENABLED
      39             : #define TYPE_OF_SPACE complex(TKC)
      40             : #elif   RK_ENABLED
      41             : #define TYPE_OF_SPACE real(TKC)
      42             : #else
      43             : #error  "Unrecognized interface."
      44             : #endif
      45             :         integer(IK) :: i, count
      46             :         logical(LK) :: fopen_def, lopen_def
      47             :         real(TKC), parameter :: HALF = 0.5_TKC
      48             :         TYPE_OF_SPACE :: stepSize, start
      49       14601 :         count = size(linSpace, 1, IK)
      50       14601 :         if (0_IK < count) then
      51       13929 :             if (present(fopen)) then
      52        1356 :                 fopen_def = fopen
      53             :             else
      54             :                 fopen_def = .false._LK
      55             :             end if
      56       13929 :             if (present(lopen)) then
      57        1356 :                 lopen_def = lopen
      58             :             else
      59             :                 lopen_def = .false._LK
      60             :             end if
      61        1356 :             if (lopen_def) then
      62         684 :                 stepSize = (x2 - x1) / count
      63         684 :                 if (fopen_def) then
      64         348 :                     start = x1 + HALF * stepSize
      65             :                 else
      66         204 :                     start = x1
      67             :                 end if
      68             :             else
      69       13245 :                 if (fopen_def) then
      70         336 :                     stepSize = (x2 - x1) / count
      71         336 :                     start = x1 + stepSize
      72       12909 :                 elseif (count > 1_IK) then
      73       12172 :                     stepSize = (x2 - x1) / (count - 1_IK)
      74         545 :                     start = x1
      75             :                 elseif (count == 1_IK) then
      76         384 :                     linSpace = x1
      77             :                     return
      78             :                 end if
      79       13053 :                 count = count - 1
      80             :             end if
      81       13737 :             linSpace(0) = start
      82       13737 :             do concurrent(i = 1 : count - 1)
      83      263848 :                 linSpace(i) = start + i * stepSize
      84             :             end do
      85       13737 :             if (.not. lopen_def) linSpace(count) = x2
      86             :         end if
      87             : #undef  TYPE_OF_SPACE
      88             : 
      89             :         !%%%%%%%%%%%%%%%%%%
      90             : #elif   getLogSpace_ENABLED
      91             :         !%%%%%%%%%%%%%%%%%%
      92             : 
      93         927 :         CHECK_ASSERTION(__LINE__, 0 <= count, SK_"@getLogSpace(): The condition `0 <= count` must hold. count = "//getStr(count))
      94             :         !CHECK_ASSERTION(__LINE__, 0. < base .and. base /= 1., SK_"@getLogSpace(): The condition `0. < base .and. base /= 1.` must hold. base = "//getStr(base))
      95         927 :         if (present(base)) then
      96        1712 :             logSpace = base**getLinSpace(logx1, logx2, count, fopen, lopen)
      97             :         else
      98       29567 :             logSpace = exp(getLinSpace(logx1, logx2, count, fopen, lopen))
      99             :         end if
     100             : 
     101             :         !%%%%%%%%%%%%%%%%%%
     102             : #elif   setLogSpace_ENABLED
     103             :         !%%%%%%%%%%%%%%%%%%
     104             : 
     105             :         !CHECK_ASSERTION(__LINE__, 0. < base .and. base /= 1., SK_"@getLogSpace(): The condition `0. < base .and. base /= 1.` must hold. base = "//getStr(base))
     106         917 :         call setLinSpace(logSpace, logx1, logx2, fopen, lopen)
     107         917 :         if (present(base)) then
     108        1712 :             logSpace = base**logSpace
     109             :         else
     110       24575 :             logSpace = exp(logSpace)
     111             :         end if
     112             : #else
     113             :         !%%%%%%%%%%%%%%%%%%%%%%%%
     114             : #error  "Unrecognized interface."
     115             :         !%%%%%%%%%%%%%%%%%%%%%%%%
     116             : #endif

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