From 71f671843a5143b6d3c8860c64e57643761baa03 Mon Sep 17 00:00:00 2001 From: "Lin.Gan" Date: Tue, 2 Mar 2021 20:01:44 +0000 Subject: [PATCH 1/6] Part of #366 Doxygen improvements for sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 --- .../regional_esg_grid.fd/pmat.f90 | 375 ++++++++---------- 1 file changed, 168 insertions(+), 207 deletions(-) diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 index fc7924f41..6b6672379 100644 --- a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 @@ -1,5 +1,5 @@ !> @file -!! @author R. J. Purser, NOAA/NCEP/EMC, Tsukasa Fujita, JMA. +!! @brief Utility routines for various linear inversions and Cholesky. !! !! Utility routines for various linear inversions and Cholesky. !! Dependency: modules pkind, pietc @@ -16,9 +16,11 @@ !! !! DIRECT DEPENDENCIES: !! Modules: pkind, pietc -!! +!! @author R. J. Purser, NOAA/NCEP/EMC, Tsukasa Fujita, JMA. + +!> Utility routines interface module +!! @author R. J. Purser module pmat -!============================================================================= use pkind, only: spi,sp,dp,spc,dpc use pietc, only: t,f implicit none @@ -34,7 +36,6 @@ module pmat sinvmt, dinvmt, cinvmt, slinmmt, dlinmmt, clinmmt, slinmvt, dlinmvt, clinmvt, & sinvmtf,dinvmtf,cinvmtf,slinmmtf,dlinmmtf,clinmmtf,slinmvtf,dlinmvtf,clinmvtf,& iinvf - end interface interface L1Lm; module procedure sL1Lm,dL1Lm,sL1Lmf,dL1Lmf; end interface interface LdLm; module procedure sLdLm,dLdLm,sLdLmf,dLdLmf; end interface interface invl; module procedure sinvl,dinvl,slinlv,dlinlv; end interface @@ -42,69 +43,70 @@ module pmat contains -!============================================================================= +!> Swap vectors +!! @param d vector +!! @param e vector +!! @author R. J. Purser subroutine sswpvv(d,e)! [swpvv] -!============================================================================= -! Swap vectors -!------------- real(sp), intent(inout) :: d(:), e(:) real(sp) :: tv(size(d)) -!============================================================================= tv = d; d = e; e = tv end subroutine sswpvv -!============================================================================= + +!> dswpvv routine +!! @author R. J. Purser subroutine dswpvv(d,e)! [swpvv] -!============================================================================= real(dp), intent(inout) :: d(:), e(:) real(dp) :: tv(size(d)) -!============================================================================= tv = d; d = e; e = tv end subroutine dswpvv -!============================================================================= + +!> cswpvv routine +!! @author R. J. Purser subroutine cswpvv(d,e)! [swpvv] -!============================================================================= complex(dpc),intent(inout) :: d(:), e(:) complex(dpc) :: tv(size(d)) -!============================================================================= tv = d; d = e; e = tv end subroutine cswpvv -!============================================================================= +!> sinvmt routine +!! @author R. J. Purser subroutine sinvmt(a)! [inv] -!============================================================================= real(sp),dimension(:,:),intent(INOUT):: a logical :: ff call sinvmtf(a,ff) if(ff)stop 'In sinvmt; Unable to invert matrix' end subroutine sinvmt -!============================================================================= + +!> dinvmt routine +!! @author R. J. Purser subroutine dinvmt(a)! [inv] -!============================================================================= real(dp),dimension(:,:),intent(inout):: a logical :: ff call dinvmtf(a,ff) if(ff)stop 'In dinvmt; Unable to invert matrix' end subroutine dinvmt -!============================================================================= + +!> cinvmt routine +!! @author R. J. Purser subroutine cinvmt(a)! [inv] -!============================================================================= complex(dpc),dimension(:,:),intent(inout):: a logical :: ff call cinvmtf(a,ff) if(ff)stop 'In cinvmt; Unable to invert matrix' end subroutine cinvmt -!============================================================================= + +!> Invert matrix (or flag if can't) +!! @param a matrix +!! @param ff flag for error condition +!! @author R. J. Purser subroutine sinvmtf(a,ff)! [inv] -!============================================================================= -! Invert matrix (or flag if can't) -!---------------- use pietc_s, only: u1 real(sp),dimension(:,:),intent(inout):: a logical, intent( out):: ff integer(spi) :: m,i,j,jp,l real(sp) :: d integer(spi),dimension(size(a,1)):: ipiv -!============================================================================= m=size(a,1) if(m /= size(a,2))stop 'In sinvmtf; matrix passed to sinvmtf is not square' ! Perform a pivoted L-D-U decomposition on matrix a: @@ -113,36 +115,34 @@ subroutine sinvmtf(a,ff)! [inv] print '(" In sinvmtf; failed call to sldumf")' return endif - ! Invert upper triangular portion U in place: do i=1,m; a(i,i)=u1/a(i,i); enddo do i=1,m-1 do j=i+1,m; a(i,j)=-a(j,j)*dot_product(a(i:j-1,j),a(i,i:j-1)); enddo enddo - ! Invert lower triangular portion L in place: do j=1,m-1; jp=j+1 do i=jp,m; a(i,j)=-a(i,j)-dot_product(a(jp:i-1,j),a(i,jp:i-1)); enddo enddo - ! Form the product of U**-1 and L**-1 in place do j=1,m-1; jp=j+1 do i=1,j; a(i,j)=a(i,j)+dot_product(a(jp:m,j),a(i,jp:m)); enddo do i=jp,m; a(i,j)=dot_product(a(i:m,j),a(i,i:m)); enddo enddo - ! Permute columns according to ipiv do j=m-1,1,-1; l=ipiv(j); call sswpvv(a(:,j),a(:,l)); enddo end subroutine sinvmtf -!============================================================================= + +!> Routine dinvmtf to Invert and Permute +!! @param a matrix +!! @param ff flag for error condition +!! @author R. J. Purser subroutine dinvmtf(a,ff)! [inv] -!============================================================================= real(dp),dimension(:,:),intent(inout):: a logical, intent( out):: ff integer(spi) :: m,i,j,jp,l real(dp) :: d integer(spi), dimension(size(a,1)) :: ipiv -!============================================================================= m=size(a,1) if(m /= size(a,2))stop 'In inv; matrix passed to dinvmtf is not square' ! Perform a pivoted L-D-U decomposition on matrix a: @@ -151,37 +151,35 @@ subroutine dinvmtf(a,ff)! [inv] print '(" In dinvmtf; failed call to dldumf")' return endif - ! Invert upper triangular portion U in place: do i=1,m; a(i,i)=1_dp/a(i,i); enddo do i=1,m-1 do j=i+1,m; a(i,j)=-a(j,j)*dot_product(a(i:j-1,j),a(i,i:j-1)); enddo enddo - ! Invert lower triangular portion L in place: do j=1,m-1; jp=j+1 do i=jp,m; a(i,j)=-a(i,j)-dot_product(a(jp:i-1,j),a(i,jp:i-1)); enddo enddo - ! Form the product of U**-1 and L**-1 in place do j=1,m-1; jp=j+1 do i=1,j; a(i,j)=a(i,j)+dot_product(a(jp:m,j),a(i,jp:m)); enddo do i=jp,m; a(i,j)=dot_product(a(i:m,j),a(i,i:m)); enddo enddo - ! Permute columns according to ipiv do j=m-1,1,-1; l=ipiv(j); call dswpvv(a(:,j),a(:,l)); enddo end subroutine dinvmtf -!============================================================================= + +!> routine cinvmtf to Invert and Permute +!! @param a matrix +!! @param ff flag for error condition +!! @author R. J. Purser subroutine cinvmtf(a,ff)! [inv] -!============================================================================= use pietc, only: c1 complex(dpc),dimension(:,:),intent(INOUT):: a logical, intent( OUT):: ff integer(spi) :: m,i,j,jp,l complex(dpc) :: d integer(spi),dimension(size(a,1)):: ipiv -!============================================================================= m=size(a,1) if(m /= size(a,2))stop 'In inv; matrix passed to cinvmtf is not square' ! Perform a pivoted L-D-U decomposition on matrix a: @@ -190,61 +188,59 @@ subroutine cinvmtf(a,ff)! [inv] print '(" In cinvmtf; failed call to cldumf")' return endif - ! Invert upper triangular portion U in place: do i=1,m; a(i,i)=c1/a(i,i); enddo do i=1,m-1 do j=i+1,m; a(i,j)=-a(j,j)*sum(a(i:j-1,j)*a(i,i:j-1)); enddo enddo - ! Invert lower triangular portion L in place: do j=1,m-1; jp=j+1 do i=jp,m; a(i,j)=-a(i,j)-sum(a(jp:i-1,j)*a(i,jp:i-1)); enddo enddo - ! Form the product of U**-1 and L**-1 in place do j=1,m-1; jp=j+1 do i=1,j; a(i,j)=a(i,j)+sum(a(jp:m,j)*a(i,jp:m)); enddo do i=jp,m; a(i,j)=sum(a(i:m,j)*a(i,i:m)); enddo enddo - ! Permute columns according to ipiv do j=m-1,1,-1; l=ipiv(j); call cswpvv(a(:,j),a(:,l)); enddo end subroutine cinvmtf -!============================================================================= +!> routine slinmmt +!! @author R. J. Purser subroutine slinmmt(a,b)! [inv] -!============================================================================= real(sp),dimension(:,:),intent(inout):: a,b logical :: ff call slinmmtf(a,b,ff) if(ff)stop 'In slinmmt; unable to invert linear system' end subroutine slinmmt -!============================================================================= + +!> routine dlinmmt +!! @author R. J. Purser subroutine dlinmmt(a,b)! [inv] -!============================================================================= real(dp),dimension(:,:),intent(inout):: a,b logical :: ff call dlinmmtf(a,b,ff) if(ff)stop 'In dlinmmt; unable to invert linear system' end subroutine dlinmmt -!============================================================================= + +!> routine clinmmt +!! @author R. J. Purser subroutine clinmmt(a,b)! [inv] -!============================================================================= complex(dpc),dimension(:,:),intent(inout):: a,b logical :: ff call clinmmtf(a,b,ff) if(ff)stop 'In clinmmt; unable to invert linear system' end subroutine clinmmt -!============================================================================= + +!> routine slinmmtf +!! @author R. J. Purser subroutine slinmmtf(a,b,ff)! [inv] -!============================================================================= real(sp), dimension(:,:),intent(inout):: a,b logical, intent( out):: ff integer(spi),dimension(size(a,1)) :: ipiv integer(spi) :: m real(sp) :: d -!============================================================================= m=size(a,1) if(m /= size(a,2))stop 'In inv; matrix passed to slinmmtf is not square' if(m /= size(b,1))& @@ -256,15 +252,15 @@ subroutine slinmmtf(a,b,ff)! [inv] endif call sudlmm(a,b,ipiv) end subroutine slinmmtf -!============================================================================= + +!> routine dlinmmtf +!! @author R. J. Purser subroutine dlinmmtf(a,b,ff)! [inv] -!============================================================================= real(dp),dimension(:,:), intent(inout):: a,b logical, intent( out):: ff integer(spi),dimension(size(a,1)):: ipiv integer(spi):: m real(dp) :: d -!============================================================================= m=size(a,1) if(m /= size(a,2))stop 'In inv; matrix passed to dlinmmtf is not square' if(m /= size(b,1))& @@ -276,15 +272,15 @@ subroutine dlinmmtf(a,b,ff)! [inv] endif call dudlmm(a,b,ipiv) end subroutine dlinmmtf -!============================================================================= + +!> routine clinmmtf +!! @author R. J. Purser subroutine clinmmtf(a,b,ff)! [inv] -!============================================================================= complex(dpc),dimension(:,:),intent(INOUT):: a,b logical, intent( OUT):: ff integer(spi),dimension(size(a,1)):: ipiv integer(spi) :: m complex(dpc) :: d -!============================================================================= m=size(a,1) if(m /= size(a,2))stop 'In inv; matrix passed to dlinmmtf is not square' if(m /= size(b,1))& @@ -297,42 +293,44 @@ subroutine clinmmtf(a,b,ff)! [inv] call cudlmm(a,b,ipiv) end subroutine clinmmtf -!============================================================================= +!> routine slinmvt +!! @author R. J. Purser subroutine slinmvt(a,b)! [inv] -!============================================================================= real(sp),dimension(:,:),intent(inout):: a real(sp),dimension(:), intent(inout):: b logical:: ff call slinmvtf(a,b,ff) if(ff)stop 'In slinmvt; matrix singular, unable to continue' end subroutine slinmvt -!============================================================================= + +!> routine dlinmvt +!! @author R. J. Purser subroutine dlinmvt(a,b)! [inv] -!============================================================================= real(dp),dimension(:,:),intent(inout):: a real(dp),dimension(:), intent(inout):: b logical :: ff call dlinmvtf(a,b,ff) if(ff)stop 'In dlinmvt; matrix singular, unable to continue' end subroutine dlinmvt -!============================================================================= + +!> routine clinmvt +!! @author R. J. Purser subroutine clinmvt(a,b)! [inv] -!============================================================================= complex(dpc), dimension(:,:),intent(inout):: a complex(dpc), dimension(:), intent(inout):: b logical :: ff call clinmvtf(a,b,ff) if(ff)stop 'In clinmvt; matrix singular, unable to continue' end subroutine clinmvt -!============================================================================= + +!> routine slinmvtf +!! @author R. J. Purser subroutine slinmvtf(a,b,ff)! [inv] -!============================================================================= real(sp),dimension(:,:),intent(inout):: a real(sp),dimension(:), intent(inout):: b logical, intent( out):: ff integer(spi),dimension(size(a,1)) :: ipiv real(sp) :: d -!============================================================================= if(size(a,1) /= size(a,2).or. size(a,1) /= size(b))& stop 'In inv; In slinmvtf; incompatible array dimensions' call sldumf(a,ipiv,d,ff) @@ -342,15 +340,15 @@ subroutine slinmvtf(a,b,ff)! [inv] endif call sudlmv(a,b,ipiv) end subroutine slinmvtf -!============================================================================= + +!> routine dlinmvtf +!! @author R. J. Purser subroutine dlinmvtf(a,b,ff)! [inv] -!============================================================================= real(dp),dimension(:,:),intent(inout):: a real(dp),dimension(:), intent(inout):: b logical, intent( out):: ff integer(spi), dimension(size(a,1)) :: ipiv real(dp) :: d -!============================================================================= if(size(a,1) /= size(a,2).or. size(a,1) /= size(b))& stop 'In inv; incompatible array dimensions passed to dlinmvtf' call dldumf(a,ipiv,d,ff) @@ -360,15 +358,15 @@ subroutine dlinmvtf(a,b,ff)! [inv] endif call dudlmv(a,b,ipiv) end subroutine dlinmvtf -!============================================================================= + +!> routine clinmvtf +!! @author R. J. Purser subroutine clinmvtf(a,b,ff)! [inv] -!============================================================================= complex(dpc),dimension(:,:),intent(inout):: a complex(dpc),dimension(:), intent(inout):: b logical, intent( out):: ff integer, dimension(size(a,1)) :: ipiv complex(dpc) :: d -!============================================================================= if(size(a,1) /= size(a,2).or. size(a,1) /= size(b))& stop 'In inv; incompatible array dimensions passed to clinmvtf' call cldumf(a,ipiv,d,ff) @@ -379,19 +377,17 @@ subroutine clinmvtf(a,b,ff)! [inv] call cudlmv(a,b,ipiv) end subroutine clinmvtf -!============================================================================= +!> Invert integer square array, imat, if possible, but flag ff=.true. +!! if not possible. (Determinant of imat must be +1 or -1 +!! @param imat integer square array +!! @param ff error flag +!! @author R. J. Purser subroutine iinvf(imat,ff)! [inv] -!============================================================================= -! Invert integer square array, imat, if possible, but flag ff=.true. -! if not possible. (Determinant of imat must be +1 or -1 -!============================================================================= integer(spi),dimension(:,:),intent(INOUT):: imat logical, intent( OUT):: ff -!----------------------------------------------------------------------------- real(dp),parameter :: eps=1.e-6_dp real(dp),dimension(size(imat,1),size(imat,1)):: dmat integer(spi) :: m,i,j -!============================================================================= m=size(imat,1) if(m /= size(imat,2))stop 'In inv; matrix passed to iinvf is not square' dmat=imat; call inv(dmat,ff) @@ -404,9 +400,9 @@ subroutine iinvf(imat,ff)! [inv] endif end subroutine iinvf -!============================================================================= +!> routine sldum +!! @author R. J. Purser subroutine sldum(a,ipiv,d)! [ldum] -!============================================================================= real(sp), intent(inout) :: a(:,:) real(sp), intent( out) :: d integer(spi),intent( out) :: ipiv(:) @@ -414,9 +410,10 @@ subroutine sldum(a,ipiv,d)! [ldum] call sldumf(a,ipiv,d,ff) if(ff)stop 'In sldum; matrix singular, unable to continue' end subroutine sldum -!============================================================================= + +!> routine dldum +!! @author R. J. Purser subroutine dldum(a,ipiv,d)! [ldum] -!============================================================================= real(dp), intent(inout) :: a(:,:) real(dp), intent( out) :: d integer(spi),intent( out) :: ipiv(:) @@ -424,9 +421,10 @@ subroutine dldum(a,ipiv,d)! [ldum] call dldumf(a,ipiv,d,ff) if(ff)stop 'In dldum; matrix singular, unable to continue' end subroutine dldum -!============================================================================= + +!> routine cldum +!! @author R. J. Purser subroutine cldum(a,ipiv,d)! [ldum] -!============================================================================= complex(dpc),intent(inout) :: a(:,:) complex(dpc),intent(out ) :: d integer(spi),intent(out ) :: ipiv(:) @@ -434,19 +432,15 @@ subroutine cldum(a,ipiv,d)! [ldum] call cldumf(a,ipiv,d,ff) if(ff)stop 'In cldum; matrix singular, unable to continue' end subroutine cldum -!============================================================================= + +!> perform l-d-u decomposition of square matrix a in place with +!! pivoting. +!! @param a square matrix to be factorized +!! @param ipiv array encoding the pivoting sequence +!! @param d indicator for possible sign change of determinant +!! @param ff: failure flag, set to .true. when determinant of a vanishes. +!! @author R. J. Purser subroutine sldumf(a,ipiv,d,ff)! [ldum] -!============================================================================= -! R.J.Purser, NCEP, Washington D.C. 1996 -! SUBROUTINE LDUM -! perform l-d-u decomposition of square matrix a in place with -! pivoting. -! -! <-> a square matrix to be factorized -! <-- ipiv array encoding the pivoting sequence -! <-- d indicator for possible sign change of determinant -! <-- ff: failure flag, set to .true. when determinant of a vanishes. -!============================================================================= use pietc_s,only: u0,u1 real(sp), intent(inout) :: a(:,:) real(sp), intent( out) :: d @@ -454,7 +448,6 @@ subroutine sldumf(a,ipiv,d,ff)! [ldum] logical, intent( out) :: ff integer(spi):: m,i, j, jp, ibig, jm real(sp) :: s(size(a,1)), aam, aa, abig, ajj, ajji, aij -!============================================================================= ff=f m=size(a,1) do i=1,m @@ -505,9 +498,10 @@ subroutine sldumf(a,ipiv,d,ff)! [ldum] enddo enddo end subroutine sldumf -!============================================================================= + +!> routine dldumf +!! @author R. J. Purser subroutine dldumf(a,ipiv,d,ff)! [ldum] -!============================================================================= use pietc, only: u0,u1 real(dp), intent(inout) :: a(:,:) real(dp), intent( out) :: d @@ -515,7 +509,6 @@ subroutine dldumf(a,ipiv,d,ff)! [ldum] logical(spi),intent( out) :: ff integer(spi) :: m,i, j, jp, ibig, jm real(dp) :: s(size(a,1)), aam, aa, abig, ajj, ajji, aij -!============================================================================= ff=f m=size(a,1) do i=1,m @@ -566,9 +559,10 @@ subroutine dldumf(a,ipiv,d,ff)! [ldum] enddo enddo end subroutine dldumf -!============================================================================= + +!> routine cldumf +!! @author R. J. Purser subroutine cldumf(a,ipiv,d,ff)! [ldum] -!============================================================================= use pietc, only: u0,u1,c0,c1 complex(dpc), intent(inout) :: a(:,:) complex(dpc), intent( out) :: d @@ -578,7 +572,6 @@ subroutine cldumf(a,ipiv,d,ff)! [ldum] complex(dpc) :: ajj, ajji, aij real(dp) :: aam,aa,abig real(dp),dimension(size(a,1)):: s -!============================================================================= ff=f m=size(a,1) do i=1,m @@ -630,25 +623,20 @@ subroutine cldumf(a,ipiv,d,ff)! [ldum] enddo end subroutine cldumf -!============================================================================= +!> @brief SUBROUTINE UDLMM. +!! use l-u factors in A to back-substitute for several rhs in B, using ipiv to +!! define the pivoting permutation used in the l-u decomposition. +!! @param A L-D-U factorization of linear system matrux +!! @param B rt-hand-sides vectors on input, corresponding solutions on return +!! @param IPIV array encoding the pivoting sequence +!! @author R. J. Purser subroutine sudlmm(a,b,ipiv)! [udlmm] -!============================================================================= -! R.J.Purser, National Meteorological Center, Washington D.C. 1993 -! SUBROUTINE UDLMM -! use l-u factors in A to back-substitute for several rhs in B, using ipiv to -! define the pivoting permutation used in the l-u decomposition. -! -! --> A L-D-U factorization of linear system matrux -! <-> B rt-hand-sides vectors on input, corresponding solutions on return -! --> IPIV array encoding the pivoting sequence -!============================================================================= use pietc_s, only: u1 integer(spi),dimension(:), intent(in) :: ipiv real(sp), dimension(:,:),intent(in) :: a real(sp), dimension(:,:),intent(inout) :: b integer(spi):: m,i, k, l real(sp) :: s,aiii -!============================================================================= m=size(a,1) do k=1,size(b,2) !loop over columns of b do i=1,m @@ -666,16 +654,16 @@ subroutine sudlmm(a,b,ipiv)! [udlmm] enddo enddo end subroutine sudlmm -!============================================================================= + +!> routine dudlmm +!! @author R. J. Purser subroutine dudlmm(a,b,ipiv)! [udlmm] -!============================================================================= use pietc, only: u1 integer(spi),dimension(:), intent(in ) :: ipiv real(dp), dimension(:,:),intent(in ) :: a real(dp), dimension(:,:),intent(inout) :: b integer(spi):: m,i, k, l real(dp) :: s,aiii -!============================================================================= m=size(a,1) do k=1, size(b,2)!loop over columns of b do i=1,m @@ -693,16 +681,16 @@ subroutine dudlmm(a,b,ipiv)! [udlmm] enddo enddo end subroutine dudlmm -!============================================================================= + +!> routine cudlmm +!! @author R. J. Purser subroutine cudlmm(a,b,ipiv)! [udlmm] -!============================================================================= use pietc, only: c1 integer(spi),dimension(:), intent(in ) :: ipiv complex(dpc),dimension(:,:),intent(in ) :: a complex(dpc),dimension(:,:),intent(inout) :: b integer(spi):: m,i, k, l complex(dpc):: s,aiii -!============================================================================= m=size(a,1) do k=1, size(b,2)!loop over columns of b do i=1,m @@ -721,25 +709,20 @@ subroutine cudlmm(a,b,ipiv)! [udlmm] enddo end subroutine cudlmm -!============================================================================= +!> @brief SUBROUTINE UDLMV +!! use l-u factors in A to back-substitute for 1 rhs in B, using ipiv to +!! define the pivoting permutation used in the l-u decomposition. +!! @param A L-D-U factorization of linear system matrix +!! @param B right-hand-side vector on input, corresponding solution on return +!! @param IPIV array encoding the pivoting sequence +!! @author R. J. Purser subroutine sudlmv(a,b,ipiv)! [udlmv] -!============================================================================= -! R.J.Purser, National Meteorological Center, Washington D.C. 1993 -! SUBROUTINE UDLMV -! use l-u factors in A to back-substitute for 1 rhs in B, using ipiv to -! define the pivoting permutation used in the l-u decomposition. -! -! --> A L-D-U factorization of linear system matrix -! <-> B right-hand-side vector on input, corresponding solution on return -! --> IPIV array encoding the pivoting sequence -!============================================================================= use pietc_s, only: u1 integer(spi),dimension(:), intent(in ):: ipiv real(sp), dimension(:,:),intent(in ):: a real(sp), dimension(:), intent(inout):: b integer(spi):: m,i, l real(sp) :: s,aiii -!============================================================================= m=size(a,1) do i=1,m l=ipiv(i) @@ -755,16 +738,16 @@ subroutine sudlmv(a,b,ipiv)! [udlmv] b(i)=b(i)*aiii enddo end subroutine sudlmv -!============================================================================= + +!> routine dudlmv +!! @author R. J. Purser subroutine dudlmv(a,b,ipiv)! [udlmv] -!============================================================================= use pietc, only: u1 integer(spi),dimension(:), intent(in ) :: ipiv(:) real(dp), dimension(:,:),intent(in ) :: a(:,:) real(dp), dimension(:), intent(inout) :: b(:) integer(spi):: m,i, l real(dp) :: s,aiii -!============================================================================= m=size(a,1) do i=1,m l=ipiv(i) @@ -780,16 +763,16 @@ subroutine dudlmv(a,b,ipiv)! [udlmv] b(i)=b(i)*aiii enddo end subroutine dudlmv -!============================================================================= + +!> routine cudlmv +!! @author R. J. Purser subroutine cudlmv(a,b,ipiv)! [udlmv] -!============================================================================= use pietc, only: c1 integer(spi),dimension(:), intent(in ) :: ipiv(:) complex(dpc),dimension(:,:),intent(in ) :: a(:,:) complex(dpc),dimension(:), intent(inout) :: b(:) integer(spi):: m,i, l complex(dpc):: s,aiii -!============================================================================= m=size(a,1) do i=1,m l=ipiv(i) @@ -806,44 +789,35 @@ subroutine cudlmv(a,b,ipiv)! [udlmv] enddo end subroutine cudlmv -!============================================================================= +!> Cholesky, M -> L*U, U(i,j)=L(j,i) +!! @author R. J. Purser subroutine sl1lm(a,b) ! [l1lm] -!============================================================================= -! Cholesky, M -> L*U, U(i,j)=L(j,i) -!============================================================================= real(sp),intent(in ):: a(:,:) real(sp),intent(inout):: b(:,:) -!----------------------------------------------------------------------------- logical:: ff call sl1lmf(a,b,ff) if(ff)stop 'In sl1lm; matrix singular, unable to continue' end subroutine sl1lm -!============================================================================= + +!> Cholesky, M -> L*U, U(i,j)=L(j,i) +!! @author R. J. Purser subroutine dl1lm(a,b) ! [l1lm] -!============================================================================= -! Cholesky, M -> L*U, U(i,j)=L(j,i) -!============================================================================= real(dp),intent(in ):: a(:,:) real(dp),intent(inout):: b(:,:) -!----------------------------------------------------------------------------- logical:: ff call dl1lmf(a,b,ff) if(ff)stop 'In dl1lm; matrix singular, unable to continue' end subroutine dl1lm -!============================================================================= +!> Cholesky, M -> L*U, U(i,j)=L(j,i) +!! @author R. J. Purser subroutine sl1lmf(a,b,ff)! [L1Lm] -!============================================================================= -! Cholesky, M -> L*U, U(i,j)=L(j,i) -!============================================================================= use pietc_s, only: u0 real(sp),intent(in ):: a(:,:) real(sp),intent(inout):: b(:,:) logical, intent( out):: ff -!----------------------------------------------------------------------------- integer(spi):: m,j, jm, jp, i real(sp) :: s, bjji -!============================================================================= m=size(a,1) ff=f do j=1,m @@ -864,17 +838,16 @@ subroutine sl1lmf(a,b,ff)! [L1Lm] b(1:jm,j) = u0 enddo end subroutine sl1lmf -!============================================================================= + +!> routine dl1lmf +!! @author R. J. Purser subroutine dl1lmf(a,b,ff) ! [L1Lm] -!============================================================================= use pietc, only: u0,u1 real(dp),intent(in ) :: a(:,:) real(dp),intent(inout) :: b(:,:) logical, intent( out) :: ff -!----------------------------------------------------------------------------- integer(spi):: m,j, jm, jp, i real(dp) :: s, bjji -!============================================================================= m=size(a,1) ff=f do j=1,m @@ -896,45 +869,38 @@ subroutine dl1lmf(a,b,ff) ! [L1Lm] enddo end subroutine dl1lmf -!============================================================================= +!> Modified Cholesky decompose Q --> L*D*U, U(i,j)=L(j,i) +!! @author R. J. Purser subroutine sldlm(a,b,d)! [LdLm] -!============================================================================= -! Modified Cholesky decompose Q --> L*D*U, U(i,j)=L(j,i) -!============================================================================= real(sp),intent(in ):: a(:,:) real(sp),intent(inout):: b(:,:) real(sp),intent( out):: d(:) -!----------------------------------------------------------------------------- logical:: ff call sldlmf(a,b,d,ff) if(ff)stop 'In sldlm; matrix singular, unable to continue' end subroutine sldlm -!============================================================================= + +!> routine dldlm +!! @author R. J. Purser subroutine dldlm(a,b,d)! [LdLm] -!============================================================================= real(dp),intent(in ):: a(:,:) real(dp),intent(inout):: b(:,:) real(dp),intent( out):: d(:) -!----------------------------------------------------------------------------- logical:: ff call dldlmf(a,b,d,ff) if(ff)stop 'In dldlm; matrix singular, unable to continue' end subroutine dldlm -!============================================================================= +!> Modified Cholesky decompose Q --> L*D*U +!! @author R. J. Purser subroutine sldlmf(a,b,d,ff) ! [LDLM] -!============================================================================= -! Modified Cholesky decompose Q --> L*D*U -!============================================================================= use pietc_s, only: u0,u1 real(sp), intent(in ):: a(:,:) real(sp), intent(inout):: b(:,:) real(sp), intent( out):: d(:) logical, intent( out):: ff -!----------------------------------------------------------------------------- integer(spi):: m,j, jm, jp, i real(sp) :: bjji -!============================================================================= m=size(a,1) ff=f do j=1,m @@ -956,20 +922,17 @@ subroutine sldlmf(a,b,d,ff) ! [LDLM] b(1:jm,j)=u0 enddo end subroutine sldlmf -!============================================================================= + +!> Modified Cholesky Q --> L*D*U, U(i,j)=L(j,i) +!! @author R. J. Purser subroutine dldlmf(a,b,d,ff) ! [LDLM] -!============================================================================= -! Modified Cholesky Q --> L*D*U, U(i,j)=L(j,i) -!============================================================================= use pietc, only: u0,u1 real(dp), intent(IN ) :: a(:,:) real(dp), intent(INOUT) :: b(:,:) real(dp), intent( OUT) :: d(:) logical, intent( OUT) :: ff -!----------------------------------------------------------------------------- integer(spi):: m,j, jm, jp, i real(dp) :: bjji -!============================================================================= m=size(a,1) ff=f do j=1,m; jm=j-1; jp=j+1 @@ -990,26 +953,25 @@ subroutine dldlmf(a,b,d,ff) ! [LDLM] enddo end subroutine dldlmf -!============================================================================== +!> Invert the upper triangular matrix in place by transposing, calling +!! invl, and transposing again. +!! @param a upper triangular matrix +!! @author R. J. Purser subroutine sinvu(a)! [invu] -!============================================================================== -! Invert the upper triangular matrix in place by transposing, calling -! invl, and transposing again. -!============================================================================== real(sp),dimension(:,:),intent(inout):: a a=transpose(a); call sinvl(a); a=transpose(a) end subroutine sinvu -!============================================================================== + +!> routine dinvu +!! @author R. J. Purser subroutine dinvu(a)! [invu] -!============================================================================== real(dp),dimension(:,:),intent(inout):: a a=transpose(a); call dinvl(a); a=transpose(a) end subroutine dinvu -!============================================================================== + +!> Invert lower triangular matrix in place +!! @author R. J. Purser subroutine sinvl(a)! [invl] -!============================================================================== -! Invert lower triangular matrix in place -!============================================================================== use pietc_s, only: u0,u1 real(sp), intent(inout) :: a(:,:) integer(spi):: m,j, i @@ -1022,9 +984,10 @@ subroutine sinvl(a)! [invl] enddo enddo end subroutine sinvl -!============================================================================== + +!> routine dinvl +!! @author R. J. Purser subroutine dinvl(a)! [invl] -!============================================================================== use pietc, only: u0,u1 real(dp), intent(inout) :: a(:,:) integer(spi):: m,j, i @@ -1038,11 +1001,9 @@ subroutine dinvl(a)! [invl] enddo end subroutine dinvl -!============================================================================== +!> Solve linear system involving lower triangular system matrix. +!! @author R. J. Purser subroutine slinlv(a,u)! [invl] -!============================================================================== -! Solve linear system involving lower triangular system matrix. -!============================================================================== real(sp),intent(in ) :: a(:,:) real(sp),intent(inout) :: u(:) integer(spi):: i @@ -1050,9 +1011,10 @@ subroutine slinlv(a,u)! [invl] stop 'In slinlv; incompatible array dimensions' do i=1,size(u); u(i)=(u(i) - sum(u(:i-1)*a(i,:i-1)))/a(i,i); enddo end subroutine slinlv -!============================================================================== + +!> routine dlinlv +!! @author R. J. Purser subroutine dlinlv(a,u)! [invl] -!============================================================================== real(dp),intent(in ) :: a(:,:) real(dp),intent(inout) :: u(:) integer(spi):: i @@ -1061,11 +1023,9 @@ subroutine dlinlv(a,u)! [invl] do i=1,size(u); u(i)=(u(i) - sum(u(:i-1)*a(i,:i-1)))/a(i,i); enddo end subroutine dlinlv -!============================================================================== +!> Solve linear system involving upper triangular system matrix. +!! @author R. J. Purser subroutine slinuv(a,u)! [invu] -!============================================================================== -! Solve linear system involving upper triangular system matrix. -!============================================================================== real(sp),intent(in ) :: a(:,:) real(sp),intent(inout) :: u(:) integer(spi):: i @@ -1073,9 +1033,10 @@ subroutine slinuv(a,u)! [invu] stop 'In linuv; incompatible array dimensions' do i=size(u),1,-1; u(i)=(u(i) - sum(a(i+1:,i)*u(i+1:)))/a(i,i); enddo end subroutine slinuv -!============================================================================== + +!> routine dlinuv +!! @author R. J. Purser subroutine dlinuv(a,u)! [invu] -!============================================================================== real(dp), intent(in ) :: a(:,:) real(dp), intent(inout) :: u(:) integer(spi) :: i From 307c9877934a2b8ba4608f87943df36d3f03dd2e Mon Sep 17 00:00:00 2001 From: "Lin.Gan" Date: Tue, 2 Mar 2021 21:46:28 +0000 Subject: [PATCH 2/6] Part of #366 Doxygen improvements for sorc/grid_tools.fd/regional_esg_grid.fd/pmat2.f90 --- sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 index 6b6672379..93a4c1f4e 100644 --- a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 @@ -44,6 +44,7 @@ module pmat contains !> Swap vectors +!! !! @param d vector !! @param e vector !! @author R. J. Purser @@ -97,6 +98,7 @@ subroutine cinvmt(a)! [inv] end subroutine cinvmt !> Invert matrix (or flag if can't) +!! !! @param a matrix !! @param ff flag for error condition !! @author R. J. Purser @@ -134,6 +136,7 @@ subroutine sinvmtf(a,ff)! [inv] end subroutine sinvmtf !> Routine dinvmtf to Invert and Permute +!! !! @param a matrix !! @param ff flag for error condition !! @author R. J. Purser @@ -170,6 +173,7 @@ subroutine dinvmtf(a,ff)! [inv] end subroutine dinvmtf !> routine cinvmtf to Invert and Permute +!! !! @param a matrix !! @param ff flag for error condition !! @author R. J. Purser @@ -379,6 +383,7 @@ end subroutine clinmvtf !> Invert integer square array, imat, if possible, but flag ff=.true. !! if not possible. (Determinant of imat must be +1 or -1 +!! !! @param imat integer square array !! @param ff error flag !! @author R. J. Purser @@ -435,6 +440,7 @@ end subroutine cldum !> perform l-d-u decomposition of square matrix a in place with !! pivoting. +!! !! @param a square matrix to be factorized !! @param ipiv array encoding the pivoting sequence !! @param d indicator for possible sign change of determinant @@ -626,6 +632,7 @@ end subroutine cldumf !> @brief SUBROUTINE UDLMM. !! use l-u factors in A to back-substitute for several rhs in B, using ipiv to !! define the pivoting permutation used in the l-u decomposition. +!! !! @param A L-D-U factorization of linear system matrux !! @param B rt-hand-sides vectors on input, corresponding solutions on return !! @param IPIV array encoding the pivoting sequence @@ -712,6 +719,7 @@ end subroutine cudlmm !> @brief SUBROUTINE UDLMV !! use l-u factors in A to back-substitute for 1 rhs in B, using ipiv to !! define the pivoting permutation used in the l-u decomposition. +!! !! @param A L-D-U factorization of linear system matrix !! @param B right-hand-side vector on input, corresponding solution on return !! @param IPIV array encoding the pivoting sequence @@ -955,6 +963,7 @@ end subroutine dldlmf !> Invert the upper triangular matrix in place by transposing, calling !! invl, and transposing again. +!! !! @param a upper triangular matrix !! @author R. J. Purser subroutine sinvu(a)! [invu] From 345867d2a93f066d5ba5645fc09b69115bcbdacb Mon Sep 17 00:00:00 2001 From: "Lin.Gan" Date: Tue, 2 Mar 2021 22:09:10 +0000 Subject: [PATCH 3/6] Doxygen improvements for pmat.f90 --- sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 index 93a4c1f4e..000dd115b 100644 --- a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 @@ -36,6 +36,7 @@ module pmat sinvmt, dinvmt, cinvmt, slinmmt, dlinmmt, clinmmt, slinmvt, dlinmvt, clinmvt, & sinvmtf,dinvmtf,cinvmtf,slinmmtf,dlinmmtf,clinmmtf,slinmvtf,dlinmvtf,clinmvtf,& iinvf + end interface interface L1Lm; module procedure sL1Lm,dL1Lm,sL1Lmf,dL1Lmf; end interface interface LdLm; module procedure sLdLm,dLdLm,sLdLmf,dLdLmf; end interface interface invl; module procedure sinvl,dinvl,slinlv,dlinlv; end interface From 5ae851fba557dca3bc657fe338429619e70092a0 Mon Sep 17 00:00:00 2001 From: "Lin.Gan" Date: Wed, 3 Mar 2021 15:24:37 +0000 Subject: [PATCH 4/6] Part of #366 Doxygen improvements for sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 --- .../regional_esg_grid.fd/pmat.f90 | 164 +++++++++++------- 1 file changed, 104 insertions(+), 60 deletions(-) diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 index 000dd115b..0cfeaac86 100644 --- a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 @@ -44,10 +44,10 @@ module pmat contains -!> Swap vectors +!> ??? !! -!! @param d vector -!! @param e vector +!! @param[inout] d vector +!! @param[inout] e vector !! @author R. J. Purser subroutine sswpvv(d,e)! [swpvv] real(sp), intent(inout) :: d(:), e(:) @@ -55,7 +55,10 @@ subroutine sswpvv(d,e)! [swpvv] tv = d; d = e; e = tv end subroutine sswpvv -!> dswpvv routine +!> ??? +!! +!! @param[inout] d vector +!! @param[inout] e vector !! @author R. J. Purser subroutine dswpvv(d,e)! [swpvv] real(dp), intent(inout) :: d(:), e(:) @@ -63,7 +66,10 @@ subroutine dswpvv(d,e)! [swpvv] tv = d; d = e; e = tv end subroutine dswpvv -!> cswpvv routine +!> ??? +!! +!! @param[inout] d vector +!! @param[inout] e vector !! @author R. J. Purser subroutine cswpvv(d,e)! [swpvv] complex(dpc),intent(inout) :: d(:), e(:) @@ -71,7 +77,10 @@ subroutine cswpvv(d,e)! [swpvv] tv = d; d = e; e = tv end subroutine cswpvv -!> sinvmt routine +!> Invert matrix +!! +!! @param[inout] a matrix +!! @param ff error flag !! @author R. J. Purser subroutine sinvmt(a)! [inv] real(sp),dimension(:,:),intent(INOUT):: a @@ -80,7 +89,10 @@ subroutine sinvmt(a)! [inv] if(ff)stop 'In sinvmt; Unable to invert matrix' end subroutine sinvmt -!> dinvmt routine +!> Invert matrix +!! +!! @param[inout] a matrix +!! @param ff error flag !! @author R. J. Purser subroutine dinvmt(a)! [inv] real(dp),dimension(:,:),intent(inout):: a @@ -89,7 +101,10 @@ subroutine dinvmt(a)! [inv] if(ff)stop 'In dinvmt; Unable to invert matrix' end subroutine dinvmt -!> cinvmt routine +!> Invert matrix +!! +!! @param[inout] a matrix +!! @param ff error flag !! @author R. J. Purser subroutine cinvmt(a)! [inv] complex(dpc),dimension(:,:),intent(inout):: a @@ -100,8 +115,8 @@ end subroutine cinvmt !> Invert matrix (or flag if can't) !! -!! @param a matrix -!! @param ff flag for error condition +!! @param[inout] a matrix +!! @param[out] ff flag for error condition !! @author R. J. Purser subroutine sinvmtf(a,ff)! [inv] use pietc_s, only: u1 @@ -138,8 +153,8 @@ end subroutine sinvmtf !> Routine dinvmtf to Invert and Permute !! -!! @param a matrix -!! @param ff flag for error condition +!! @param[inout] a matrix +!! @param ff[out] flag for error condition !! @author R. J. Purser subroutine dinvmtf(a,ff)! [inv] real(dp),dimension(:,:),intent(inout):: a @@ -173,10 +188,10 @@ subroutine dinvmtf(a,ff)! [inv] do j=m-1,1,-1; l=ipiv(j); call dswpvv(a(:,j),a(:,l)); enddo end subroutine dinvmtf -!> routine cinvmtf to Invert and Permute +!> Routine cinvmtf to Invert and Permute !! -!! @param a matrix -!! @param ff flag for error condition +!! @param a[inout] matrix +!! @param ff[out] flag for error condition !! @author R. J. Purser subroutine cinvmtf(a,ff)! [inv] use pietc, only: c1 @@ -211,7 +226,7 @@ subroutine cinvmtf(a,ff)! [inv] do j=m-1,1,-1; l=ipiv(j); call cswpvv(a(:,j),a(:,l)); enddo end subroutine cinvmtf -!> routine slinmmt +!> ??? !! @author R. J. Purser subroutine slinmmt(a,b)! [inv] real(sp),dimension(:,:),intent(inout):: a,b @@ -220,7 +235,7 @@ subroutine slinmmt(a,b)! [inv] if(ff)stop 'In slinmmt; unable to invert linear system' end subroutine slinmmt -!> routine dlinmmt +!> ??? !! @author R. J. Purser subroutine dlinmmt(a,b)! [inv] real(dp),dimension(:,:),intent(inout):: a,b @@ -229,7 +244,7 @@ subroutine dlinmmt(a,b)! [inv] if(ff)stop 'In dlinmmt; unable to invert linear system' end subroutine dlinmmt -!> routine clinmmt +!> ??? !! @author R. J. Purser subroutine clinmmt(a,b)! [inv] complex(dpc),dimension(:,:),intent(inout):: a,b @@ -238,7 +253,7 @@ subroutine clinmmt(a,b)! [inv] if(ff)stop 'In clinmmt; unable to invert linear system' end subroutine clinmmt -!> routine slinmmtf +!> ??? !! @author R. J. Purser subroutine slinmmtf(a,b,ff)! [inv] real(sp), dimension(:,:),intent(inout):: a,b @@ -258,7 +273,7 @@ subroutine slinmmtf(a,b,ff)! [inv] call sudlmm(a,b,ipiv) end subroutine slinmmtf -!> routine dlinmmtf +!> ??? !! @author R. J. Purser subroutine dlinmmtf(a,b,ff)! [inv] real(dp),dimension(:,:), intent(inout):: a,b @@ -278,7 +293,7 @@ subroutine dlinmmtf(a,b,ff)! [inv] call dudlmm(a,b,ipiv) end subroutine dlinmmtf -!> routine clinmmtf +!> ??? !! @author R. J. Purser subroutine clinmmtf(a,b,ff)! [inv] complex(dpc),dimension(:,:),intent(INOUT):: a,b @@ -298,7 +313,7 @@ subroutine clinmmtf(a,b,ff)! [inv] call cudlmm(a,b,ipiv) end subroutine clinmmtf -!> routine slinmvt +!> ??? !! @author R. J. Purser subroutine slinmvt(a,b)! [inv] real(sp),dimension(:,:),intent(inout):: a @@ -308,7 +323,7 @@ subroutine slinmvt(a,b)! [inv] if(ff)stop 'In slinmvt; matrix singular, unable to continue' end subroutine slinmvt -!> routine dlinmvt +!> ??? !! @author R. J. Purser subroutine dlinmvt(a,b)! [inv] real(dp),dimension(:,:),intent(inout):: a @@ -318,7 +333,7 @@ subroutine dlinmvt(a,b)! [inv] if(ff)stop 'In dlinmvt; matrix singular, unable to continue' end subroutine dlinmvt -!> routine clinmvt +!> ??? !! @author R. J. Purser subroutine clinmvt(a,b)! [inv] complex(dpc), dimension(:,:),intent(inout):: a @@ -328,7 +343,7 @@ subroutine clinmvt(a,b)! [inv] if(ff)stop 'In clinmvt; matrix singular, unable to continue' end subroutine clinmvt -!> routine slinmvtf +!> ??? !! @author R. J. Purser subroutine slinmvtf(a,b,ff)! [inv] real(sp),dimension(:,:),intent(inout):: a @@ -346,7 +361,7 @@ subroutine slinmvtf(a,b,ff)! [inv] call sudlmv(a,b,ipiv) end subroutine slinmvtf -!> routine dlinmvtf +!> ??? !! @author R. J. Purser subroutine dlinmvtf(a,b,ff)! [inv] real(dp),dimension(:,:),intent(inout):: a @@ -364,7 +379,7 @@ subroutine dlinmvtf(a,b,ff)! [inv] call dudlmv(a,b,ipiv) end subroutine dlinmvtf -!> routine clinmvtf +!> ??? !! @author R. J. Purser subroutine clinmvtf(a,b,ff)! [inv] complex(dpc),dimension(:,:),intent(inout):: a @@ -385,8 +400,8 @@ end subroutine clinmvtf !> Invert integer square array, imat, if possible, but flag ff=.true. !! if not possible. (Determinant of imat must be +1 or -1 !! -!! @param imat integer square array -!! @param ff error flag +!! @param imat[inout] integer square array +!! @param ff[out] error flag !! @author R. J. Purser subroutine iinvf(imat,ff)! [inv] integer(spi),dimension(:,:),intent(INOUT):: imat @@ -406,7 +421,7 @@ subroutine iinvf(imat,ff)! [inv] endif end subroutine iinvf -!> routine sldum +!> ??? !! @author R. J. Purser subroutine sldum(a,ipiv,d)! [ldum] real(sp), intent(inout) :: a(:,:) @@ -417,7 +432,7 @@ subroutine sldum(a,ipiv,d)! [ldum] if(ff)stop 'In sldum; matrix singular, unable to continue' end subroutine sldum -!> routine dldum +!> ??? !! @author R. J. Purser subroutine dldum(a,ipiv,d)! [ldum] real(dp), intent(inout) :: a(:,:) @@ -428,7 +443,7 @@ subroutine dldum(a,ipiv,d)! [ldum] if(ff)stop 'In dldum; matrix singular, unable to continue' end subroutine dldum -!> routine cldum +!> ??? !! @author R. J. Purser subroutine cldum(a,ipiv,d)! [ldum] complex(dpc),intent(inout) :: a(:,:) @@ -439,13 +454,13 @@ subroutine cldum(a,ipiv,d)! [ldum] if(ff)stop 'In cldum; matrix singular, unable to continue' end subroutine cldum -!> perform l-d-u decomposition of square matrix a in place with +!> Perform l-d-u decomposition of square matrix a in place with !! pivoting. !! -!! @param a square matrix to be factorized -!! @param ipiv array encoding the pivoting sequence -!! @param d indicator for possible sign change of determinant -!! @param ff: failure flag, set to .true. when determinant of a vanishes. +!! @param[inout] a square matrix to be factorized +!! @param[out] ipiv array encoding the pivoting sequence +!! @param[out] d indicator for possible sign change of determinant +!! @param[out] ff: failure flag, set to .true. when determinant of a vanishes. !! @author R. J. Purser subroutine sldumf(a,ipiv,d,ff)! [ldum] use pietc_s,only: u0,u1 @@ -506,7 +521,7 @@ subroutine sldumf(a,ipiv,d,ff)! [ldum] enddo end subroutine sldumf -!> routine dldumf +!> ??? !! @author R. J. Purser subroutine dldumf(a,ipiv,d,ff)! [ldum] use pietc, only: u0,u1 @@ -567,7 +582,7 @@ subroutine dldumf(a,ipiv,d,ff)! [ldum] enddo end subroutine dldumf -!> routine cldumf +!> ??? !! @author R. J. Purser subroutine cldumf(a,ipiv,d,ff)! [ldum] use pietc, only: u0,u1,c0,c1 @@ -630,13 +645,12 @@ subroutine cldumf(a,ipiv,d,ff)! [ldum] enddo end subroutine cldumf -!> @brief SUBROUTINE UDLMM. -!! use l-u factors in A to back-substitute for several rhs in B, using ipiv to +!> Use l-u factors in A to back-substitute for several rhs in B, using ipiv to !! define the pivoting permutation used in the l-u decomposition. !! -!! @param A L-D-U factorization of linear system matrux -!! @param B rt-hand-sides vectors on input, corresponding solutions on return -!! @param IPIV array encoding the pivoting sequence +!! @param[in] A L-D-U factorization of linear system matrux +!! @param[inout] B rt-hand-sides vectors on input, corresponding solutions on return +!! @param[in] IPIV array encoding the pivoting sequence !! @author R. J. Purser subroutine sudlmm(a,b,ipiv)! [udlmm] use pietc_s, only: u1 @@ -663,7 +677,7 @@ subroutine sudlmm(a,b,ipiv)! [udlmm] enddo end subroutine sudlmm -!> routine dudlmm +!> ??? !! @author R. J. Purser subroutine dudlmm(a,b,ipiv)! [udlmm] use pietc, only: u1 @@ -690,7 +704,7 @@ subroutine dudlmm(a,b,ipiv)! [udlmm] enddo end subroutine dudlmm -!> routine cudlmm +!> ??? !! @author R. J. Purser subroutine cudlmm(a,b,ipiv)! [udlmm] use pietc, only: c1 @@ -717,13 +731,12 @@ subroutine cudlmm(a,b,ipiv)! [udlmm] enddo end subroutine cudlmm -!> @brief SUBROUTINE UDLMV -!! use l-u factors in A to back-substitute for 1 rhs in B, using ipiv to +!> Use l-u factors in A to back-substitute for 1 rhs in B, using ipiv to !! define the pivoting permutation used in the l-u decomposition. !! -!! @param A L-D-U factorization of linear system matrix -!! @param B right-hand-side vector on input, corresponding solution on return -!! @param IPIV array encoding the pivoting sequence +!! @param[in] A L-D-U factorization of linear system matrix +!! @param[inout] B right-hand-side vector on input, corresponding solution on return +!! @param[in] IPIV array encoding the pivoting sequence !! @author R. J. Purser subroutine sudlmv(a,b,ipiv)! [udlmv] use pietc_s, only: u1 @@ -748,7 +761,7 @@ subroutine sudlmv(a,b,ipiv)! [udlmv] enddo end subroutine sudlmv -!> routine dudlmv +!> ??? !! @author R. J. Purser subroutine dudlmv(a,b,ipiv)! [udlmv] use pietc, only: u1 @@ -773,7 +786,7 @@ subroutine dudlmv(a,b,ipiv)! [udlmv] enddo end subroutine dudlmv -!> routine cudlmv +!> ??? !! @author R. J. Purser subroutine cudlmv(a,b,ipiv)! [udlmv] use pietc, only: c1 @@ -799,6 +812,9 @@ subroutine cudlmv(a,b,ipiv)! [udlmv] end subroutine cudlmv !> Cholesky, M -> L*U, U(i,j)=L(j,i) +!! +!! @param[in] a matrix +!! @param[inout] b matrix !! @author R. J. Purser subroutine sl1lm(a,b) ! [l1lm] real(sp),intent(in ):: a(:,:) @@ -809,6 +825,9 @@ subroutine sl1lm(a,b) ! [l1lm] end subroutine sl1lm !> Cholesky, M -> L*U, U(i,j)=L(j,i) +!! +!! @param[in] a matrix +!! @param[inout] b matrix !! @author R. J. Purser subroutine dl1lm(a,b) ! [l1lm] real(dp),intent(in ):: a(:,:) @@ -819,6 +838,9 @@ subroutine dl1lm(a,b) ! [l1lm] end subroutine dl1lm !> Cholesky, M -> L*U, U(i,j)=L(j,i) +!! +!! @param[in] a matrix +!! @param[inout] b matrix !! @author R. J. Purser subroutine sl1lmf(a,b,ff)! [L1Lm] use pietc_s, only: u0 @@ -848,7 +870,7 @@ subroutine sl1lmf(a,b,ff)! [L1Lm] enddo end subroutine sl1lmf -!> routine dl1lmf +!> ??? !! @author R. J. Purser subroutine dl1lmf(a,b,ff) ! [L1Lm] use pietc, only: u0,u1 @@ -879,6 +901,10 @@ subroutine dl1lmf(a,b,ff) ! [L1Lm] end subroutine dl1lmf !> Modified Cholesky decompose Q --> L*D*U, U(i,j)=L(j,i) +!! +!! @param[in] a matrix +!! @param[inout] b matrix +!! @param[out] d matrix !! @author R. J. Purser subroutine sldlm(a,b,d)! [LdLm] real(sp),intent(in ):: a(:,:) @@ -889,7 +915,7 @@ subroutine sldlm(a,b,d)! [LdLm] if(ff)stop 'In sldlm; matrix singular, unable to continue' end subroutine sldlm -!> routine dldlm +!> ??? !! @author R. J. Purser subroutine dldlm(a,b,d)! [LdLm] real(dp),intent(in ):: a(:,:) @@ -901,6 +927,11 @@ subroutine dldlm(a,b,d)! [LdLm] end subroutine dldlm !> Modified Cholesky decompose Q --> L*D*U +!! +!! @param[in] a matrix +!! @param[inout] b matrix +!! @param[out] d matrix +!! @param[out] ff error flag !! @author R. J. Purser subroutine sldlmf(a,b,d,ff) ! [LDLM] use pietc_s, only: u0,u1 @@ -933,6 +964,11 @@ subroutine sldlmf(a,b,d,ff) ! [LDLM] end subroutine sldlmf !> Modified Cholesky Q --> L*D*U, U(i,j)=L(j,i) +!! +!! @param[in] a matrix +!! @param[inout] b matrix +!! @param[out] d matrix +!! @param[out] ff error flag !! @author R. J. Purser subroutine dldlmf(a,b,d,ff) ! [LDLM] use pietc, only: u0,u1 @@ -965,14 +1001,14 @@ end subroutine dldlmf !> Invert the upper triangular matrix in place by transposing, calling !! invl, and transposing again. !! -!! @param a upper triangular matrix +!! @param[inout] a matrix !! @author R. J. Purser subroutine sinvu(a)! [invu] real(sp),dimension(:,:),intent(inout):: a a=transpose(a); call sinvl(a); a=transpose(a) end subroutine sinvu -!> routine dinvu +!> ??? !! @author R. J. Purser subroutine dinvu(a)! [invu] real(dp),dimension(:,:),intent(inout):: a @@ -980,6 +1016,8 @@ subroutine dinvu(a)! [invu] end subroutine dinvu !> Invert lower triangular matrix in place +!! +!! @param[inout] a matrix !! @author R. J. Purser subroutine sinvl(a)! [invl] use pietc_s, only: u0,u1 @@ -995,7 +1033,7 @@ subroutine sinvl(a)! [invl] enddo end subroutine sinvl -!> routine dinvl +!> ??? !! @author R. J. Purser subroutine dinvl(a)! [invl] use pietc, only: u0,u1 @@ -1012,6 +1050,9 @@ subroutine dinvl(a)! [invl] end subroutine dinvl !> Solve linear system involving lower triangular system matrix. +!! +!! @param[in] a matrix +!! @param[inout] u matrix !! @author R. J. Purser subroutine slinlv(a,u)! [invl] real(sp),intent(in ) :: a(:,:) @@ -1022,7 +1063,7 @@ subroutine slinlv(a,u)! [invl] do i=1,size(u); u(i)=(u(i) - sum(u(:i-1)*a(i,:i-1)))/a(i,i); enddo end subroutine slinlv -!> routine dlinlv +!> ??? !! @author R. J. Purser subroutine dlinlv(a,u)! [invl] real(dp),intent(in ) :: a(:,:) @@ -1034,6 +1075,9 @@ subroutine dlinlv(a,u)! [invl] end subroutine dlinlv !> Solve linear system involving upper triangular system matrix. +!! +!! @param[in] a matrix +!! @param[inout] u matrix !! @author R. J. Purser subroutine slinuv(a,u)! [invu] real(sp),intent(in ) :: a(:,:) @@ -1044,7 +1088,7 @@ subroutine slinuv(a,u)! [invu] do i=size(u),1,-1; u(i)=(u(i) - sum(a(i+1:,i)*u(i+1:)))/a(i,i); enddo end subroutine slinuv -!> routine dlinuv +!> ??? !! @author R. J. Purser subroutine dlinuv(a,u)! [invu] real(dp), intent(in ) :: a(:,:) From da3a69770a9784a040678c98da6fdd834787d293 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Fri, 5 Mar 2021 06:35:19 -0700 Subject: [PATCH 5/6] fixed doxygen warnings --- .../regional_esg_grid.fd/pmat.f90 | 135 +++++++++++++++--- 1 file changed, 114 insertions(+), 21 deletions(-) diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 index 0cfeaac86..f099f7bc1 100644 --- a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 @@ -1,8 +1,10 @@ !> @file !! @brief Utility routines for various linear inversions and Cholesky. !! +!! @author R. J. Purser, NOAA/NCEP/EMC, Tsukasa Fujita, JMA. + !! Utility routines for various linear inversions and Cholesky. -!! Dependency: modules pkind, pietc +!! !! Originally, these routines were copies of the purely "inversion" members !! of pmat1.f90 (a most extensive collection of matrix routines -- not just !! inversions). As well as having both single and double precision versions @@ -14,11 +16,6 @@ !! In Sep 2012, these routines were collected together into pmat.f90 so !! that all the main matrix routines could be in the same library, pmat.a. !! -!! DIRECT DEPENDENCIES: -!! Modules: pkind, pietc -!! @author R. J. Purser, NOAA/NCEP/EMC, Tsukasa Fujita, JMA. - -!> Utility routines interface module !! @author R. J. Purser module pmat use pkind, only: spi,sp,dp,spc,dpc @@ -80,7 +77,6 @@ end subroutine cswpvv !> Invert matrix !! !! @param[inout] a matrix -!! @param ff error flag !! @author R. J. Purser subroutine sinvmt(a)! [inv] real(sp),dimension(:,:),intent(INOUT):: a @@ -89,10 +85,9 @@ subroutine sinvmt(a)! [inv] if(ff)stop 'In sinvmt; Unable to invert matrix' end subroutine sinvmt -!> Invert matrix +!> Invert matrix. !! !! @param[inout] a matrix -!! @param ff error flag !! @author R. J. Purser subroutine dinvmt(a)! [inv] real(dp),dimension(:,:),intent(inout):: a @@ -104,7 +99,6 @@ end subroutine dinvmt !> Invert matrix !! !! @param[inout] a matrix -!! @param ff error flag !! @author R. J. Purser subroutine cinvmt(a)! [inv] complex(dpc),dimension(:,:),intent(inout):: a @@ -154,7 +148,7 @@ end subroutine sinvmtf !> Routine dinvmtf to Invert and Permute !! !! @param[inout] a matrix -!! @param ff[out] flag for error condition +!! @param[out] ff flag for error condition !! @author R. J. Purser subroutine dinvmtf(a,ff)! [inv] real(dp),dimension(:,:),intent(inout):: a @@ -190,8 +184,8 @@ end subroutine dinvmtf !> Routine cinvmtf to Invert and Permute !! -!! @param a[inout] matrix -!! @param ff[out] flag for error condition +!! @param[inout] a matrix +!! @param[out] ff flag for error condition !! @author R. J. Purser subroutine cinvmtf(a,ff)! [inv] use pietc, only: c1 @@ -227,6 +221,9 @@ subroutine cinvmtf(a,ff)! [inv] end subroutine cinvmtf !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? !! @author R. J. Purser subroutine slinmmt(a,b)! [inv] real(sp),dimension(:,:),intent(inout):: a,b @@ -236,6 +233,9 @@ subroutine slinmmt(a,b)! [inv] end subroutine slinmmt !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? !! @author R. J. Purser subroutine dlinmmt(a,b)! [inv] real(dp),dimension(:,:),intent(inout):: a,b @@ -245,6 +245,9 @@ subroutine dlinmmt(a,b)! [inv] end subroutine dlinmmt !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? !! @author R. J. Purser subroutine clinmmt(a,b)! [inv] complex(dpc),dimension(:,:),intent(inout):: a,b @@ -254,6 +257,10 @@ subroutine clinmmt(a,b)! [inv] end subroutine clinmmt !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? +!! @param[out] ff failure flag !! @author R. J. Purser subroutine slinmmtf(a,b,ff)! [inv] real(sp), dimension(:,:),intent(inout):: a,b @@ -274,6 +281,10 @@ subroutine slinmmtf(a,b,ff)! [inv] end subroutine slinmmtf !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? +!! @param[out] ff failure flag !! @author R. J. Purser subroutine dlinmmtf(a,b,ff)! [inv] real(dp),dimension(:,:), intent(inout):: a,b @@ -294,6 +305,10 @@ subroutine dlinmmtf(a,b,ff)! [inv] end subroutine dlinmmtf !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? +!! @param[out] ff failure flag !! @author R. J. Purser subroutine clinmmtf(a,b,ff)! [inv] complex(dpc),dimension(:,:),intent(INOUT):: a,b @@ -314,6 +329,9 @@ subroutine clinmmtf(a,b,ff)! [inv] end subroutine clinmmtf !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? !! @author R. J. Purser subroutine slinmvt(a,b)! [inv] real(sp),dimension(:,:),intent(inout):: a @@ -324,6 +342,9 @@ subroutine slinmvt(a,b)! [inv] end subroutine slinmvt !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? !! @author R. J. Purser subroutine dlinmvt(a,b)! [inv] real(dp),dimension(:,:),intent(inout):: a @@ -334,6 +355,9 @@ subroutine dlinmvt(a,b)! [inv] end subroutine dlinmvt !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? !! @author R. J. Purser subroutine clinmvt(a,b)! [inv] complex(dpc), dimension(:,:),intent(inout):: a @@ -344,6 +368,10 @@ subroutine clinmvt(a,b)! [inv] end subroutine clinmvt !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? +!! @param[out] ff failure flag !! @author R. J. Purser subroutine slinmvtf(a,b,ff)! [inv] real(sp),dimension(:,:),intent(inout):: a @@ -362,6 +390,10 @@ subroutine slinmvtf(a,b,ff)! [inv] end subroutine slinmvtf !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? +!! @param[out] ff failure flag !! @author R. J. Purser subroutine dlinmvtf(a,b,ff)! [inv] real(dp),dimension(:,:),intent(inout):: a @@ -380,6 +412,10 @@ subroutine dlinmvtf(a,b,ff)! [inv] end subroutine dlinmvtf !> ??? +!! +!! @param[inout] a ??? +!! @param[inout] b ??? +!! @param[out] ff failure flag !! @author R. J. Purser subroutine clinmvtf(a,b,ff)! [inv] complex(dpc),dimension(:,:),intent(inout):: a @@ -400,8 +436,8 @@ end subroutine clinmvtf !> Invert integer square array, imat, if possible, but flag ff=.true. !! if not possible. (Determinant of imat must be +1 or -1 !! -!! @param imat[inout] integer square array -!! @param ff[out] error flag +!! @param[inout] imat integer square array +!! @param[out] ff error flag !! @author R. J. Purser subroutine iinvf(imat,ff)! [inv] integer(spi),dimension(:,:),intent(INOUT):: imat @@ -422,6 +458,10 @@ subroutine iinvf(imat,ff)! [inv] end subroutine iinvf !> ??? +!! +!! @param[inout] a ??? +!! @param[out] d ??? +!! @param[out] ipiv ??? !! @author R. J. Purser subroutine sldum(a,ipiv,d)! [ldum] real(sp), intent(inout) :: a(:,:) @@ -433,6 +473,10 @@ subroutine sldum(a,ipiv,d)! [ldum] end subroutine sldum !> ??? +!! +!! @param[inout] a ??? +!! @param[out] d ??? +!! @param[out] ipiv ??? !! @author R. J. Purser subroutine dldum(a,ipiv,d)! [ldum] real(dp), intent(inout) :: a(:,:) @@ -444,6 +488,10 @@ subroutine dldum(a,ipiv,d)! [ldum] end subroutine dldum !> ??? +!! +!! @param[inout] a ??? +!! @param[out] d ??? +!! @param[out] ipiv ??? !! @author R. J. Purser subroutine cldum(a,ipiv,d)! [ldum] complex(dpc),intent(inout) :: a(:,:) @@ -522,6 +570,11 @@ subroutine sldumf(a,ipiv,d,ff)! [ldum] end subroutine sldumf !> ??? +!! +!! @param[inout] a square matrix to be factorized +!! @param[out] ipiv array encoding the pivoting sequence +!! @param[out] d indicator for possible sign change of determinant +!! @param[out] ff: failure flag, set to .true. when determinant of a vanishes. !! @author R. J. Purser subroutine dldumf(a,ipiv,d,ff)! [ldum] use pietc, only: u0,u1 @@ -583,6 +636,11 @@ subroutine dldumf(a,ipiv,d,ff)! [ldum] end subroutine dldumf !> ??? +!! +!! @param[inout] a square matrix to be factorized +!! @param[out] ipiv array encoding the pivoting sequence +!! @param[out] d indicator for possible sign change of determinant +!! @param[out] ff: failure flag, set to .true. when determinant of a vanishes. !! @author R. J. Purser subroutine cldumf(a,ipiv,d,ff)! [ldum] use pietc, only: u0,u1,c0,c1 @@ -648,9 +706,9 @@ end subroutine cldumf !> Use l-u factors in A to back-substitute for several rhs in B, using ipiv to !! define the pivoting permutation used in the l-u decomposition. !! -!! @param[in] A L-D-U factorization of linear system matrux -!! @param[inout] B rt-hand-sides vectors on input, corresponding solutions on return -!! @param[in] IPIV array encoding the pivoting sequence +!! @param[in] a L-D-U factorization of linear system matrux +!! @param[inout] b rt-hand-sides vectors on input, corresponding solutions on return +!! @param[in] ipiv array encoding the pivoting sequence !! @author R. J. Purser subroutine sudlmm(a,b,ipiv)! [udlmm] use pietc_s, only: u1 @@ -678,6 +736,10 @@ subroutine sudlmm(a,b,ipiv)! [udlmm] end subroutine sudlmm !> ??? +!! +!! @param[in] a square matrix to be factorized +!! @param[inout] b ??? +!! @param[in] ipiv array encoding the pivoting sequence !! @author R. J. Purser subroutine dudlmm(a,b,ipiv)! [udlmm] use pietc, only: u1 @@ -705,6 +767,10 @@ subroutine dudlmm(a,b,ipiv)! [udlmm] end subroutine dudlmm !> ??? +!! +!! @param[in] a square matrix to be factorized +!! @param[inout] b ??? +!! @param[in] ipiv array encoding the pivoting sequence !! @author R. J. Purser subroutine cudlmm(a,b,ipiv)! [udlmm] use pietc, only: c1 @@ -734,9 +800,9 @@ end subroutine cudlmm !> Use l-u factors in A to back-substitute for 1 rhs in B, using ipiv to !! define the pivoting permutation used in the l-u decomposition. !! -!! @param[in] A L-D-U factorization of linear system matrix -!! @param[inout] B right-hand-side vector on input, corresponding solution on return -!! @param[in] IPIV array encoding the pivoting sequence +!! @param[in] a L-D-U factorization of linear system matrix +!! @param[inout] b right-hand-side vector on input, corresponding solution on return +!! @param[in] ipiv array encoding the pivoting sequence !! @author R. J. Purser subroutine sudlmv(a,b,ipiv)! [udlmv] use pietc_s, only: u1 @@ -762,6 +828,10 @@ subroutine sudlmv(a,b,ipiv)! [udlmv] end subroutine sudlmv !> ??? +!! +!! @param[in] a square matrix to be factorized +!! @param[inout] b ??? +!! @param[in] ipiv array encoding the pivoting sequence !! @author R. J. Purser subroutine dudlmv(a,b,ipiv)! [udlmv] use pietc, only: u1 @@ -787,6 +857,10 @@ subroutine dudlmv(a,b,ipiv)! [udlmv] end subroutine dudlmv !> ??? +!! +!! @param[in] a square matrix to be factorized +!! @param[inout] b ??? +!! @param[in] ipiv array encoding the pivoting sequence !! @author R. J. Purser subroutine cudlmv(a,b,ipiv)! [udlmv] use pietc, only: c1 @@ -841,6 +915,7 @@ end subroutine dl1lm !! !! @param[in] a matrix !! @param[inout] b matrix +!! @param[out] ff failure flag !! @author R. J. Purser subroutine sl1lmf(a,b,ff)! [L1Lm] use pietc_s, only: u0 @@ -871,6 +946,10 @@ subroutine sl1lmf(a,b,ff)! [L1Lm] end subroutine sl1lmf !> ??? +!! +!! @param[in] a matrix +!! @param[inout] b matrix +!! @param[out] ff failure flag !! @author R. J. Purser subroutine dl1lmf(a,b,ff) ! [L1Lm] use pietc, only: u0,u1 @@ -916,6 +995,10 @@ subroutine sldlm(a,b,d)! [LdLm] end subroutine sldlm !> ??? +!! +!! @param[in] a matrix +!! @param[inout] b matrix +!! @param[out] d matrix !! @author R. J. Purser subroutine dldlm(a,b,d)! [LdLm] real(dp),intent(in ):: a(:,:) @@ -1009,6 +1092,8 @@ subroutine sinvu(a)! [invu] end subroutine sinvu !> ??? +!! +!! @param[inout] a matrix !! @author R. J. Purser subroutine dinvu(a)! [invu] real(dp),dimension(:,:),intent(inout):: a @@ -1034,6 +1119,8 @@ subroutine sinvl(a)! [invl] end subroutine sinvl !> ??? +!! +!! @param[inout] a matrix !! @author R. J. Purser subroutine dinvl(a)! [invl] use pietc, only: u0,u1 @@ -1064,6 +1151,9 @@ subroutine slinlv(a,u)! [invl] end subroutine slinlv !> ??? +!! +!! @param[in] a matrix +!! @param[inout] u matrix !! @author R. J. Purser subroutine dlinlv(a,u)! [invl] real(dp),intent(in ) :: a(:,:) @@ -1089,6 +1179,9 @@ subroutine slinuv(a,u)! [invu] end subroutine slinuv !> ??? +!! +!! @param[in] a matrix +!! @param[inout] u matrix !! @author R. J. Purser subroutine dlinuv(a,u)! [invu] real(dp), intent(in ) :: a(:,:) From 105b14678d18425fa3ae0cf34d02d9eda3e23397 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Fri, 5 Mar 2021 06:38:08 -0700 Subject: [PATCH 6/6] punctuation --- .../regional_esg_grid.fd/pmat.f90 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 index f099f7bc1..503c90dc4 100644 --- a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 @@ -96,7 +96,7 @@ subroutine dinvmt(a)! [inv] if(ff)stop 'In dinvmt; Unable to invert matrix' end subroutine dinvmt -!> Invert matrix +!> Invert matrix. !! !! @param[inout] a matrix !! @author R. J. Purser @@ -107,7 +107,7 @@ subroutine cinvmt(a)! [inv] if(ff)stop 'In cinvmt; Unable to invert matrix' end subroutine cinvmt -!> Invert matrix (or flag if can't) +!> Invert matrix (or flag if can't). !! !! @param[inout] a matrix !! @param[out] ff flag for error condition @@ -145,7 +145,7 @@ subroutine sinvmtf(a,ff)! [inv] do j=m-1,1,-1; l=ipiv(j); call sswpvv(a(:,j),a(:,l)); enddo end subroutine sinvmtf -!> Routine dinvmtf to Invert and Permute +!> Routine dinvmtf to Invert and Permute. !! !! @param[inout] a matrix !! @param[out] ff flag for error condition @@ -182,7 +182,7 @@ subroutine dinvmtf(a,ff)! [inv] do j=m-1,1,-1; l=ipiv(j); call dswpvv(a(:,j),a(:,l)); enddo end subroutine dinvmtf -!> Routine cinvmtf to Invert and Permute +!> Routine cinvmtf to Invert and Permute. !! !! @param[inout] a matrix !! @param[out] ff flag for error condition @@ -703,11 +703,13 @@ subroutine cldumf(a,ipiv,d,ff)! [ldum] enddo end subroutine cldumf -!> Use l-u factors in A to back-substitute for several rhs in B, using ipiv to -!! define the pivoting permutation used in the l-u decomposition. +!> Use l-u factors in A to back-substitute for several rhs in B, using +!! ipiv to define the pivoting permutation used in the l-u +!! decomposition. !! !! @param[in] a L-D-U factorization of linear system matrux -!! @param[inout] b rt-hand-sides vectors on input, corresponding solutions on return +!! @param[inout] b rt-hand-sides vectors on input, corresponding +!! solutions on return !! @param[in] ipiv array encoding the pivoting sequence !! @author R. J. Purser subroutine sudlmm(a,b,ipiv)! [udlmm] @@ -1100,7 +1102,7 @@ subroutine dinvu(a)! [invu] a=transpose(a); call dinvl(a); a=transpose(a) end subroutine dinvu -!> Invert lower triangular matrix in place +!> Invert lower triangular matrix in place. !! !! @param[inout] a matrix !! @author R. J. Purser