program test_matinv use fvn implicit none integer(4), parameter :: n=3 integer(4) :: status,i complex(8),dimension(n,n) :: m,im,prod real(8),dimension(n,n) :: rtmp,itmp character(len=80) :: fmreal,fmcmplx fmcmplx='(3("(",f8.5,",",f8.5,") "))' ! initialize pseudo random generator call init_random_seed() ! fill real and imaginary part call random_number(rtmp) call random_number(itmp) ! create the complex matrix (fvn_i is defined in the fvn module) m=rtmp+fvn_i*itmp write(*,*) "Matrix M" do i=1,n write(*,fmcmplx) m(i,:) end do ! Invertion call fvn_matinv(n,m,im) write(*,*) "Inverse of M" do i=1,n write(*,fmcmplx) im(i,:) end do ! Result should be identity matrix write(*,*) "Product of M and inverse of M :" prod=matmul(m,im) do i=1,n write (*,fmcmplx) prod(i,:) end do end program