ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
test_pm_distGeomCyclic.F90
Go to the documentation of this file.
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
24
25!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26
28
29 use pm_test, only: test_type, LK
31 implicit none
32
33 private
34 public :: setTest
35 type(test_type) :: test
36
37!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38
39contains
40
41!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42
43 subroutine setTest()
44
46 call test%run(test_fitGeoCyclicLogPDF_1, SK_"test_fitGeoCyclicLogPDF_1")
47 call test%summarize()
48
49 end subroutine setTest
50
51!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52
53 function test_fitGeoCyclicLogPDF_1() result(assertion)
54 use pm_kind, only: IK, RK
55 implicit none
56 logical(LK) :: assertion
57 integer(IK) :: i
58 integer(IK) , parameter :: nparam = 2_IK
59 integer(IK) , parameter :: numTrial = 64_IK
60 integer(IK) , parameter :: maxNumTrial = 64_IK
61 integer(IK) , parameter :: SuccessStep(numTrial) = [ (i, i = 1, numTrial) ]
62 real(RK) , parameter :: LogCount(numTrial) = log( real( [ 64_IK, 55_IK, 53_IK, 43_IK, 54_IK, 41_IK &
63 , 45_IK, 55_IK, 50_IK, 42_IK, 48_IK, 52_IK &
64 , 38_IK, 52_IK, 56_IK, 54_IK, 45_IK, 54_IK &
65 , 69_IK, 50_IK, 50_IK, 49_IK, 45_IK, 38_IK &
66 , 45_IK, 34_IK, 55_IK, 51_IK, 49_IK, 49_IK &
67 , 47_IK, 58_IK, 37_IK, 54_IK, 50_IK, 59_IK &
68 , 37_IK, 39_IK, 36_IK, 52_IK, 51_IK, 37_IK &
69 , 44_IK, 46_IK, 37_IK, 29_IK, 41_IK, 39_IK &
70 , 50_IK, 39_IK, 46_IK, 42_IK, 54_IK, 54_IK &
71 , 54_IK, 24_IK, 44_IK, 43_IK, 37_IK, 43_IK &
72 , 53_IK, 47_IK, 50_IK, 42_IK ], kind = RK ))
73 real(RK) , parameter :: successProb = 0.7_RK
74 real(RK) , parameter :: tolerance = 1.e-6_RK
75 real(RK) :: xmin_ref(nparam) = [ 0.31952589641887075E-002_RK, 7.992349027030083_RK ]
76 real(RK) :: Difference(nparam)
77 type(FitGeoCyclic_type) :: FitGeoCyclic
78
79 FitGeoCyclic%powellMin = FitGeoCyclic%fit(maxNumTrial, numTrial, SuccessStep, LogCount)
80 assertion = .not. FitGeoCyclic%powellMin%err%occurred
81 call test%assert(assertion)
82
83 Difference = abs(FitGeoCyclic%powellMin%xmin - xmin_ref) / abs(xmin_ref)
84 assertion = all( Difference < tolerance )
85 call test%assert(assertion)
86
87 if (test%traceable .and. .not. assertion) then
88 ! LCOV_EXCL_START
89 write(test%disp%unit,"(*(g0,:,' '))")
90 write(test%disp%unit,"(*(g0,:,' '))") "xmin_ref =", xmin_ref
91 write(test%disp%unit,"(*(g0,:,' '))") "xmin =", FitGeoCyclic%powellMin%xmin
92 write(test%disp%unit,"(*(g0,:,' '))") "Difference =", Difference
93 write(test%disp%unit,"(*(g0,:,' '))")
94 end if
95 ! LCOV_EXCL_STOP
96
97 end function test_fitGeoCyclicLogPDF_1
98
99!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
100
101end module test_pm_distGeomCyclic
This module contains classes and procedures for computing various statistical quantities related to t...
character(*, SK), parameter MODULE_NAME
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
Definition: pm_kind.F90:543
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
This module contains a simple unit-testing framework for the Fortran libraries, including the ParaMon...
Definition: pm_test.F90:42
This module contains tests of the module pm_distGeomCyclic.
logical(LK) function test_fitGeoCyclicLogPDF_1()
This is the derived type test_type for generating objects that facilitate testing of a series of proc...
Definition: pm_test.F90:209