41 real(dp),
allocatable :: G1(:,:),G2(:,:),G3(:,:),&
42 Cm1(:,:),Cm2(:,:),Cm3(:,:),&
43 Cd1(:,:),Cd2(:,:),Cd3(:,:),&
44 mprior(:),dobs(:),mtrue(:)
45 real(dp),
allocatable :: U1(:,:),U2(:,:),U3(:,:),&
46 iUCm1(:,:),iUCm2(:,:),iUCm3(:,:),&
47 iUCmGtiCd1(:,:),iUCmGtiCd2(:,:),iUCmGtiCd3(:,:),&
49 character(len=1024) :: inpfile,outfile
50 integer :: nm,nd,nm1,nm2,nm3,nd1,nd2,nd3
51 real(dp),
allocatable :: postm(:),postmFAST(:),postcov(:,:)
52 real(dp),
allocatable :: bandpostC(:,:)
53 integer :: i1,i2,j1,j2, lowdiag, updiag
54 real(dp) :: start,finish
57 character(len=256) :: simname
67 call get_command_argument(iar, simname)
69 inpfile = trim(simname)//
'.h5' 70 outfile = trim(simname)//
'_output.h5' 72 print*,
"inpfile:",trim(inpfile)
73 print*,
"outfile:",trim(outfile)
78 print*,
'reading input arrays' 123 print*,
"M:",nm1,nm2,nm3,nm
124 print*,
"D:",nd1,nd2,nd3,nd
128 print*,
'Allocating working arrays' 129 allocate(u1(nm1,nm1),u2(nm2,nm2),u3(nm3,nm3))
130 allocate(invlambda(nm))
131 allocate(iucm1(nm1,nm1),iucm2(nm2,nm2),iucm3(nm3,nm3))
132 allocate(iucmgticd1(nm1,nd1),iucmgticd2(nm2,nd2),iucmgticd3(nm3,nd3))
136 print*,
'Computing the factors for post mean and covariance' 137 call calcfactors(g1,g2,g3,cm1,cm2,cm3,cd1,cd2,cd3,&
138 u1,u2,u3,invlambda,iucm1,iucm2,iucm3,&
139 iucmgticd1,iucmgticd2,iucmgticd3 )
140 print*,
'END computing the factors for post mean and covariance' 167 print*,
'Computing post mean' 170 call posteriormean(u1,u2,u3, invlambda, iucmgticd1,iucmgticd2,iucmgticd3,&
171 g1,g2,g3,mprior,dobs, postm )
174 call cpu_time(finish)
175 print*,
'postm time:',finish-start
187 allocate(postcov(nm,nm))
195 print*,
'Computing block postcov' 198 call blockpostcov(u1,u2,u3, invlambda,iucm1,iucm2,iucm3, &
199 i1,i2,j1,j2, postcov(i1:i2,j1:j2))
202 call cpu_time(finish)
203 print*,
'postcov block time:',finish-start
219 allocate(bandpostc(lowdiag+updiag+1,nm))
220 call bandpostcov(u1,u2,u3, invlambda,iucm1,iucm2,iucm3, &
221 lowdiag, updiag, bandpostc)
subroutine writereal1darrh5(outfile, dsetname, arr)
Module to read and write HDF5 files.
integer, parameter, public masterrank
subroutine para_barrier()
integer, public, protected myrank
subroutine readreal2darrh5(inpfile, dsetname, arr)
subroutine, public blockpostcov(U1, U2, U3, diaginvlambda, iUCm1, iUCm2, iUCm3, astart, aend, bstart, bend, postC)
Computes a block of the posterior covariance.
subroutine, public calcfactors(G1, G2, G3, Cm1, Cm2, Cm3, Cd1, Cd2, Cd3, U1, U2, U3, diaginvlambda, iUCm1, iUCm2, iUCm3, iUCmGtiCd1, iUCmGtiCd2, iUCmGtiCd3)
Computes the factors necessary to solve the inverse problem.
program test
Test program for KronLinInv.
subroutine writereal2darrh5(outfile, dsetname, arr)
This file contains the parallel OpenMPI (distributed memory) version of KronLinInv. OpenMPI and LAPACK libraries are required to be installed in the system.
subroutine, public bandpostcov(U1, U2, U3, diaginvlambda, iUCm1, iUCm2, iUCm3, lowdiag, updiag, bandpostC)
Computes a band of the posterior covariance. See http://www.netlib.org/lapack/lug/node124.html
Procedures to perform linear inversion under gaussian assumptions using the Kronecker-product approac...
subroutine readreal1darrh5(inpfile, dsetname, arr)
Subroutines/utilities for the parallel version of KronLinInv using OpenMPI.
subroutine, public posteriormean(U1, U2, U3, diaginvlambda, Z1, Z2, Z3, G1, G2, G3, mprior, dobs, postm)
Computes the posterior mean