program test_matinv use fvn_linear use Kind_Definition implicit none integer(kind=ip_kind), parameter :: n=3 integer(kind=ip_kind) :: status,i complex(kind=dp_kind),dimension(n,n) :: m,im,prod real(kind=dp_kind),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