My real data is first input but inverse of result is so big. They are same data when you compare with first and second input. There is only difference decimal size. Why is there different result? Because they are same data. How can they have different result? You can see result and input. It is so strange.
program test
Implicit none
double precision,allocatable,dimension(:,:) :: A
double precision,allocatable,dimension(:) :: WORK
integer ,allocatable,dimension(:) :: ipiv
integer :: n,info,M
external DGETRF,DGETRI
M=8
allocate(A(M,M),WORK(M),IPIV(M))
!!! First Input !!!!
A(1,:)=(/3.740486048842566D-4, 0.0D0, 0.0D0, 4.987315029057229D-5, 0.0D0, 0.0D0, 0.0D0, 0.0D0/)
A(2,:)=(/0.0D0 , 3.740486048842566D-4, 0.0D0, 0.0D0, 4.987315029057229D-5 ,0.0D0 ,0.0D0 ,0.0D0 /)
A(3,:)=(/0.0D0 , 0.0D0 ,3.740486048842566D-4, 0.0D0 ,0.0D0, 4.987315029057229D-5, 0.0D0 ,0.0D0/)
A(4,:)=(/4.987315029057229D-5 ,0.0D0 ,0.0D0 ,6.649753768432517D-6, 0.0D0 ,0.0D0, 0.0D0, 0.0D0 /)
A(5,:)=(/0.0D0 , 4.987315029057229D-5, 0.0D0, 0.0D0 ,6.649753768432517D-6 ,0.0D0 ,0.0D0 ,0.0D0 /)
A(6,:)=(/0.0D0, 0.0D0, 4.987315029057229D-5, 0.0D0 ,0.0D0, 6.649753768432517D-6, 0.0D0 ,0.0D0 /)
A(7,:)=(/0.0D0, 0.0D0 ,0.0D0, 0.0D0 ,0.0D0 ,0.0D0 ,1.499999910593033D-11, 0.0D0 /)
A(8,:)=(/0.0D0 ,0.0D0 ,0.0D0 ,0.0D0 ,0.0D0 ,0.0D0, 0.0D0 ,1.499999910593033D-11 /)
!!!! Second Input !!!!
!A(1,:)=(/3.74D-4, 0.0D0, 0.0D0, 4.98D-5, 0.0D0, 0.0D0, 0.0D0, 0.0D0/)
!A(2,:)=(/0.0D0 , 3.74D-4, 0.0D0, 0.0D0, 4.98D-5 ,0.0D0 ,0.0D0 ,0.0D0 /)
!A(3,:)=(/0.0D0 , 0.0D0 ,3.74D-4, 0.0D0 ,0.0D0, 4.98D-5, 0.0D0 ,0.0D0/)
!A(4,:)=(/4.98D-5 ,0.0D0 ,0.0D0 ,6.64D-6, 0.0D0 ,0.0D0, 0.0D0, 0.0D0 /)
!A(5,:)=(/0.0D0 , 4.98D-5, 0.0D0, 0.0D0 ,6.64D-6 ,0.0D0 ,0.0D0 ,0.0D0 /)
!A(6,:)=(/0.0D0, 0.0D0, 4.98D-5, 0.0D0 ,0.0D0, 6.64D-6, 0.0D0 ,0.0D0 /)
!A(7,:)=(/0.0D0, 0.0D0 ,0.0D0, 0.0D0 ,0.0D0 ,0.0D0 ,1.49D-11, 0.0D0 /)
!A(8,:)=(/0.0D0 ,0.0D0 ,0.0D0 ,0.0D0 ,0.0D0 ,0.0D0, 0.0D0 ,1.49D-11 /)
call DGETRF(M,M,A,M,IPIV,info)
if(info .eq. 0) then
Print *,'succeded'
else
Print *,'failed'
end if
call DGETRI(M,A,M,IPIV,WORK,M,info)
if(info .eq. 0) then
Print *,'succeded'
else
Print *,'failed'
end if
Print *,A
deallocate(A,IPIV,WORK)
end
!!!!! Second Input Result
!1.0e+10 *
! 0.0002 0 0 -0.0015 0 0 0 0
! 0 0.0002 0 0 -0.0015 0 0 0
! 0 0 0.0002 0 0 -0.0015 0 0
! -0.0015 0 0 0.0113 0 0 0 0
! 0 -0.0015 0 0 0.0113 0 0 0
! 0 0 -0.0015 0 0 0.0113 0 0
! 0 0 0 0 0 0 6.7114 0
! 0 0 0 0 0 0 0 6.7114
!!! First Input Result
! 1.0e+21 *
!-0.0238 0 0 0.1783 0 0 0 0
! 0 -0.0238 0 0 0.1783 0 0 0
! 0 0 0.0000 0 0 -0.0000 0 0
! 0.1783 0 0 -1.3375 0 0 0 0
! 0 0.1783 0 0 -1.3375 0 0 0
! 0 0 -0.0000 0 0 0.0000 0 0
! 0 0 0 0 0 0 0.0000 0
! 0 0 0 0 0 0 0 0.0000