help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inverse matrix problem (with LAPACK maybe....)


From: Minkyung Kersti Son
Subject: Re: Inverse matrix problem (with LAPACK maybe....)
Date: Sun, 21 Aug 2011 18:03:13 -0700 (PDT)

Thank you very much!^^
I think that the condition of this matrix is very ill
because this code works well for other matrix.

       implicit none
       integer i, j
       integer,parameter :: n=19
       complex mat(n,n)
       complex,dimension(n,n) :: matA, matAinv, matI
       real dum1, dum2

       integer ipiv(n)
       integer info
       integer,parameter :: lwork=64*n
       complex work(lwork)
       external cgetrf, cgetri

       mat=cmplx(0.,0.)
       open(10,file='gauss.txt')
       do i=1,n
         do j=1,n
           read(10,*) dum1, dum2
           mat(i,j)=cmplx(dum1,dum2)
           matA(i,j)=mat(i,j)
         end do
       end do
       close(10)

       call cgetrf(n,n,mat,n,ipiv,info)

       if (info==0)then
         call cgetri(n,mat,n,ipiv,work,lwork,info)
       else
         print*, 'info=/0'
       end if

       do i=1,n
       do j=1,n
       matAinv(i,j)=mat(i,j)
       end do
       end do

       matI=matmul(matA,matAinv)

       do i=1,n
         do j=1,n
           print*, i, j, matI(i,j)
         end do
       end do

       end program


'gauss.txt' is what I attached above.

I've tried to solve this problem with changing to cgetrf(cgetri) to others:
chetrf(chetri), csytrf(csytri..).

--
View this message in context: 
http://octave.1599824.n4.nabble.com/Inverse-matrix-problem-with-LAPACK-maybe-tp3754862p3759214.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]