115subroutine sinvmtf(a,ff)
117real(sp),
dimension(:,:),
intent(inout):: a
118logical,
intent( out):: ff
119integer(spi) :: m,i,j,jp,l
121integer(spi),
dimension(size(a,1)):: ipiv
123if(m /=
size(a,2))stop
'In sinvmtf; matrix passed to sinvmtf is not square'
125call sldumf(a,ipiv,d,ff)
127 print
'(" In sinvmtf; failed call to sldumf")'
131do i=1,m; a(i,i)=
u1/a(i,i);
enddo
133 do j=i+1,m; a(i,j)=-a(j,j)*dot_product(a(i:j-1,j),a(i,i:j-1));
enddo
137 do i=jp,m; a(i,j)=-a(i,j)-dot_product(a(jp:i-1,j),a(i,jp:i-1));
enddo
141 do i=1,j; a(i,j)=a(i,j)+dot_product(a(jp:m,j),a(i,jp:m));
enddo
142 do i=jp,m; a(i,j)=dot_product(a(i:m,j),a(i,i:m));
enddo
145do j=m-1,1,-1; l=ipiv(j);
call sswpvv(a(:,j),a(:,l));
enddo
153subroutine dinvmtf(a,ff)
154real(dp),
dimension(:,:),
intent(inout):: a
155logical,
intent( out):: ff
156integer(spi) :: m,i,j,jp,l
158integer(spi),
dimension(size(a,1)) :: ipiv
160if(m /=
size(a,2))stop
'In inv; matrix passed to dinvmtf is not square'
162call dldumf(a,ipiv,d,ff)
164 print
'(" In dinvmtf; failed call to dldumf")'
168do i=1,m; a(i,i)=1_dp/a(i,i);
enddo
170 do j=i+1,m; a(i,j)=-a(j,j)*dot_product(a(i:j-1,j),a(i,i:j-1));
enddo
174 do i=jp,m; a(i,j)=-a(i,j)-dot_product(a(jp:i-1,j),a(i,jp:i-1));
enddo
178 do i=1,j; a(i,j)=a(i,j)+dot_product(a(jp:m,j),a(i,jp:m));
enddo
179 do i=jp,m; a(i,j)=dot_product(a(i:m,j),a(i,i:m));
enddo
182do j=m-1,1,-1; l=ipiv(j);
call dswpvv(a(:,j),a(:,l));
enddo
190subroutine cinvmtf(a,ff)
192complex(dpc),
dimension(:,:),
intent(INOUT):: a
193logical,
intent( OUT):: ff
194integer(spi) :: m,i,j,jp,l
196integer(spi),
dimension(size(a,1)):: ipiv
198if(m /=
size(a,2))stop
'In inv; matrix passed to cinvmtf is not square'
200call cldumf(a,ipiv,d,ff)
202 print
'(" In cinvmtf; failed call to cldumf")'
206do i=1,m; a(i,i)=
c1/a(i,i);
enddo
208 do j=i+1,m; a(i,j)=-a(j,j)*sum(a(i:j-1,j)*a(i,i:j-1));
enddo
212 do i=jp,m; a(i,j)=-a(i,j)-sum(a(jp:i-1,j)*a(i,jp:i-1));
enddo
216 do i=1,j; a(i,j)=a(i,j)+sum(a(jp:m,j)*a(i,jp:m));
enddo
217 do i=jp,m; a(i,j)=sum(a(i:m,j)*a(i,i:m));
enddo
220do j=m-1,1,-1; l=ipiv(j);
call cswpvv(a(:,j),a(:,l));
enddo
525subroutine sldumf(a,ipiv,d,ff)
526use pietc_s,
only: u0,u1
527real(sp),
intent(inout) :: a(:,:)
528real(sp),
intent( out) :: d
529integer(spi),
intent( out) :: ipiv(:)
530logical,
intent( out) :: ff
531integer(spi):: m,i, j, jp, ibig, jm
532real(sp) :: s(size(a,1)), aam, aa, abig, ajj, ajji, aij
542 print
'("In sldumf; row ",i6," of matrix vanishes")',i
552 abig=s(j)*abs(a(j,j))
565 call sswpvv(a(j,:),a(ibig,:))
571 print
'(" failure in sldumf:"/" matrix singular, rank=",i3)',jm
579 a(i,jp:m) = a(i,jp:m) - aij*a(j,jp:m)
592subroutine dldumf(a,ipiv,d,ff)
594real(dp),
intent(inout) :: a(:,:)
595real(dp),
intent( out) :: d
596integer,
intent( out) :: ipiv(:)
597logical(spi),
intent( out) :: ff
598integer(spi) :: m,i, j, jp, ibig, jm
599real(dp) :: s(size(a,1)), aam, aa, abig, ajj, ajji, aij
609 print
'("In dldumf; row ",i6," of matrix vanishes")',i
619 abig=s(j)*abs(a(j,j))
632 call dswpvv(a(j,:),a(ibig,:))
638 print
'(" Failure in dldumf:"/" matrix singular, rank=",i3)',jm
646 a(i,jp:m) = a(i,jp:m) - aij*a(j,jp:m)
729subroutine sudlmm(a,b,ipiv)
731integer(spi),
dimension(:),
intent(in) :: ipiv
732real(sp),
dimension(:,:),
intent(in) :: a
733real(sp),
dimension(:,:),
intent(inout) :: b
734integer(spi):: m,i, k, l
742 s = s - sum(b(1:i-1,k)*a(i,1:i-1))
748 b(i,k) = b(i,k) - sum(b(i+1:m,k)*a(i,i+1:m))
763subroutine dudlmm(a,b,ipiv)
765integer(spi),
dimension(:),
intent(in ) :: ipiv
766real(dp),
dimension(:,:),
intent(in ) :: a
767real(dp),
dimension(:,:),
intent(inout) :: b
768integer(spi):: m,i, k, l
776 s = s - sum(b(1:i-1,k)*a(i,1:i-1))
782 b(i,k) = b(i,k) - sum(b(i+1:m,k)*a(i,i+1:m))
797subroutine cudlmm(a,b,ipiv)
799integer(spi),
dimension(:),
intent(in ) :: ipiv
800complex(dpc),
dimension(:,:),
intent(in ) :: a
801complex(dpc),
dimension(:,:),
intent(inout) :: b
802integer(spi):: m,i, k, l
810 s = s - sum(b(1:i-1,k)*a(i,1:i-1))
816 b(i,k) = b(i,k) - sum(b(i+1:m,k)*a(i,i+1:m))
947subroutine sl1lmf(a,b,ff)
949real(sp),
intent(in ):: a(:,:)
950real(sp),
intent(inout):: b(:,:)
951logical,
intent( out):: ff
952integer(spi):: m,j, jm, jp, i
959 s = a(j,j) - sum(b(j,1:jm)*b(j,1:jm))
962 print
'("sL1Lmf detects nonpositive a, rank=",i6)',jm
968 s = a(i,j) - sum(b(i,1:jm)*b(j,1:jm))
981subroutine dl1lmf(a,b,ff)
983real(dp),
intent(in ) :: a(:,:)
984real(dp),
intent(inout) :: b(:,:)
985logical,
intent( out) :: ff
986integer(spi):: m,j, jm, jp, i
993 s = a(j,j) - sum(b(j,1:jm)*b(j,1:jm))
996 print
'("dL1LMF detects nonpositive A, rank=",i6)',jm
1002 s = a(i,j) - sum(b(i,1:jm)*b(j,1:jm))
1046subroutine sldlmf(a,b,d,ff)
1047use pietc_s,
only: u0,u1
1048real(sp),
intent(in ):: a(:,:)
1049real(sp),
intent(inout):: b(:,:)
1050real(sp),
intent( out):: d(:)
1051logical,
intent( out):: ff
1052integer(spi):: m,j, jm, jp, i
1059 d(j)=a(j,j) - sum(b(1:jm,j)*b(j,1:jm))
1063 print
'("In sldlmf; singularity of matrix detected")'
1064 print
'("Rank of matrix: ",i6)',jm
1069 b(j,i)=a(i,j) - dot_product(b(1:jm,j),b(i,1:jm))
1083subroutine dldlmf(a,b,d,ff)
1085real(dp),
intent(IN ) :: a(:,:)
1086real(dp),
intent(INOUT) :: b(:,:)
1087real(dp),
intent( OUT) :: d(:)
1088logical,
intent( OUT) :: ff
1089integer(spi):: m,j, jm, jp, i
1093do j=1,m; jm=j-1; jp=j+1
1094 d(j)=a(j,j) - sum(b(1:jm,j)*b(j,1:jm))
1098 print
'("In dldlmf; singularity of matrix detected")'
1099 print
'("Rank of matrix: ",i6)',jm
1104 b(j,i)=a(i,j) - dot_product(b(1:jm,j),b(i,1:jm))