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 the implementations of the tests of procedures of [test_pm_complexCompareAll](@ref test_pm_complexCompareAll).
19 : !>
20 : !> \author
21 : !> \AmirShahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin
22 :
23 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24 :
25 : use pm_distUnif, only: setUnifRand
26 : use pm_kind, only: SK, IK, LK
27 : use pm_val2str, only: getStr
28 :
29 : #if isallless_CK_ENABLED
30 : #define COMPARES_WITH_DEF <
31 : #define COMPARES_WITH <
32 : character(*, SK), parameter :: PROCEDURE_NAME = "isallless()"
33 : #elif isallleq_CK_ENABLED
34 : #define COMPARES_WITH_DEF <=
35 : #define COMPARES_WITH <=
36 : character(*, SK), parameter :: PROCEDURE_NAME = "isallleq()"
37 : #elif isallneq_CK_ENABLED
38 : #define COMPARES_WITH_DEF /=
39 : #define COMPARES_WITH .allneq.
40 : character(*, SK), parameter :: PROCEDURE_NAME = "isallneq()"
41 : #elif isallmeq_CK_ENABLED
42 : #define COMPARES_WITH_DEF >=
43 : #define COMPARES_WITH >=
44 : character(*, SK), parameter :: PROCEDURE_NAME = "isallmeq()"
45 : #elif isallmore_CK_ENABLED
46 : #define COMPARES_WITH_DEF >
47 : #define COMPARES_WITH >
48 : character(*, SK), parameter :: PROCEDURE_NAME = "isallmore()"
49 : #else
50 : #error "Unrecognized interface."
51 : #endif
52 :
53 : integer(IK) , parameter :: NP = 5_IK
54 : integer(IK) :: i, j
55 : logical(LK) :: result(NP,NP), result_def(NP,NP)
56 : complex(CKC) :: mat1(NP,NP)
57 : complex(CKC) :: mat2(NP,NP)
58 :
59 20 : assertion = .true._LK
60 :
61 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 :
63 :
64 120 : do j = 1, NP
65 620 : do i = 1, NP
66 500 : call setUnifRand(mat1(i,j))
67 500 : call setUnifRand(mat2(i,j))
68 500 : result(i,j) = mat1(i,j) COMPARES_WITH mat2(i,j)
69 500 : result_def(i,j) = mat1(i,j)%re COMPARES_WITH_DEF mat2(i,j)%re .and. mat1(i,j)%im COMPARES_WITH_DEF mat2(i,j)%im
70 600 : assertion = assertion .and. (result(i,j) .eqv. result_def(i,j))
71 : end do
72 : end do
73 20 : call report()
74 20 : call test%assert(assertion, PROCEDURE_NAME//SK_" must return correctly compare scalar complex values.")
75 :
76 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 :
78 120 : do j = 1, NP
79 600 : call setUnifRand(mat1(:,j))
80 600 : call setUnifRand(mat2(:,j))
81 1100 : result(:,j) = mat1(:,j) COMPARES_WITH mat2(:,j)
82 600 : result_def(:,j) = mat1(:,j)%re COMPARES_WITH_DEF mat2(:,j)%re .and. mat1(:,j)%im COMPARES_WITH_DEF mat2(:,j)%im
83 620 : assertion = assertion .and. all(result(:,j) .eqv. result_def(:,j))
84 : end do
85 20 : call report()
86 20 : call test%assert(assertion, PROCEDURE_NAME//SK_" must return correctly compare vector complex values.")
87 :
88 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89 :
90 620 : call setUnifRand(mat1(:,:))
91 620 : call setUnifRand(mat2(:,:))
92 1220 : result(:,:) = mat1(:,:) COMPARES_WITH mat2(:,:)
93 620 : result_def(:,:) = mat1(:,:)%re COMPARES_WITH_DEF mat2(:,:)%re .and. mat1(:,:)%im COMPARES_WITH_DEF mat2(:,:)%im
94 620 : assertion = assertion .and. all(result(:,:) .eqv. result_def(:,:))
95 20 : call report()
96 20 : call test%assert(assertion, PROCEDURE_NAME//SK_" must return correctly compare matrix complex values.")
97 :
98 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 :
100 : contains
101 :
102 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
103 :
104 60 : subroutine report()
105 60 : if (test%traceable .and. .not. assertion) then
106 : ! LCOV_EXCL_START
107 : loopOverRows: do j = 1, NP
108 : do i = 1, NP
109 : if (result(i,j) .neqv. result_def(i,j)) then
110 : write(test%disp%unit,"(*(g0,:,', '))")
111 : write(test%disp%unit,"(*(g0,:,', '))") "mat1(i,j) ", mat1(i,j)
112 : write(test%disp%unit,"(*(g0,:,', '))") "mat2(i,j) ", mat2(i,j)
113 : write(test%disp%unit,"(*(g0,:,', '))")
114 : exit loopOverRows
115 : end if
116 : end do
117 : end do loopOverRows
118 : ! LCOV_EXCL_STOP
119 : end if
120 60 : end subroutine
121 :
122 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123 :
124 : #undef COMPARES_WITH_DEF
125 : #undef COMPARES_WITH
|