Blame view
fvn_test/test_matinv.f90
805 Bytes
27d3b84d6 git-svn-id: https... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
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 |