36 module function test_placeHolder()
result(assertion); logical(LK) :: assertion; end function
78 logical(
LK) :: assertion
79 integer(
IK) ,
parameter :: nd
= 3_IK
80 real(
RK) ,
parameter :: tolerance
= 1.e-12_RK
81 real(
RK) ,
parameter :: PosDefMat(nd,nd)
= reshape( [
1._RK,
0._RK,
1._RK &
82 ,
0._RK,
2._RK,
0._RK &
83 ,
1._RK,
0._RK,
3._RK ], shape
= shape(PosDefMat) )
84 real(
RK) ,
parameter :: MatInvMat_ref(nd,nd)
= reshape( [
1.500000000000000_RK,
0.000000000000000_RK,
-0.50000000000000_RK &
85 ,
0.000000000000000_RK,
0.500000000000000_RK,
0.000000000000000_RK &
86 ,
-0.50000000000000_RK,
0.000000000000000_RK,
0.500000000000000_RK ]
&
87 , shape
= shape(MatInvMat_ref) )
88 real(
RK) ,
parameter :: ChoDia_ref(nd)
= [
1.000000000000000_RK,
1.414213562373095_RK,
1.414213562373095_RK ]
89 real(
RK) ,
parameter :: sqrtDetInvPosDefMat_ref
= 0.5_RK
90 real(
RK) :: MatInvMat(nd,nd), sqrtDetInvPosDefMat
91 real(
RK),
allocatable :: MatInvMat_diff(:,:), sqrtDetInvPosDefMat_diff
95 call setInvPosDefMatSqrtDet(nd
= nd, MatInvMat
= MatInvMat, sqrtDetInvPosDefMat
= sqrtDetInvPosDefMat)
98 if (
allocated(MatInvMat_diff))
deallocate(MatInvMat_diff);
allocate(MatInvMat_diff,
mold = MatInvMat)
100 MatInvMat_diff
= abs(MatInvMat
- MatInvMat_ref)
101 sqrtDetInvPosDefMat_diff
= abs(sqrtDetInvPosDefMat
- sqrtDetInvPosDefMat_ref)
103 assertion
= all(MatInvMat_diff
< tolerance)
.and. sqrtDetInvPosDefMat_diff
< tolerance
105 if (
test%traceable
.and. .not. assertion)
then
107 write(
test%disp
%unit,
"(*(g0,:,', '))")
108 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat_ref = ", MatInvMat_ref
109 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat = ", MatInvMat
110 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat_diff = ", MatInvMat_diff
111 write(
test%disp
%unit,
"(*(g0,:,', '))")
112 write(
test%disp
%unit,
"(*(g0,:,', '))")
"sqrtDetInvPosDefMat_ref = ", sqrtDetInvPosDefMat_ref
113 write(
test%disp
%unit,
"(*(g0,:,', '))")
"sqrtDetInvPosDefMat_diff = ", sqrtDetInvPosDefMat
114 write(
test%disp
%unit,
"(*(g0,:,', '))")
"sqrtDetInvPosDefMat = ", sqrtDetInvPosDefMat_diff
115 write(
test%disp
%unit,
"(*(g0,:,', '))")
128 logical(
LK) :: assertion
129 integer(
IK) ,
parameter :: nd
= 3_IK
130 real(
RK) ,
parameter :: PosDefMat(nd,nd)
= reshape( [
1._RK,
0._RK,
-1._RK &
131 ,
0._RK,
2._RK,
-0._RK &
132 ,
1._RK,
0._RK,
-3._RK ], shape
= shape(PosDefMat) )
133 real(
RK) :: MatInvMat(nd,nd), sqrtDetInvPosDefMat
135 MatInvMat
= PosDefMat
137 call setInvPosDefMatSqrtDet(nd
= nd, MatInvMat
= MatInvMat, sqrtDetInvPosDefMat
= sqrtDetInvPosDefMat)
139 assertion
= sqrtDetInvPosDefMat
< 0._RK
141 if (
test%traceable
.and. .not. assertion)
then
143 write(
test%disp
%unit,
"(*(g0,:,', '))")
144 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat = ", MatInvMat
145 write(
test%disp
%unit,
"(*(g0,:,', '))")
"sqrtDetInvPosDefMat = ", sqrtDetInvPosDefMat
146 write(
test%disp
%unit,
"(*(g0,:,', '))")
159 logical(
LK) :: assertion
160 integer(
IK) ,
parameter :: nd
= 1_IK
161 real(
RK) ,
parameter :: tolerance
= 1.e-12_RK
162 real(
RK) ,
parameter :: MatInvMat_ref(nd,nd)
= reshape( [
0.5_RK ], shape
= shape(MatInvMat_ref) )
163 real(
RK) ,
parameter :: PosDefMat(nd,nd)
= reshape( [
2._RK ], shape
= shape(PosDefMat) )
164 real(
RK) ,
parameter :: sqrtDetInvPosDefMat_ref
= 0.5_RK
165 real(
RK) :: MatInvMat(nd,nd), sqrtDetInvPosDefMat
166 real(
RK),
allocatable :: MatInvMat_diff(:,:), sqrtDetInvPosDefMat_diff
168 MatInvMat
= PosDefMat
170 call setInvPosDefMatSqrtDet(nd
= nd, MatInvMat
= MatInvMat, sqrtDetInvPosDefMat
= sqrtDetInvPosDefMat)
171 if (
allocated(MatInvMat_diff))
deallocate(MatInvMat_diff);
allocate(MatInvMat_diff,
mold = MatInvMat)
173 MatInvMat_diff
= abs(MatInvMat
- MatInvMat_ref)
174 sqrtDetInvPosDefMat_diff
= abs(sqrtDetInvPosDefMat
- sqrtDetInvPosDefMat_ref)
176 assertion
= all(MatInvMat_diff
< tolerance)
.and. sqrtDetInvPosDefMat_diff
< tolerance
178 if (
test%traceable
.and. .not. assertion)
then
180 write(
test%disp
%unit,
"(*(g0,:,', '))")
181 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat_ref = ", MatInvMat_ref
182 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat = ", MatInvMat
183 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat_diff = ", MatInvMat_diff
184 write(
test%disp
%unit,
"(*(g0,:,', '))")
185 write(
test%disp
%unit,
"(*(g0,:,', '))")
"sqrtDetInvPosDefMat_ref = ", sqrtDetInvPosDefMat_ref
186 write(
test%disp
%unit,
"(*(g0,:,', '))")
"sqrtDetInvPosDefMat_diff = ", sqrtDetInvPosDefMat
187 write(
test%disp
%unit,
"(*(g0,:,', '))")
"sqrtDetInvPosDefMat = ", sqrtDetInvPosDefMat_diff
188 write(
test%disp
%unit,
"(*(g0,:,', '))")
202 logical(
LK) :: assertion
203 integer(
IK) ,
parameter :: nd
= 3_IK
204 real(
RK) ,
parameter :: tolerance
= 1.e-12_RK
205 real(
RK) ,
parameter :: choLow(nd,nd)
= reshape( [
1.000000000000000_RK,
0.000000000000000_RK,
1.000000000000000_RK &
206 ,
0.000000000000000_RK,
2.000000000000000_RK,
0.000000000000000_RK &
207 ,
1.000000000000000_RK,
0.000000000000000_RK,
3.000000000000000_RK ]
&
208 , shape
= shape(choLow) )
209 real(
RK) ,
parameter :: choDia(nd)
= [
1.000000000000000_RK,
1.414213562373095_RK,
1.414213562373095_RK ]
210 real(
RK) ,
parameter :: ChoDia_ref(nd)
= [
1.000000000000000_RK,
1.414213562373095_RK,
1.414213562373095_RK ]
211 real(
RK) ,
parameter :: InvMatFromChoLow_ref(nd,nd)
= reshape( [
1.500000000000000_RK,
0.000000000000000_RK,
-0.50000000000000_RK &
212 ,
0.000000000000000_RK,
0.500000000000000_RK,
0.000000000000000_RK &
213 ,
-0.50000000000000_RK,
0.000000000000000_RK,
0.500000000000000_RK ]
&
214 , shape
= shape(InvMatFromChoLow_ref) )
215 real(
RK) ,
parameter :: sqrtDetInvPosDefMat_ref
= 0.5_RK
216 real(
RK) :: InvMatFromChoLow(nd,nd)
217 real(
RK),
allocatable :: InvMatFromChoLow_diff(:,:)
219 InvMatFromChoLow
= getMatInvFromChoLow(nd
= nd, choLow
= choLow, choDia
= choDia)
222 if (
allocated(InvMatFromChoLow_diff))
deallocate(InvMatFromChoLow_diff);
allocate(InvMatFromChoLow_diff,
mold = InvMatFromChoLow)
224 InvMatFromChoLow_diff
= abs(InvMatFromChoLow
- InvMatFromChoLow_ref)
226 assertion
= all(InvMatFromChoLow_diff
< tolerance)
228 if (
test%traceable
.and. .not. assertion)
then
230 write(
test%disp
%unit,
"(*(g0,:,', '))")
231 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatFromChoLow_ref = ", InvMatFromChoLow_ref
232 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatFromChoLow = ", InvMatFromChoLow
233 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatFromChoLow_diff = ", InvMatFromChoLow_diff
234 write(
test%disp
%unit,
"(*(g0,:,', '))")
244 use pm_matrixSymCopy,
only: setMatSymFromMatLow
248 logical(
LK) :: assertion
249 integer(
IK) ,
parameter :: nd
= 3_IK
250 real(
RK) ,
parameter :: tolerance
= 1.e-12_RK
251 real(
RK) ,
parameter :: choLow(nd,nd)
= reshape( [
1.000000000000000_RK,
0.000000000000000_RK,
1.000000000000000_RK &
252 ,
0.000000000000000_RK,
2.000000000000000_RK,
0.000000000000000_RK &
253 ,
1.000000000000000_RK,
0.000000000000000_RK,
3.000000000000000_RK ]
&
254 , shape
= shape(choLow) )
255 real(
RK) ,
parameter :: choDia(nd)
= [
1.000000000000000_RK,
1.414213562373095_RK,
1.414213562373095_RK ]
256 real(
RK) ,
parameter :: ChoDia_ref(nd)
= [
1.000000000000000_RK,
1.414213562373095_RK,
1.414213562373095_RK ]
257 real(
RK) ,
parameter :: InvMatFromChoLow_ref(nd,nd)
= reshape( [
1.500000000000000_RK,
0.000000000000000_RK,
-0.50000000000000_RK &
258 ,
0.000000000000000_RK,
0.500000000000000_RK,
0.000000000000000_RK &
259 ,
-0.50000000000000_RK,
0.000000000000000_RK,
0.500000000000000_RK ]
&
260 , shape
= shape(InvMatFromChoLow_ref) )
261 real(
RK) ,
parameter :: sqrtDetInvPosDefMat_ref
= 0.5_RK
262 real(
RK) :: InvMatFromChoLow(nd,nd)
263 real(
RK),
allocatable :: InvMatFromChoLow_diff(:,:)
265 InvMatFromChoLow
= getInvLowFromChoLow(nd
= nd, choLow
= choLow, choDia
= choDia)
266 call setMatSymFromMatLow(InvMatFromChoLow)
268 allocate(InvMatFromChoLow_diff,
mold = InvMatFromChoLow)
270 InvMatFromChoLow_diff
= abs(InvMatFromChoLow
- InvMatFromChoLow_ref)
272 assertion
= all(InvMatFromChoLow_diff
< tolerance)
274 if (
test%traceable
.and. .not. assertion)
then
276 write(
test%disp
%unit,
"(*(g0,:,', '))")
277 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatFromChoLow_ref = ", InvMatFromChoLow_ref
278 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatFromChoLow = ", InvMatFromChoLow
279 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatFromChoLow_diff = ", InvMatFromChoLow_diff
280 write(
test%disp
%unit,
"(*(g0,:,', '))")
285 deallocate(InvMatFromChoLow_diff)
296 logical(
LK) :: assertion
297 integer(
IK) ,
parameter :: nd
= 3_IK
298 real(
RK) ,
parameter :: tolerance
= 1.e-12_RK
299 real(
RK) ,
parameter :: PosDefMat(nd,nd)
= reshape( [
1._RK,
0._RK,
1._RK &
300 ,
0._RK,
2._RK,
0._RK &
301 ,
1._RK,
0._RK,
3._RK ], shape
= shape(PosDefMat) )
302 real(
RK) ,
parameter :: MatInvMat_ref(nd,nd)
= reshape( [
1.500000000000000_RK,
0.000000000000000_RK,
-0.50000000000000_RK &
303 ,
0.000000000000000_RK,
0.500000000000000_RK,
0.000000000000000_RK &
304 ,
-0.50000000000000_RK,
0.000000000000000_RK,
0.500000000000000_RK ]
&
305 , shape
= shape(MatInvMat_ref) )
306 real(
RK) :: MatInvMat(nd,nd)
307 real(
RK),
allocatable :: MatInvMat_diff(:,:)
309 MatInvMat
= getInvPosDefMat(nd
= nd, PosDefMat
= PosDefMat)
312 if (
allocated(MatInvMat_diff))
deallocate(MatInvMat_diff);
allocate(MatInvMat_diff,
mold = MatInvMat)
313 MatInvMat_diff
= abs(MatInvMat
- MatInvMat_ref)
315 assertion
= all(MatInvMat_diff
< tolerance)
317 if (
test%traceable
.and. .not. assertion)
then
319 write(
test%disp
%unit,
"(*(g0,:,', '))")
320 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat_ref = ", MatInvMat_ref
321 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat = ", MatInvMat
322 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat_diff = ", MatInvMat_diff
323 write(
test%disp
%unit,
"(*(g0,:,', '))")
338 logical(
LK) :: assertion
339 integer(
IK) ,
parameter :: nd
= 3_IK
340 real(
RK) ,
parameter :: PosDefMat(nd,nd)
= reshape( [
1._RK,
0._RK,
-1._RK &
341 ,
0._RK,
2._RK,
-0._RK &
342 ,
1._RK,
0._RK,
-3._RK ], shape
= shape(PosDefMat) )
343 real(
RK) :: MatInvMat(nd,nd)
345 MatInvMat
= getInvPosDefMat(nd
= nd, PosDefMat
= PosDefMat)
347 assertion
= MatInvMat(
1,
1)
< 0._RK
349 if (
test%traceable
.and. .not. assertion)
then
351 write(
test%disp
%unit,
"(*(g0,:,', '))")
352 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat = ", MatInvMat
353 write(
test%disp
%unit,
"(*(g0,:,', '))")
366 logical(
LK) :: assertion
367 integer(
IK) ,
parameter :: nd
= 3_IK
368 real(
RK) ,
parameter :: tolerance
= 1.e-12_RK
369 real(
RK) ,
parameter :: PosDefMat(nd,nd)
= reshape( [
1._RK,
0._RK,
1._RK &
370 ,
0._RK,
2._RK,
0._RK &
371 ,
1._RK,
0._RK,
3._RK ], shape
= shape(PosDefMat) )
372 real(
RK) ,
parameter :: MatInvMat_ref(nd,nd)
= reshape( [
1.500000000000000_RK,
0.000000000000000_RK,
-0.50000000000000_RK &
373 ,
0.000000000000000_RK,
0.500000000000000_RK,
0.000000000000000_RK &
374 ,
-0.50000000000000_RK,
0.000000000000000_RK,
0.500000000000000_RK ]
&
375 , shape
= shape(MatInvMat_ref) )
376 real(
RK) ,
parameter :: MatrixLUP_ref(nd,nd)
= reshape( [
1.000000000000000_RK,
0.000000000000000_RK,
1.000000000000000_RK &
377 ,
0.000000000000000_RK,
2.000000000000000_RK,
0.000000000000000_RK &
378 ,
1.000000000000000_RK,
0.000000000000000_RK,
2.000000000000000_RK ]
&
379 , shape
= shape(MatInvMat_ref) )
380 real(
RK) ,
parameter :: detInvMat_ref
= 0.25_RK
381 real(
RK) :: MatInvMat(nd,nd), detInvMat, detInvMat_diff
382 real(
RK),
allocatable :: MatrixLUP(:,:), MatInvMat_diff(:,:), MatrixLUP_diff(:,:)
384 MatrixLUP
= PosDefMat
386 call getMatInvDet(nd
= nd, MatrixLUP
= MatrixLUP, InverseMatrix
= MatInvMat, detInvMat
= detInvMat, failed
= assertion)
387 assertion
= .not. assertion
388 call test%assert(assertion)
391 if (
allocated(MatrixLUP_diff))
deallocate(MatrixLUP_diff);
allocate(MatrixLUP_diff,
mold = MatrixLUP)
392 MatrixLUP_diff
= abs(MatrixLUP
- MatrixLUP_ref)
395 if (
allocated(MatInvMat_diff))
deallocate(MatInvMat_diff);
allocate(MatInvMat_diff,
mold = MatInvMat)
396 MatInvMat_diff
= abs(MatInvMat
- MatInvMat_ref)
398 detInvMat_diff
= abs(detInvMat
- detInvMat_ref)
400 assertion
= all(MatInvMat_diff
< tolerance)
.and. detInvMat_diff
< tolerance
402 if (
test%traceable
.and. .not. assertion)
then
404 write(
test%disp
%unit,
"(*(g0,:,', '))")
405 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatrixLUP_ref = ", MatrixLUP_ref
406 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatrixLUP = ", MatrixLUP
407 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatrixLUP_diff = ", MatrixLUP_diff
408 write(
test%disp
%unit,
"(*(g0,:,', '))")
409 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat_ref = ", MatInvMat_ref
410 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat = ", MatInvMat
411 write(
test%disp
%unit,
"(*(g0,:,', '))")
"MatInvMat_diff = ", MatInvMat_diff
412 write(
test%disp
%unit,
"(*(g0,:,', '))")
413 write(
test%disp
%unit,
"(*(g0,:,', '))")
"detInvMat_ref = ", detInvMat_ref
414 write(
test%disp
%unit,
"(*(g0,:,', '))")
"detInvMat = ", detInvMat
415 write(
test%disp
%unit,
"(*(g0,:,', '))")
"detInvMat_diff = ", detInvMat_diff
416 write(
test%disp
%unit,
"(*(g0,:,', '))")
429 logical(
LK) :: assertion
430 integer(
IK) ,
parameter :: nd
= 3_IK
431 real(
RK) ,
parameter :: tolerance
= 1.e-12_RK
432 real(
RK) ,
parameter :: PosDefMat(nd,nd)
= reshape( [
1._RK,
0._RK,
1._RK &
433 ,
0._RK,
2._RK,
0._RK &
434 ,
1._RK,
0._RK,
3._RK ], shape
= shape(PosDefMat) )
435 real(
RK) ,
parameter :: InverseMatrix_ref(nd,nd)
= reshape( [
1.500000000000000_RK,
0.000000000000000_RK,
-0.50000000000000_RK &
436 ,
0.000000000000000_RK,
0.500000000000000_RK,
0.000000000000000_RK &
437 ,
-0.50000000000000_RK,
0.000000000000000_RK,
0.500000000000000_RK ]
&
438 , shape
= shape(InverseMatrix_ref) )
439 real(
RK) :: InverseMatrix(nd,nd)
440 real(
RK),
allocatable :: InverseMatrix_diff(:,:)
442 InverseMatrix
= getMatInv(nd
= nd, Matrix
= PosDefMat)
445 if (
allocated(InverseMatrix_diff))
deallocate(InverseMatrix_diff);
allocate(InverseMatrix_diff,
mold = InverseMatrix)
447 InverseMatrix_diff
= abs(InverseMatrix
- InverseMatrix_ref)
449 assertion
= all(InverseMatrix_diff
< tolerance)
451 if (
test%traceable
.and. .not. assertion)
then
453 write(
test%disp
%unit,
"(*(g0,:,', '))")
454 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InverseMatrix_ref = ", InverseMatrix_ref
455 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InverseMatrix = ", InverseMatrix
456 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InverseMatrix_diff = ", InverseMatrix_diff
457 write(
test%disp
%unit,
"(*(g0,:,', '))")
470 logical(
LK) :: assertion
472 integer(
IK) ,
parameter :: nd
= 3_IK
473 real(
RK) ,
parameter :: tolerance
= 1.e-12_RK
474 real(
RK) ,
parameter :: PosDefMat(nd,nd)
= reshape( [
1.00_RK,
+0.25_RK,
+1.0_RK &
475 ,
0.25_RK,
+2.00_RK,
-0.5_RK &
476 ,
1.00_RK,
-0.50_RK,
+3.0_RK ], shape
= shape(PosDefMat) )
478 real(
RK) ,
parameter :: MatLow(nd,nd)
= transpose(
reshape( [
1.00_RK,
0._RK,
0._RK &
479 ,
0.25_RK,
+1.391941090707505_RK,
0._RK &
480 ,
1.00_RK,
-0.538815906080325_RK,
1.307546335452338_RK ], shape
= shape(MatLow)))
481 real(
RK) ,
parameter :: InvMatLow_ref(nd,nd)
= transpose(
reshape([
+1.000000000000000_RK,
0._RK,
0._RK &
482 ,
-0.179605302026775_RK,
0.718421208107100_RK,
0._RK &
483 ,
-0.838803309535462_RK,
0.296048226894869_RK,
0.764791252811745_RK ], shape
= shape(InvMatLow_ref)))
484 real(
RK) :: InvMatLow(nd,nd)
485 real(
RK),
allocatable :: InvMatLow_diff(:)
487 InvMatLow
= getLogPDF(nd, MatLow)
489 InvMatLow_diff
= abs([((InvMatLow(i,j)
- InvMatLow_ref(i,j), i
= j, nd), j
= 1, nd)])
490 assertion
= all(InvMatLow_diff
< tolerance)
492 if (
test%traceable
.and. .not. assertion)
then
494 write(
test%disp
%unit,
"(*(g0,:,', '))")
495 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatLow_ref = ", InvMatLow_ref
496 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatLow = ", InvMatLow
497 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatLow_diff = ", InvMatLow_diff
498 write(
test%disp
%unit,
"(*(g0,:,', '))")
503 deallocate(InvMatLow_diff)
514 logical(
LK) :: assertion
516 integer(
IK) ,
parameter :: nd
= 3_IK
517 real(
RK) ,
parameter :: tolerance
= 1.e-12_RK
518 real(
RK) ,
parameter :: PosDefMat(nd,nd)
= reshape( [
1.00_RK,
+0.25_RK,
+1.0_RK &
519 ,
0.25_RK,
+2.00_RK,
-0.5_RK &
520 ,
1.00_RK,
-0.50_RK,
+3.0_RK ], shape
= shape(PosDefMat) )
522 real(
RK) ,
parameter :: MatLow(nd,nd)
= transpose(
reshape( [
0.00_RK,
0._RK,
0._RK &
523 ,
0.25_RK,
0._RK,
0._RK &
524 ,
1.00_RK,
-0.538815906080325_RK,
0._RK ], shape
= shape(MatLow)))
525 real(
RK) ,
parameter :: DiagMat(nd)
= [
1.00_RK,
1.391941090707505_RK,
1.307546335452338_RK]
526 real(
RK) ,
parameter :: InvMatLow_ref(nd,nd)
= transpose(
reshape([
+1.000000000000000_RK,
0._RK,
0._RK &
527 ,
-0.179605302026775_RK,
0.718421208107100_RK,
0._RK &
528 ,
-0.838803309535462_RK,
0.296048226894869_RK,
0.764791252811745_RK ], shape
= shape(InvMatLow_ref)))
529 real(
RK) :: InvMatLow(nd,nd)
530 real(
RK),
allocatable :: InvMatLow_diff(:)
532 InvMatLow
= getLogPDF(nd, MatLow, DiagMat)
534 InvMatLow_diff
= abs([((InvMatLow(i,j)
- InvMatLow_ref(i,j), i
= j, nd), j
= 1, nd)])
535 assertion
= all(InvMatLow_diff
< tolerance)
537 if (
test%traceable
.and. .not. assertion)
then
539 write(
test%disp
%unit,
"(*(g0,:,', '))")
540 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatLow_ref = ", InvMatLow_ref
541 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatLow = ", InvMatLow
542 write(
test%disp
%unit,
"(*(g0,:,', '))")
"InvMatLow_diff = ", InvMatLow_diff
543 write(
test%disp
%unit,
"(*(g0,:,', '))")
548 deallocate(InvMatLow_diff)
This module contains classes and procedures for reporting and handling errors.
character(*, SK), parameter MODULE_NAME
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
This module contains abstract and concrete derived types and procedures related to various common mat...
This module contains a simple unit-testing framework for the Fortran libraries, including the ParaMon...
This module contains tests of the module pm_matrixInv.
logical(LK) function test_getInvChoLow_1()
logical(LK) function test_getMatInvLow_1()
logical(LK) function test_getInvPosDefMat_1()
logical(LK) function test_genInvMat_1()
logical(LK) function test_getInvPosDefMatSqrtDet_3()
Test with an 1-dimensional input matrix.
logical(LK) function test_getMatInvFromChoLow_1()
logical(LK) function test_getInvPosDefMatSqrtDet_1()
logical(LK) function test_getInvPosDefMat_2()
The first element of MatInvMat must be set to a negative value, if the input matrix is non-positive-d...
logical(LK) function test_getInvPosDefMatSqrtDet_2()
The output sqrtDetInvPosDefMat must be set to a negative value, if the input matrix is non-positive-d...
logical(LK) function test_getMatInvDet_1()
logical(LK) function test_getInvLowFromChoLow_1()
This is the derived type for generating objects to gracefully and verbosely handle runtime unexpected...
This is the derived type test_type for generating objects that facilitate testing of a series of proc...