ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_matrixDet::setMatDetSqrt Interface Reference

Return the determinant of the input positive-definite square matrix. More...

Detailed Description

Return the determinant of the input positive-definite square matrix.

The positive-definiteness guarantee by the user enables a fast method of computing the square root of the determinant of the input positive-definite square matrix via its Cholesky Factorization.
For high rank matrices, there is an overflow possibility for the output of this generic interface.
The overflow risk can be avoided by calling setMatDetSqrtLog instead.

Note
This generic interface is meant to facilitate simultaneous computation of the Cholesky factorization and determinant of a input positive definite matrix.
If the Cholesky factorization is already computed, simply compute the determinant as the square of the multiplicative trace of the Cholesky factor.
Parameters
[in]mat: The input contiguous matrix of shape (1:ndim, 1:ndim) of
  1. type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128),
  2. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing a subset of the positive-definite matrix whose log(sqrt(determinant)) is to be computed.
[in]subset: The input scalar that can be either,
  1. the constant uppDia implying that the upper-diagonal triangular block of mat should be used for building the lower-diagonal Cholesky factor in the output chol.
  2. the constant lowDia implying that the lower-diagonal triangular block of mat should be used for building the upper-diagonal Cholesky factor in the output chol.
This argument is merely a convenience to differentiate the different procedure functionalities within this generic interface.
[out]detSqrt: The output scalar of type real of the same kind as the input mat representing the square root of its determinant.
[out]info: The output scalar integer of default kind IK that is 0 if and only if the Cholesky factorization succeeds.
Otherwise, it is set to the order of the leading minor of the specified input subset of mat that is not positive definite, indicating the occurrence of an error and that the factorization could not be completed.
A non-zero value implies failure of the Cholesky factorization.
A non-zero info implied the input mat is not positive definite.
[in,out]chol: The input/output matrix of the same type, kind, and shape as the input mat containing the Cholesky factorization in its triangular subset dictated by the input arguments subset and operation.
See the documentation of the input argument mat above for more information.
[in]operation: The input scalar that can be either,
  1. the constant nothing implying that the same subset of the output chol as the input subset must be populated with the Cholesky factorization.
  2. the constant transHerm implying that the complex transpose of the computed Cholesky factorization must be written to the output chol.


Possible calling interfaces

call setMatDetSqrtLog(mat, subset, detSqrt, info, chol, operation)
Return the natural logarithm of the square-root of the determinant of the input positive-definite squ...
This module contains procedures and generic interfaces relevant to the computation of the determinant...
Warning
The condition size(mat, 1) == size(mat, 2) must hold for the corresponding input arguments.
This condition is verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
The input mat is assumed to be positive-definite, otherwise the Cholesky Factorization within the procedure will fail, in which case, the procedure will return the control with info /= 0.
The pure procedure(s) documented herein become impure when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1.
By default, these procedures are pure in release build and impure in debug and testing builds.
See also
getMatDet
setMatDet
getMatDetSqrt
setMatDetSqrt
getMatDetSqrtLog
setMatDetSqrtLog
getMatMulTrace


Example usage

1program example
2
3 use pm_kind, only: SK, IK, LK
4 use pm_matrixCopy, only: rdpack
5 use pm_matrixCopy, only: transHerm
10 use pm_matrixChol, only: uppDia, lowDia
11 use pm_matrixChol, only: getMatChol
12 use pm_distCov, only: getCovRand
13 use pm_arrayResize, only: setResized
14 use pm_distUnif, only: getUnifRand
15 use pm_matrixInv, only: getMatInv
16 use pm_io, only: display_type
17 use pm_io, only: getFormat
18
19 implicit none
20
21 integer(IK) :: info, ndim, itry, ntry = 10
22 character(:, SK), allocatable :: format
23 type(display_type) :: disp
24
25 disp = display_type(file = "main.out.F90")
26
27 call disp%skip()
28 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
29 call disp%show("! Compute the sqrt of the determinant of the positive definite matrix.")
30 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
31 call disp%skip()
32
33 block
34 use pm_kind, only: TKG => RKS
35 real(TKG), allocatable :: mat(:,:)
36 real(TKG) :: detSqrtLog
37 format = getFormat(mold = [0._TKG], ed = SK_"e")
38 do itry = 1, ntry
39 call disp%skip()
40 call disp%show("ndim = getUnifRand(1, 5)")
41 ndim = getUnifRand(1, 5)
42 call disp%show("ndim")
43 call disp%show( ndim )
44 call disp%show("call setResized(mat, [ndim, ndim + 1])")
45 call setResized(mat, [ndim, ndim + 1])
46 call disp%show("mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)")
47 mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
48 call disp%show("mat(:,1:ndim)")
49 call disp%show( mat(:,1:ndim) , format = format )
50 call disp%show("mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.")
51 mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG)
52 call disp%show("mat(:,1:ndim)")
53 call disp%show( mat(:,1:ndim) , format = format )
54 call disp%show("call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)")
55 call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
56 call disp%show("if (info /= 0) error stop 'Cholesky factorization failed.'")
57 if (info /= 0) error stop 'Cholesky factorization failed.'
58 call disp%show("detSqrtLog")
59 call disp%show( detSqrtLog )
60 call disp%show("mat")
61 call disp%show( mat , format = format )
62 call disp%show("getMatChol(mat(:,1:ndim), lowDia)")
63 call disp%show( getMatChol(mat(:,1:ndim), lowDia) , format = format )
64 call disp%show("getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.")
65 call disp%show( getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) )
66 call disp%show("detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.")
67 call disp%show( detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) )
68 call disp%skip()
69 call disp%show("mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)")
70 mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
71 call disp%show("mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.")
72 mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG)
73 call disp%show("mat(:,2:ndim+1)")
74 call disp%show( mat(:,2:ndim+1) , format = format )
75 call disp%show("call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)")
76 call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
77 call disp%show("if (info /= 0) error stop 'Cholesky factorization failed.'")
78 if (info /= 0) error stop 'Cholesky factorization failed.'
79 call disp%show("detSqrtLog")
80 call disp%show( detSqrtLog )
81 call disp%show("mat")
82 call disp%show( mat , format = format )
83 call disp%show("getMatChol(mat(:,2:ndim+1), uppDia)")
84 call disp%show( getMatChol(mat(:,2:ndim+1), uppDia) , format = format )
85 call disp%show("getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.")
86 call disp%show( getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) )
87 call disp%show("detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.")
88 call disp%show( detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) )
89 call disp%skip()
90 end do
91 end block
92
93 block
94 use pm_kind, only: TKG => CKS
95 integer(IK), parameter :: ndim = 3
96 complex(TKG), allocatable :: tmp(:,:)
97 complex(TKG), parameter :: mat(*,*) = reshape( [ (9.0, 0.0), (3.0, 3.0), (3.0, -3.0) &
98 , (3.0, -3.0),(18.0, 0.0), (8.0, -6.0) &
99 , (3.0, 3.0), (8.0, 6.0),(43.0, 0.0) &
100 ], shape = [ndim, ndim], order = [2, 1])
101 real(TKG) :: detSqrtLog
102 format = getFormat(mold = [(0._TKG, 0._TKG)], ed = SK_"e")
103 call disp%skip()
104 call disp%show("mat")
105 call disp%show( mat , format = format )
106 call disp%show("call setResized(tmp, [ndim, ndim + 1])")
107 call setResized(tmp, [ndim, ndim + 1])
108 call disp%show("tmp(:,1:ndim) = getMatCopy(rdpack, mat, rdpack, lowDia, init = (0._TKG, 0._TKG)) ! reset the upper.")
109 tmp(:,1:ndim) = getMatCopy(rdpack, mat, rdpack, lowDia, init = (0._TKG, 0._TKG))
110 call disp%show("tmp(:,1:ndim)")
111 call disp%show( tmp(:,1:ndim) , format = format )
112 call disp%show("call setMatDetSqrtLog(tmp(:,1:ndim), lowDia, detSqrtLog, info, tmp(:,2:ndim+1), transHerm)")
113 call setMatDetSqrtLog(tmp(:,1:ndim), lowDia, detSqrtLog, info, tmp(:,2:ndim+1), transHerm)
114 call disp%show("if (info /= 0) error stop 'Cholesky factorization failed.'")
115 if (info /= 0) error stop 'Cholesky factorization failed.'
116 call disp%show("detSqrtLog")
117 call disp%show( detSqrtLog )
118 call disp%show("tmp")
119 call disp%show( tmp , format = format )
120 call disp%show("getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) ! for comparison.")
121 call disp%show( getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) )
122 call disp%show("detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) ! must be one")
123 call disp%show( detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) )
124 call disp%skip()
125 call disp%show("tmp(:,2:ndim+1) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, uppDia, init = (0._TKG, 0._TKG)) ! reset the upper.")
126 tmp(:,2:ndim+1) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, uppDia, init = (0._TKG, 0._TKG))
127 call disp%show("tmp(:,2:ndim+1)")
128 call disp%show( tmp(:,2:ndim+1) , format = format )
129 call disp%show("call setMatDetSqrtLog(tmp(:,2:ndim+1), uppDia, detSqrtLog, info, tmp(:,1:ndim), transHerm)")
130 call setMatDetSqrtLog(tmp(:,2:ndim+1), uppDia, detSqrtLog, info, tmp(:,1:ndim), transHerm)
131 call disp%show("if (info /= 0) error stop 'Cholesky factorization failed.'")
132 if (info /= 0) error stop 'Cholesky factorization failed.'
133 call disp%show("detSqrtLog")
134 call disp%show( detSqrtLog )
135 call disp%show("tmp")
136 call disp%show( tmp , format = format )
137 call disp%show("getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) ! for comparison.")
138 call disp%show( getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) )
139 call disp%show("detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) ! must be one.")
140 call disp%show( detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) )
141 call disp%skip()
142 end block
143
144 block
145 use pm_kind, only: TKG => CKS
146 integer(IK), parameter :: ndim = 3
147 complex(TKG), allocatable :: tmp(:,:)
148 complex(TKG), parameter :: mat(*,*) = reshape( [ (25.0, 0.0), (-5.0, -5.0), (10.0, 5.0) &
149 , (-5.0, 5.0), (51.0, 0.0), (4.0, -6.0) &
150 , (10.0, -5.0), (4.0, 6.0), (71.0, 0.0) &
151 ], shape = [ndim, ndim], order = [2, 1])
152 real(TKG) :: detSqrtLog
153 format = getFormat(mold = [(0._TKG, 0._TKG)], ed = SK_"e")
154 call disp%skip()
155 call disp%show("mat")
156 call disp%show( mat , format = format )
157 call disp%show("call setResized(tmp, [ndim, ndim + 1])")
158 call setResized(tmp, [ndim, ndim + 1])
159 call disp%show("tmp(:,1:ndim) = getMatCopy(rdpack, mat, rdpack, lowDia, init = (0._TKG, 0._TKG)) ! reset the upper.")
160 tmp(:,1:ndim) = getMatCopy(rdpack, mat, rdpack, lowDia, init = (0._TKG, 0._TKG))
161 call disp%show("tmp(:,1:ndim)")
162 call disp%show( tmp(:,1:ndim) , format = format )
163 call disp%show("call setMatDetSqrtLog(tmp(:,1:ndim), lowDia, detSqrtLog, info, tmp(:,2:ndim+1), transHerm)")
164 call setMatDetSqrtLog(tmp(:,1:ndim), lowDia, detSqrtLog, info, tmp(:,2:ndim+1), transHerm)
165 call disp%show("if (info /= 0) error stop 'Cholesky factorization failed.'")
166 if (info /= 0) error stop 'Cholesky factorization failed.'
167 call disp%show("detSqrtLog")
168 call disp%show( detSqrtLog )
169 call disp%show("tmp")
170 call disp%show( tmp , format = format )
171 call disp%show("getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) ! for comparison.")
172 call disp%show( getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) )
173 call disp%show("detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) ! must be one")
174 call disp%show( detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) )
175 call disp%skip()
176 call disp%show("tmp(:,2:ndim+1) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, uppDia, init = (0._TKG, 0._TKG)) ! reset the upper.")
177 tmp(:,2:ndim+1) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, uppDia, init = (0._TKG, 0._TKG))
178 call disp%show("tmp(:,2:ndim+1)")
179 call disp%show( tmp(:,2:ndim+1) , format = format )
180 call disp%show("call setMatDetSqrtLog(tmp(:,2:ndim+1), uppDia, detSqrtLog, info, tmp(:,1:ndim), transHerm)")
181 call setMatDetSqrtLog(tmp(:,2:ndim+1), uppDia, detSqrtLog, info, tmp(:,1:ndim), transHerm)
182 call disp%show("if (info /= 0) error stop 'Cholesky factorization failed.'")
183 if (info /= 0) error stop 'Cholesky factorization failed.'
184 call disp%show("detSqrtLog")
185 call disp%show( detSqrtLog )
186 call disp%show("tmp")
187 call disp%show( tmp , format = format )
188 call disp%show("getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) ! for comparison.")
189 call disp%show( getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) )
190 call disp%show("detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) ! must be one.")
191 call disp%show( detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) )
192 call disp%skip()
193 end block
194
195end program example
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
Generate and return a random positive-definite (correlation or covariance) matrix using the Gram meth...
Definition: pm_distCov.F90:394
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
Generate and return a generic or type/kind-specific IO format with the requested specifications that ...
Definition: pm_io.F90:18485
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
Generate and return the upper or the lower Cholesky factorization of the input symmetric positive-def...
Generate and return a copy of a desired subset of the input source matrix of arbitrary shape (:) or (...
Generate and return the natural logarithm of the square-root of the determinant of the input positive...
Generate and return the full inverse of an input matrix of general or triangular form directly or thr...
Generate and return the natural logarithm of the multiplicative trace of an input square matrix of ty...
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
This module contains classes and procedures for generating random matrices distributed on the space o...
Definition: pm_distCov.F90:72
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter CKS
The single-precision complex kind in Fortran mode. On most platforms, this is a 32-bit real kind.
Definition: pm_kind.F90:570
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
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Definition: pm_kind.F90:567
This module contains procedures and generic interfaces for computing the Cholesky factorization of po...
This module contains procedures and generic interfaces relevant to copying (diagonal or upper/lower t...
This module contains abstract and concrete derived types and procedures related to the inversion of s...
This module contains procedures and generic interfaces for computing the additive or multiplicative t...
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3! Compute the sqrt of the determinant of the positive definite matrix.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
7ndim = getUnifRand(1, 5)
8ndim
9+5
10call setResized(mat, [ndim, ndim + 1])
11mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
12mat(:,1:ndim)
13 0.100000E+01, 0.995642E+00, -0.377904E+00, -0.784962E+00, -0.179906E+00
14 0.995642E+00, 0.100000E+01, -0.453499E+00, -0.731240E+00, -0.202269E+00
15-0.377904E+00, -0.453499E+00, 0.100000E+01, -0.146252E+00, 0.829801E-01
16-0.784962E+00, -0.731240E+00, -0.146252E+00, 0.100000E+01, 0.167229E+00
17-0.179906E+00, -0.202269E+00, 0.829801E-01, 0.167229E+00, 0.100000E+01
18mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.
19mat(:,1:ndim)
20 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00
21 0.995642E+00, 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
22-0.377904E+00, -0.453499E+00, 0.100000E+01, 0.000000E+00, 0.000000E+00
23-0.784962E+00, -0.731240E+00, -0.146252E+00, 0.100000E+01, 0.000000E+00
24-0.179906E+00, -0.202269E+00, 0.829801E-01, 0.167229E+00, 0.100000E+01
25call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
26if (info /= 0) error stop 'Cholesky factorization failed.'
27detSqrtLog
28-4.89732218
29mat
30 0.100000E+01, 0.100000E+01, 0.995642E+00, -0.377904E+00, -0.784962E+00, -0.179906E+00
31 0.995642E+00, 0.100000E+01, 0.932582E-01, -0.828258E+00, 0.539377E+00, -0.248210E+00
32-0.377904E+00, -0.453499E+00, 0.100000E+01, 0.413736E+00, 0.930717E-02, -0.460654E+00
33-0.784962E+00, -0.731240E+00, -0.146252E+00, 0.100000E+01, 0.304664E+00, 0.538875E+00
34-0.179906E+00, -0.202269E+00, 0.829801E-01, 0.167229E+00, 0.100000E+01, 0.635167E+00
35getMatChol(mat(:,1:ndim), lowDia)
36 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00
37 0.995642E+00, 0.932582E-01, 0.000000E+00, 0.000000E+00, 0.000000E+00
38-0.377904E+00, -0.828258E+00, 0.413736E+00, 0.000000E+00, 0.000000E+00
39-0.784962E+00, 0.539377E+00, 0.930717E-02, 0.304664E+00, 0.000000E+00
40-0.179906E+00, -0.248210E+00, -0.460654E+00, 0.538875E+00, 0.635167E+00
41getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.
42-4.89732218
43detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.
44+0.00000000
45
46mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
47mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.
48mat(:,2:ndim+1)
49 0.100000E+01, -0.755382E+00, 0.626739E+00, -0.475707E+00, 0.489312E+00
50 0.000000E+00, 0.100000E+01, -0.966825E+00, 0.610062E+00, -0.267280E-01
51 0.000000E+00, 0.000000E+00, 0.100000E+01, -0.714983E+00, -0.247470E-01
52 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.100000E+01, -0.219799E+00
53 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.100000E+01
54call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
55if (info /= 0) error stop 'Cholesky factorization failed.'
56detSqrtLog
57-3.26840854
58mat
59 0.100000E+01, 0.100000E+01, -0.755382E+00, 0.626739E+00, -0.475707E+00, 0.489312E+00
60-0.755382E+00, 0.655285E+00, 0.100000E+01, -0.966825E+00, 0.610062E+00, -0.267280E-01
61 0.626739E+00, -0.752951E+00, 0.200656E+00, 0.100000E+01, -0.714983E+00, -0.247470E-01
62-0.475707E+00, 0.382616E+00, -0.641635E+00, 0.464341E+00, 0.100000E+01, -0.219799E+00
63 0.489312E+00, 0.523268E+00, 0.311862E+00, 0.276968E-01, 0.623489E+00, 0.100000E+01
64getMatChol(mat(:,2:ndim+1), uppDia)
65 0.100000E+01, -0.755382E+00, 0.626739E+00, -0.475707E+00, 0.489312E+00
66 0.000000E+00, 0.655285E+00, -0.752951E+00, 0.382616E+00, 0.523268E+00
67 0.000000E+00, 0.000000E+00, 0.200656E+00, -0.641635E+00, 0.311862E+00
68 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.464341E+00, 0.276968E-01
69 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.623489E+00
70getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.
71-3.26840854
72detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.
73+0.00000000
74
75
76ndim = getUnifRand(1, 5)
77ndim
78+4
79call setResized(mat, [ndim, ndim + 1])
80mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
81mat(:,1:ndim)
82 0.100000E+01, 0.706010E+00, -0.842166E+00, -0.214865E+00
83 0.706010E+00, 0.100000E+01, -0.882082E+00, -0.556622E+00
84-0.842166E+00, -0.882082E+00, 0.100000E+01, 0.660596E+00
85-0.214865E+00, -0.556622E+00, 0.660596E+00, 0.100000E+01
86mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.
87mat(:,1:ndim)
88 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
89 0.706010E+00, 0.100000E+01, 0.000000E+00, 0.000000E+00
90-0.842166E+00, -0.882082E+00, 0.100000E+01, 0.000000E+00
91-0.214865E+00, -0.556622E+00, 0.660596E+00, 0.100000E+01
92call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
93if (info /= 0) error stop 'Cholesky factorization failed.'
94detSqrtLog
95-2.36240363
96mat
97 0.100000E+01, 0.100000E+01, 0.706010E+00, -0.842166E+00, -0.214865E+00
98 0.706010E+00, 0.100000E+01, 0.708202E+00, -0.405964E+00, -0.571765E+00
99-0.842166E+00, -0.882082E+00, 0.100000E+01, 0.354894E+00, 0.697470E+00
100-0.214865E+00, -0.556622E+00, 0.660596E+00, 0.100000E+01, 0.374770E+00
101getMatChol(mat(:,1:ndim), lowDia)
102 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
103 0.706010E+00, 0.708202E+00, 0.000000E+00, 0.000000E+00
104-0.842166E+00, -0.405964E+00, 0.354894E+00, 0.000000E+00
105-0.214865E+00, -0.571765E+00, 0.697470E+00, 0.374770E+00
106getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.
107-2.36240363
108detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.
109+0.00000000
110
111mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
112mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.
113mat(:,2:ndim+1)
114 0.100000E+01, 0.545685E+00, 0.646260E+00, 0.785878E+00
115 0.000000E+00, 0.100000E+01, 0.875183E+00, 0.799715E+00
116 0.000000E+00, 0.000000E+00, 0.100000E+01, 0.740662E+00
117 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.100000E+01
118call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
119if (info /= 0) error stop 'Cholesky factorization failed.'
120detSqrtLog
121-1.86402464
122mat
123 0.100000E+01, 0.100000E+01, 0.545685E+00, 0.646260E+00, 0.785878E+00
124 0.545685E+00, 0.837991E+00, 0.100000E+01, 0.875183E+00, 0.799715E+00
125 0.646260E+00, 0.623549E+00, 0.439925E+00, 0.100000E+01, 0.740662E+00
126 0.785878E+00, 0.442575E+00, -0.981688E-01, 0.420578E+00, 0.100000E+01
127getMatChol(mat(:,2:ndim+1), uppDia)
128 0.100000E+01, 0.545685E+00, 0.646260E+00, 0.785878E+00
129 0.000000E+00, 0.837991E+00, 0.623549E+00, 0.442575E+00
130 0.000000E+00, 0.000000E+00, 0.439925E+00, -0.981688E-01
131 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.420578E+00
132getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.
133-1.86402464
134detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.
135+0.00000000
136
137
138ndim = getUnifRand(1, 5)
139ndim
140+4
141call setResized(mat, [ndim, ndim + 1])
142mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
143mat(:,1:ndim)
144 0.100000E+01, 0.222570E+00, 0.739877E+00, -0.421225E+00
145 0.222570E+00, 0.100000E+01, 0.533866E+00, -0.718549E+00
146 0.739877E+00, 0.533866E+00, 0.100000E+01, -0.637416E+00
147-0.421225E+00, -0.718549E+00, -0.637416E+00, 0.100000E+01
148mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.
149mat(:,1:ndim)
150 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
151 0.222570E+00, 0.100000E+01, 0.000000E+00, 0.000000E+00
152 0.739877E+00, 0.533866E+00, 0.100000E+01, 0.000000E+00
153-0.421225E+00, -0.718549E+00, -0.637416E+00, 0.100000E+01
154call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
155if (info /= 0) error stop 'Cholesky factorization failed.'
156detSqrtLog
157-1.08372831
158mat
159 0.100000E+01, 0.100000E+01, 0.222570E+00, 0.739877E+00, -0.421225E+00
160 0.222570E+00, 0.100000E+01, 0.974917E+00, 0.378690E+00, -0.640872E+00
161 0.739877E+00, 0.533866E+00, 0.100000E+01, 0.556036E+00, -0.149395E+00
162-0.421225E+00, -0.718549E+00, -0.637416E+00, 0.100000E+01, 0.624126E+00
163getMatChol(mat(:,1:ndim), lowDia)
164 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
165 0.222570E+00, 0.974917E+00, 0.000000E+00, 0.000000E+00
166 0.739877E+00, 0.378690E+00, 0.556036E+00, 0.000000E+00
167-0.421225E+00, -0.640872E+00, -0.149395E+00, 0.624126E+00
168getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.
169-1.08372831
170detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.
171+0.00000000
172
173mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
174mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.
175mat(:,2:ndim+1)
176 0.100000E+01, -0.595557E+00, -0.617345E+00, 0.590470E+00
177 0.000000E+00, 0.100000E+01, 0.883768E+00, -0.217398E+00
178 0.000000E+00, 0.000000E+00, 0.100000E+01, 0.130600E-01
179 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.100000E+01
180call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
181if (info /= 0) error stop 'Cholesky factorization failed.'
182detSqrtLog
183-1.66482186
184mat
185 0.100000E+01, 0.100000E+01, -0.595557E+00, -0.617345E+00, 0.590470E+00
186-0.595557E+00, 0.803313E+00, 0.100000E+01, 0.883768E+00, -0.217398E+00
187-0.617345E+00, 0.642469E+00, 0.454003E+00, 0.100000E+01, 0.130600E-01
188 0.590470E+00, 0.167133E+00, 0.595161E+00, 0.518840E+00, 0.100000E+01
189getMatChol(mat(:,2:ndim+1), uppDia)
190 0.100000E+01, -0.595557E+00, -0.617345E+00, 0.590470E+00
191 0.000000E+00, 0.803313E+00, 0.642469E+00, 0.167133E+00
192 0.000000E+00, 0.000000E+00, 0.454003E+00, 0.595161E+00
193 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.518840E+00
194getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.
195-1.66482186
196detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.
197+0.00000000
198
199
200ndim = getUnifRand(1, 5)
201ndim
202+5
203call setResized(mat, [ndim, ndim + 1])
204mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
205mat(:,1:ndim)
206 0.100000E+01, 0.721821E-01, -0.479664E+00, 0.386246E+00, 0.583107E+00
207 0.721821E-01, 0.100000E+01, 0.490977E+00, -0.837568E+00, 0.190570E-01
208-0.479664E+00, 0.490977E+00, 0.100000E+01, -0.766787E+00, 0.191725E+00
209 0.386246E+00, -0.837568E+00, -0.766787E+00, 0.100000E+01, 0.232046E+00
210 0.583107E+00, 0.190570E-01, 0.191725E+00, 0.232046E+00, 0.100000E+01
211mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.
212mat(:,1:ndim)
213 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00
214 0.721821E-01, 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
215-0.479664E+00, 0.490977E+00, 0.100000E+01, 0.000000E+00, 0.000000E+00
216 0.386246E+00, -0.837568E+00, -0.766787E+00, 0.100000E+01, 0.000000E+00
217 0.583107E+00, 0.190570E-01, 0.191725E+00, 0.232046E+00, 0.100000E+01
218call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
219if (info /= 0) error stop 'Cholesky factorization failed.'
220detSqrtLog
221-4.25426006
222mat
223 0.100000E+01, 0.100000E+01, 0.721821E-01, -0.479664E+00, 0.386246E+00, 0.583107E+00
224 0.721821E-01, 0.100000E+01, 0.997391E+00, 0.526975E+00, -0.867711E+00, -0.230931E-01
225-0.479664E+00, 0.490977E+00, 0.100000E+01, 0.701583E+00, -0.177108E+00, 0.689283E+00
226 0.386246E+00, -0.837568E+00, -0.766787E+00, 0.100000E+01, 0.257922E+00, 0.422076E+00
227 0.583107E+00, 0.190570E-01, 0.191725E+00, 0.232046E+00, 0.100000E+01, 0.786982E-01
228getMatChol(mat(:,1:ndim), lowDia)
229 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00
230 0.721821E-01, 0.997391E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00
231-0.479664E+00, 0.526975E+00, 0.701583E+00, 0.000000E+00, 0.000000E+00
232 0.386246E+00, -0.867711E+00, -0.177108E+00, 0.257922E+00, 0.000000E+00
233 0.583107E+00, -0.230931E-01, 0.689283E+00, 0.422076E+00, 0.786982E-01
234getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.
235-4.25426006
236detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.
237+0.00000000
238
239mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
240mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.
241mat(:,2:ndim+1)
242 0.100000E+01, 0.977478E+00, -0.670553E+00, -0.554501E+00, 0.470108E+00
243 0.000000E+00, 0.100000E+01, -0.724740E+00, -0.397872E+00, 0.574896E+00
244 0.000000E+00, 0.000000E+00, 0.100000E+01, -0.147532E+00, -0.757223E+00
245 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.100000E+01, 0.303878E+00
246 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.100000E+01
247call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
248if (info /= 0) error stop 'Cholesky factorization failed.'
249detSqrtLog
250-4.30601215
251mat
252 0.100000E+01, 0.100000E+01, 0.977478E+00, -0.670553E+00, -0.554501E+00, 0.470108E+00
253 0.977478E+00, 0.211039E+00, 0.100000E+01, -0.724740E+00, -0.397872E+00, 0.574896E+00
254-0.670553E+00, -0.328325E+00, 0.665253E+00, 0.100000E+01, -0.147532E+00, -0.757223E+00
255-0.554501E+00, 0.683007E+00, -0.443602E+00, 0.171020E+00, 0.100000E+01, 0.303878E+00
256 0.470108E+00, 0.546705E+00, -0.394577E+00, 0.942264E-01, 0.561731E+00, 0.100000E+01
257getMatChol(mat(:,2:ndim+1), uppDia)
258 0.100000E+01, 0.977478E+00, -0.670553E+00, -0.554501E+00, 0.470108E+00
259 0.000000E+00, 0.211039E+00, -0.328325E+00, 0.683007E+00, 0.546705E+00
260 0.000000E+00, 0.000000E+00, 0.665253E+00, -0.443602E+00, -0.394577E+00
261 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.171020E+00, 0.942264E-01
262 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.561731E+00
263getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.
264-4.30601215
265detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.
266+0.00000000
267
268
269ndim = getUnifRand(1, 5)
270ndim
271+1
272call setResized(mat, [ndim, ndim + 1])
273mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
274mat(:,1:ndim)
275 0.100000E+01
276mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.
277mat(:,1:ndim)
278 0.100000E+01
279call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
280if (info /= 0) error stop 'Cholesky factorization failed.'
281detSqrtLog
282+0.00000000
283mat
284 0.100000E+01, 0.100000E+01
285getMatChol(mat(:,1:ndim), lowDia)
286 0.100000E+01
287getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.
288+0.00000000
289detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.
290+0.00000000
291
292mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
293mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.
294mat(:,2:ndim+1)
295 0.100000E+01
296call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
297if (info /= 0) error stop 'Cholesky factorization failed.'
298detSqrtLog
299+0.00000000
300mat
301 0.100000E+01, 0.100000E+01
302getMatChol(mat(:,2:ndim+1), uppDia)
303 0.100000E+01
304getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.
305+0.00000000
306detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.
307+0.00000000
308
309
310ndim = getUnifRand(1, 5)
311ndim
312+1
313call setResized(mat, [ndim, ndim + 1])
314mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
315mat(:,1:ndim)
316 0.100000E+01
317mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.
318mat(:,1:ndim)
319 0.100000E+01
320call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
321if (info /= 0) error stop 'Cholesky factorization failed.'
322detSqrtLog
323+0.00000000
324mat
325 0.100000E+01, 0.100000E+01
326getMatChol(mat(:,1:ndim), lowDia)
327 0.100000E+01
328getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.
329+0.00000000
330detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.
331+0.00000000
332
333mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
334mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.
335mat(:,2:ndim+1)
336 0.100000E+01
337call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
338if (info /= 0) error stop 'Cholesky factorization failed.'
339detSqrtLog
340+0.00000000
341mat
342 0.100000E+01, 0.100000E+01
343getMatChol(mat(:,2:ndim+1), uppDia)
344 0.100000E+01
345getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.
346+0.00000000
347detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.
348+0.00000000
349
350
351ndim = getUnifRand(1, 5)
352ndim
353+5
354call setResized(mat, [ndim, ndim + 1])
355mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
356mat(:,1:ndim)
357 0.100000E+01, 0.291439E+00, -0.331468E+00, -0.517875E+00, -0.335677E+00
358 0.291439E+00, 0.100000E+01, -0.799691E+00, 0.147208E+00, 0.302285E+00
359-0.331468E+00, -0.799691E+00, 0.100000E+01, 0.287685E+00, -0.387441E+00
360-0.517875E+00, 0.147208E+00, 0.287685E+00, 0.100000E+01, 0.223297E+00
361-0.335677E+00, 0.302285E+00, -0.387441E+00, 0.223297E+00, 0.100000E+01
362mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.
363mat(:,1:ndim)
364 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00
365 0.291439E+00, 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
366-0.331468E+00, -0.799691E+00, 0.100000E+01, 0.000000E+00, 0.000000E+00
367-0.517875E+00, 0.147208E+00, 0.287685E+00, 0.100000E+01, 0.000000E+00
368-0.335677E+00, 0.302285E+00, -0.387441E+00, 0.223297E+00, 0.100000E+01
369call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
370if (info /= 0) error stop 'Cholesky factorization failed.'
371detSqrtLog
372-1.46346796
373mat
374 0.100000E+01, 0.100000E+01, 0.291439E+00, -0.331468E+00, -0.517875E+00, -0.335677E+00
375 0.291439E+00, 0.100000E+01, 0.956589E+00, -0.734995E+00, 0.311667E+00, 0.418272E+00
376-0.331468E+00, -0.799691E+00, 0.100000E+01, 0.591533E+00, 0.583398E+00, -0.323362E+00
377-0.517875E+00, 0.147208E+00, 0.287685E+00, 0.100000E+01, 0.542509E+00, 0.198607E+00
378-0.335677E+00, 0.302285E+00, -0.387441E+00, 0.223297E+00, 0.100000E+01, 0.753898E+00
379getMatChol(mat(:,1:ndim), lowDia)
380 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00
381 0.291439E+00, 0.956589E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00
382-0.331468E+00, -0.734995E+00, 0.591533E+00, 0.000000E+00, 0.000000E+00
383-0.517875E+00, 0.311667E+00, 0.583398E+00, 0.542509E+00, 0.000000E+00
384-0.335677E+00, 0.418272E+00, -0.323362E+00, 0.198607E+00, 0.753898E+00
385getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.
386-1.46346796
387detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.
388+0.00000000
389
390mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
391mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.
392mat(:,2:ndim+1)
393 0.100000E+01, 0.796040E+00, 0.542479E+00, -0.501106E+00, 0.572308E+00
394 0.000000E+00, 0.100000E+01, 0.651499E+00, 0.124686E-01, 0.428734E+00
395 0.000000E+00, 0.000000E+00, 0.100000E+01, 0.176864E-01, 0.674197E+00
396 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.100000E+01, -0.261657E+00
397 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.100000E+01
398call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
399if (info /= 0) error stop 'Cholesky factorization failed.'
400detSqrtLog
401-1.84736598
402mat
403 0.100000E+01, 0.100000E+01, 0.796040E+00, 0.542479E+00, -0.501106E+00, 0.572308E+00
404 0.796040E+00, 0.605244E+00, 0.100000E+01, 0.651499E+00, 0.124686E-01, 0.428734E+00
405 0.542479E+00, 0.362936E+00, 0.757624E+00, 0.100000E+01, 0.176864E-01, 0.674197E+00
406-0.501106E+00, 0.679675E+00, 0.565546E-01, 0.532669E+00, 0.100000E+01, -0.261657E+00
407 0.572308E+00, -0.443554E-01, 0.501344E+00, 0.505456E-01, 0.645443E+00, 0.100000E+01
408getMatChol(mat(:,2:ndim+1), uppDia)
409 0.100000E+01, 0.796040E+00, 0.542479E+00, -0.501106E+00, 0.572308E+00
410 0.000000E+00, 0.605244E+00, 0.362936E+00, 0.679675E+00, -0.443554E-01
411 0.000000E+00, 0.000000E+00, 0.757624E+00, 0.565546E-01, 0.501344E+00
412 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.532669E+00, 0.505456E-01
413 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.645443E+00
414getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.
415-1.84736598
416detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.
417+0.00000000
418
419
420ndim = getUnifRand(1, 5)
421ndim
422+4
423call setResized(mat, [ndim, ndim + 1])
424mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
425mat(:,1:ndim)
426 0.100000E+01, -0.963369E+00, -0.432498E+00, 0.174925E+00
427-0.963369E+00, 0.100000E+01, 0.498103E+00, -0.375517E+00
428-0.432498E+00, 0.498103E+00, 0.100000E+01, -0.703340E-01
429 0.174925E+00, -0.375517E+00, -0.703340E-01, 0.100000E+01
430mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.
431mat(:,1:ndim)
432 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
433-0.963369E+00, 0.100000E+01, 0.000000E+00, 0.000000E+00
434-0.432498E+00, 0.498103E+00, 0.100000E+01, 0.000000E+00
435 0.174925E+00, -0.375517E+00, -0.703340E-01, 0.100000E+01
436call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
437if (info /= 0) error stop 'Cholesky factorization failed.'
438detSqrtLog
439-2.09216738
440mat
441 0.100000E+01, 0.100000E+01, -0.963369E+00, -0.432498E+00, 0.174925E+00
442-0.963369E+00, 0.100000E+01, 0.268179E+00, 0.303707E+00, -0.771868E+00
443-0.432498E+00, 0.498103E+00, 0.100000E+01, 0.848945E+00, 0.282400E+00
444 0.174925E+00, -0.375517E+00, -0.703340E-01, 0.100000E+01, 0.542099E+00
445getMatChol(mat(:,1:ndim), lowDia)
446 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
447-0.963369E+00, 0.268179E+00, 0.000000E+00, 0.000000E+00
448-0.432498E+00, 0.303707E+00, 0.848945E+00, 0.000000E+00
449 0.174925E+00, -0.771868E+00, 0.282400E+00, 0.542099E+00
450getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.
451-2.09216738
452detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.
453+0.00000000
454
455mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
456mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.
457mat(:,2:ndim+1)
458 0.100000E+01, -0.879763E+00, -0.703124E+00, 0.572924E+00
459 0.000000E+00, 0.100000E+01, 0.600587E+00, -0.235055E+00
460 0.000000E+00, 0.000000E+00, 0.100000E+01, -0.718772E-01
461 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.100000E+01
462call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
463if (info /= 0) error stop 'Cholesky factorization failed.'
464detSqrtLog
465-2.21113348
466mat
467 0.100000E+01, 0.100000E+01, -0.879763E+00, -0.703124E+00, 0.572924E+00
468-0.879763E+00, 0.475413E+00, 0.100000E+01, 0.600587E+00, -0.235055E+00
469-0.703124E+00, -0.378518E-01, 0.710059E+00, 0.100000E+01, -0.718772E-01
470 0.572924E+00, 0.565787E+00, 0.496262E+00, 0.324602E+00, 0.100000E+01
471getMatChol(mat(:,2:ndim+1), uppDia)
472 0.100000E+01, -0.879763E+00, -0.703124E+00, 0.572924E+00
473 0.000000E+00, 0.475413E+00, -0.378518E-01, 0.565787E+00
474 0.000000E+00, 0.000000E+00, 0.710059E+00, 0.496262E+00
475 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.324602E+00
476getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.
477-2.21113348
478detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.
479+0.00000000
480
481
482ndim = getUnifRand(1, 5)
483ndim
484+4
485call setResized(mat, [ndim, ndim + 1])
486mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
487mat(:,1:ndim)
488 0.100000E+01, -0.337271E+00, 0.538332E+00, 0.438603E+00
489-0.337271E+00, 0.100000E+01, -0.530481E+00, 0.266433E+00
490 0.538332E+00, -0.530481E+00, 0.100000E+01, 0.636580E+00
491 0.438603E+00, 0.266433E+00, 0.636580E+00, 0.100000E+01
492mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.
493mat(:,1:ndim)
494 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
495-0.337271E+00, 0.100000E+01, 0.000000E+00, 0.000000E+00
496 0.538332E+00, -0.530481E+00, 0.100000E+01, 0.000000E+00
497 0.438603E+00, 0.266433E+00, 0.636580E+00, 0.100000E+01
498call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
499if (info /= 0) error stop 'Cholesky factorization failed.'
500detSqrtLog
501-1.75091004
502mat
503 0.100000E+01, 0.100000E+01, -0.337271E+00, 0.538332E+00, 0.438603E+00
504-0.337271E+00, 0.100000E+01, 0.941408E+00, -0.370634E+00, 0.440151E+00
505 0.538332E+00, -0.530481E+00, 0.100000E+01, 0.756855E+00, 0.744661E+00
506 0.438603E+00, 0.266433E+00, 0.636580E+00, 0.100000E+01, 0.243668E+00
507getMatChol(mat(:,1:ndim), lowDia)
508 0.100000E+01, 0.000000E+00, 0.000000E+00, 0.000000E+00
509-0.337271E+00, 0.941408E+00, 0.000000E+00, 0.000000E+00
510 0.538332E+00, -0.370634E+00, 0.756855E+00, 0.000000E+00
511 0.438603E+00, 0.440151E+00, 0.744661E+00, 0.243668E+00
512getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.
513-1.75091004
514detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.
515+0.00000000
516
517mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
518mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.
519mat(:,2:ndim+1)
520 0.100000E+01, 0.748963E+00, 0.746581E+00, -0.669688E-01
521 0.000000E+00, 0.100000E+01, 0.304949E+00, 0.418672E+00
522 0.000000E+00, 0.000000E+00, 0.100000E+01, 0.350409E-01
523 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.100000E+01
524call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
525if (info /= 0) error stop 'Cholesky factorization failed.'
526detSqrtLog
527-2.39006829
528mat
529 0.100000E+01, 0.100000E+01, 0.748963E+00, 0.746581E+00, -0.669688E-01
530 0.748963E+00, 0.662612E+00, 0.100000E+01, 0.304949E+00, 0.418672E+00
531 0.746581E+00, -0.383652E+00, 0.543533E+00, 0.100000E+01, 0.350409E-01
532-0.669688E-01, 0.707546E+00, 0.655876E+00, 0.254402E+00, 0.100000E+01
533getMatChol(mat(:,2:ndim+1), uppDia)
534 0.100000E+01, 0.748963E+00, 0.746581E+00, -0.669688E-01
535 0.000000E+00, 0.662612E+00, -0.383652E+00, 0.707546E+00
536 0.000000E+00, 0.000000E+00, 0.543533E+00, 0.655876E+00
537 0.000000E+00, 0.000000E+00, 0.000000E+00, 0.254402E+00
538getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.
539-2.39006829
540detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.
541+0.00000000
542
543
544ndim = getUnifRand(1, 5)
545ndim
546+2
547call setResized(mat, [ndim, ndim + 1])
548mat(:,1:ndim) = getCovRand(mold = 1._TKG, ndim = ndim)
549mat(:,1:ndim)
550 0.100000E+01, 0.686208E+00
551 0.686208E+00, 0.100000E+01
552mat(:,1:ndim) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, lowDia, init = 0._TKG) ! reset the upper.
553mat(:,1:ndim)
554 0.100000E+01, 0.000000E+00
555 0.686208E+00, 0.100000E+01
556call setMatDetSqrtLog(mat(:,1:ndim), lowDia, detSqrtLog, info, mat(:,2:ndim+1), transHerm)
557if (info /= 0) error stop 'Cholesky factorization failed.'
558detSqrtLog
559-0.318271697
560mat
561 0.100000E+01, 0.100000E+01, 0.686208E+00
562 0.686208E+00, 0.100000E+01, 0.727405E+00
563getMatChol(mat(:,1:ndim), lowDia)
564 0.100000E+01, 0.000000E+00
565 0.686208E+00, 0.727405E+00
566getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! for comparison.
567-0.318271697
568detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,1:ndim), lowDia)) ! must be one.
569+0.00000000
570
571mat(:,2:ndim+1) = getCovRand(mold = 1._TKG, ndim = ndim)
572mat(:,2:ndim+1) = getMatCopy(rdpack, mat(:,2:ndim+1), rdpack, uppDia, init = 0._TKG) ! reset the lower.
573mat(:,2:ndim+1)
574 0.100000E+01, -0.999312E+00
575 0.000000E+00, 0.100000E+01
576call setMatDetSqrtLog(mat(:,2:ndim+1), uppDia, detSqrtLog, info, mat(:,1:ndim), transHerm)
577if (info /= 0) error stop 'Cholesky factorization failed.'
578detSqrtLog
579-3.29479527
580mat
581 0.100000E+01, 0.100000E+01, -0.999312E+00
582-0.999312E+00, 0.370756E-01, 0.100000E+01
583getMatChol(mat(:,2:ndim+1), uppDia)
584 0.100000E+01, -0.999312E+00
585 0.000000E+00, 0.370756E-01
586getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! for comparison.
587-3.29479527
588detSqrtLog - getMatMulTraceLog(getMatChol(mat(:,2:ndim+1), uppDia)) ! must be one.
589+0.00000000
590
591
592mat
593( 0.900000E+01, 0.000000E+00), ( 0.300000E+01, 0.300000E+01), ( 0.300000E+01, -0.300000E+01)
594( 0.300000E+01, -0.300000E+01), ( 0.180000E+02, 0.000000E+00), ( 0.800000E+01, -0.600000E+01)
595( 0.300000E+01, 0.300000E+01), ( 0.800000E+01, 0.600000E+01), ( 0.430000E+02, 0.000000E+00)
596call setResized(tmp, [ndim, ndim + 1])
597tmp(:,1:ndim) = getMatCopy(rdpack, mat, rdpack, lowDia, init = (0._TKG, 0._TKG)) ! reset the upper.
598tmp(:,1:ndim)
599( 0.900000E+01, 0.000000E+00), ( 0.000000E+00, 0.000000E+00), ( 0.000000E+00, 0.000000E+00)
600( 0.300000E+01, -0.300000E+01), ( 0.180000E+02, 0.000000E+00), ( 0.000000E+00, 0.000000E+00)
601( 0.300000E+01, 0.300000E+01), ( 0.800000E+01, 0.600000E+01), ( 0.430000E+02, 0.000000E+00)
602call setMatDetSqrtLog(tmp(:,1:ndim), lowDia, detSqrtLog, info, tmp(:,2:ndim+1), transHerm)
603if (info /= 0) error stop 'Cholesky factorization failed.'
604detSqrtLog
605+4.27666616
606tmp
607( 0.900000E+01, 0.000000E+00), ( 0.300000E+01, 0.000000E+00), ( 0.100000E+01, 0.100000E+01), ( 0.100000E+01, -0.100000E+01)
608( 0.300000E+01, -0.300000E+01), ( 0.180000E+02, 0.000000E+00), ( 0.400000E+01, 0.000000E+00), ( 0.200000E+01, -0.100000E+01)
609( 0.300000E+01, 0.300000E+01), ( 0.800000E+01, 0.600000E+01), ( 0.430000E+02, 0.000000E+00), ( 0.600000E+01, 0.000000E+00)
610getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) ! for comparison.
611(+4.27666616, +0.00000000)
612detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) ! must be one
613(+0.00000000, +0.00000000)
614
615tmp(:,2:ndim+1) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, uppDia, init = (0._TKG, 0._TKG)) ! reset the upper.
616tmp(:,2:ndim+1)
617( 0.900000E+01, 0.000000E+00), ( 0.300000E+01, 0.300000E+01), ( 0.300000E+01, -0.300000E+01)
618( 0.000000E+00, 0.000000E+00), ( 0.180000E+02, 0.000000E+00), ( 0.800000E+01, -0.600000E+01)
619( 0.000000E+00, 0.000000E+00), ( 0.000000E+00, 0.000000E+00), ( 0.430000E+02, 0.000000E+00)
620call setMatDetSqrtLog(tmp(:,2:ndim+1), uppDia, detSqrtLog, info, tmp(:,1:ndim), transHerm)
621if (info /= 0) error stop 'Cholesky factorization failed.'
622detSqrtLog
623+4.27666616
624tmp
625( 0.300000E+01, 0.000000E+00), ( 0.900000E+01, 0.000000E+00), ( 0.300000E+01, 0.300000E+01), ( 0.300000E+01, -0.300000E+01)
626( 0.100000E+01, -0.100000E+01), ( 0.400000E+01, 0.000000E+00), ( 0.180000E+02, 0.000000E+00), ( 0.800000E+01, -0.600000E+01)
627( 0.100000E+01, 0.100000E+01), ( 0.200000E+01, 0.100000E+01), ( 0.600000E+01, 0.000000E+00), ( 0.430000E+02, 0.000000E+00)
628getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) ! for comparison.
629(+4.27666616, +0.00000000)
630detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) ! must be one.
631(+0.00000000, +0.00000000)
632
633
634mat
635( 0.250000E+02, 0.000000E+00), (-0.500000E+01, -0.500000E+01), ( 0.100000E+02, 0.500000E+01)
636(-0.500000E+01, 0.500000E+01), ( 0.510000E+02, 0.000000E+00), ( 0.400000E+01, -0.600000E+01)
637( 0.100000E+02, -0.500000E+01), ( 0.400000E+01, 0.600000E+01), ( 0.710000E+02, 0.000000E+00)
638call setResized(tmp, [ndim, ndim + 1])
639tmp(:,1:ndim) = getMatCopy(rdpack, mat, rdpack, lowDia, init = (0._TKG, 0._TKG)) ! reset the upper.
640tmp(:,1:ndim)
641( 0.250000E+02, 0.000000E+00), ( 0.000000E+00, 0.000000E+00), ( 0.000000E+00, 0.000000E+00)
642(-0.500000E+01, 0.500000E+01), ( 0.510000E+02, 0.000000E+00), ( 0.000000E+00, 0.000000E+00)
643( 0.100000E+02, -0.500000E+01), ( 0.400000E+01, 0.600000E+01), ( 0.710000E+02, 0.000000E+00)
644call setMatDetSqrtLog(tmp(:,1:ndim), lowDia, detSqrtLog, info, tmp(:,2:ndim+1), transHerm)
645if (info /= 0) error stop 'Cholesky factorization failed.'
646detSqrtLog
647+5.63478947
648tmp
649( 0.250000E+02, 0.000000E+00), ( 0.500000E+01, 0.000000E+00), (-0.100000E+01, -0.100000E+01), ( 0.200000E+01, 0.100000E+01)
650(-0.500000E+01, 0.500000E+01), ( 0.510000E+02, 0.000000E+00), ( 0.700000E+01, 0.000000E+00), ( 0.100000E+01, -0.100000E+01)
651( 0.100000E+02, -0.500000E+01), ( 0.400000E+01, 0.600000E+01), ( 0.710000E+02, 0.000000E+00), ( 0.800000E+01, 0.000000E+00)
652getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) ! for comparison.
653(+5.63478947, +0.00000000)
654detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,1:ndim), lowDia)) ! must be one
655(+0.00000000, +0.00000000)
656
657tmp(:,2:ndim+1) = getMatCopy(rdpack, mat(:,1:ndim), rdpack, uppDia, init = (0._TKG, 0._TKG)) ! reset the upper.
658tmp(:,2:ndim+1)
659( 0.250000E+02, 0.000000E+00), (-0.500000E+01, -0.500000E+01), ( 0.100000E+02, 0.500000E+01)
660( 0.000000E+00, 0.000000E+00), ( 0.510000E+02, 0.000000E+00), ( 0.400000E+01, -0.600000E+01)
661( 0.000000E+00, 0.000000E+00), ( 0.000000E+00, 0.000000E+00), ( 0.710000E+02, 0.000000E+00)
662call setMatDetSqrtLog(tmp(:,2:ndim+1), uppDia, detSqrtLog, info, tmp(:,1:ndim), transHerm)
663if (info /= 0) error stop 'Cholesky factorization failed.'
664detSqrtLog
665+5.63478947
666tmp
667( 0.500000E+01, 0.000000E+00), ( 0.250000E+02, 0.000000E+00), (-0.500000E+01, -0.500000E+01), ( 0.100000E+02, 0.500000E+01)
668(-0.100000E+01, 0.100000E+01), ( 0.700000E+01, 0.000000E+00), ( 0.510000E+02, 0.000000E+00), ( 0.400000E+01, -0.600000E+01)
669( 0.200000E+01, -0.100000E+01), ( 0.100000E+01, 0.100000E+01), ( 0.800000E+01, 0.000000E+00), ( 0.710000E+02, 0.000000E+00)
670getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) ! for comparison.
671(+5.63478947, +0.00000000)
672detSqrtLog - getMatMulTraceLog(getMatChol(tmp(:,2:ndim+1), uppDia)) ! must be one.
673(+0.00000000, +0.00000000)
674
675
Test:
test_pm_matrixDet


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, Apr 21, 2017, 1:43 PM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 822 of file pm_matrixDet.F90.


The documentation for this interface was generated from the following file: