Commit 30de0c15 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

simplify write statements

parent 6bfe92fe
......@@ -76,7 +76,6 @@ C LOCALS
#ifdef __GFORTRAN__
CHARACTER*16 fmt
INTEGER IDX, IDX1
#endif
#ifdef __INTEL_COMPILER
......@@ -274,9 +273,7 @@ C WRITE HYPERPARAMTERS for THETA and PSI plus DATA
WRITE(10,'(A2)') estimation
DO I =1,nt
#ifdef __GFORTRAN__
DO IDX=1,4
WRITE(10,'(F25.12)',advance='no') thetaprior(I,IDX)
END DO
WRITE(10, '(4F25.12)', advance='no') thetaprior(I,1:4)
WRITE(10,'(A,A)') ' ', pdftheta(I)
#else
WRITE(10,1111) thetaprior(I,1:4),pdftheta(I)
......@@ -287,10 +284,9 @@ C WRITE HYPERPARAMTERS for THETA and PSI plus DATA
IF (INFOS(9,I).EQ.1) THEN
#ifdef __GFORTRAN__
WRITE(10,'(I10)',advance='no') INFOS(8,I)
DO IDX=1,np(3)
WRITE(10,'(F25.12)',advance='no') psiprior(K+1,IDX)
END DO
WRITE(10, '(A, I1)') ' ', INFOS(9,I)
WRITE(fmt, '(a,i4,a)') '(', np(3), 'F25.12)'
WRITE(10, fmt,advance='no') psiprior(K+1,:)
WRITE(10, '(A, I2)') ' ', INFOS(9,I)
#else
WRITE(10,1112) INFOS(8,I),psiprior(K+1,:),INFOS(9,I)
#endif
......@@ -299,10 +295,9 @@ C WRITE HYPERPARAMTERS for THETA and PSI plus DATA
DO J = 1,INFOS(8,I)
#ifdef __GFORTRAN__
WRITE(10,'(I10)',advance='no') INFOS(8,I)
DO IDX=1,np(3)
WRITE(10,'(F25.12)',advance='no') psiprior(K+1,IDX)
END DO
WRITE(10, '(A, I1)') ' ', INFOS(9,I)
WRITE(fmt, '(a,i4,a)') '(', np(3), 'F25.12)'
WRITE(10, fmt,advance='no') psiprior(K+1,:)
WRITE(10, '(A, I2)') ' ', INFOS(9,I)
#else
WRITE(10,1112) INFOS(8,I),psiprior(K+1,:),INFOS(9,I)
#endif
......@@ -312,9 +307,8 @@ C WRITE HYPERPARAMTERS for THETA and PSI plus DATA
END DO
DO I =1,nobs+nf
#ifdef __GFORTRAN__
DO IDX=1,ny+nz
WRITE(10,'(F20.10)') yk(I,IDX)
END DO
WRITE(fmt, '(a,i4,a)') '(', ny+nz, 'F20.10)'
WRITE(10, fmt) yk(I,1:ny+nz)
#else
WRITE(10,'(<ny+nz>(F20.10))') yk(I,1:ny+nz)
#endif
......@@ -725,9 +719,8 @@ C MCMC RECORDING phase
#endif
IF (nv.EQ.0) THEN
#ifdef __GFORTRAN__
DO IDX=1,nt
WRITE(9, '(F25.15)', advance='no') theta(IDX)
END DO
WRITE(fmt, '(a,i4,a)') '(', nt, 'F25.15)'
WRITE(9,fmt) theta(1:nt)
#else
WRITE(9,'(<nt>(F25.15))') theta(1:nt)
#endif
......@@ -737,17 +730,10 @@ C MCMC RECORDING phase
gibZ(jjj/thin,1:nobs) = Z(1:nobs)
ENDIF
#ifdef __GFORTRAN__
DO IDX=1,nt
WRITE(9, '(F25.15)', advance='no') theta(IDX)
END DO
DO IDX=1,np(1)
WRITE(9, '(F25.15)', advance='no') psi(IDX)
END DO
WRITE(9,*)
DO IDX=1,nobs
WRITE(11, '(I3)', advance='no') Z(IDX)
END DO
WRITE(11,*)
WRITE(fmt, '(a,i4,a)') '(', nt+np(1), 'F25.15)'
WRITE(9,fmt) theta(1:nt),psi(1:np(1))
WRITE(fmt, '(a,i4,a)') '(', nobs, 'I3)'
WRITE(11,fmt) Z(:)
#else
WRITE(9,'(<nt+np(1)>(F25.15))') theta(1:nt),psi(1:np(1))
WRITE(11,'(<nobs>(I3))') Z(:)
......@@ -756,12 +742,8 @@ C MCMC RECORDING phase
IF (nf.GT.0) THEN
J = min(nv,1)
#ifdef __GFORTRAN__
DO IDX1=1,(nx+ny+J)
DO IDX=1,nf
WRITE(13,'(F20.10)', advance='no') FORE(IDX,IDX1)
END DO
WRITE(13,*) ''
END DO
WRITE(fmt, '(a,i4,a)') '(', nf*(nx+ny+J), 'F20.10)'
WRITE(13,fmt) (FORE(1:nf,I),I=1,nx+ny+J)
#else
WRITE(13,'(<nf*(nx+ny+J)>(F20.10))') (FORE(1:nf,I),I=1,nx+ny+J)
#endif
......@@ -810,19 +792,9 @@ C MARGINAL LIKELIHOOD
ENDIF
WRITE(15,*) 'Modified Harmonic mean (ML and Var)'
#ifdef __GFORTRAN__
DO IDX1=1,2
DO IDX=1,11
WRITE(15,'(F20.10)', advance='no') MLHM(IDX,IDX1)
END DO
WRITE(15,*) ''
END DO
WRITE(15,'(2F20.10)') (MLHM(I,:),I=1,11)
WRITE(15,*) 'Bridge Sampling'
DO IDX1=1,2
DO IDX=1,11
WRITE(15,'(F20.10)', advance='no') MLMW(IDX,IDX1)
END DO
WRITE(15,*) ''
END DO
WRITE(15,'(2F20.10)') (MLMW(I,:),I=1,2)
#else
WRITE(15,'(<2>(F20.10))') (MLHM(I,:),I=1,11)
WRITE(15,*) 'Bridge Sampling'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment