# Does anyone know about matrix inversion subroutines?

I want to invert the matrix WIJGUU. I have defined COMPLEX * 16 WIJGUU (NK/2, NK/2) and opened the file. As far as I know, the former subprogram is LU decomposition, and the latter subprogram is inversion. The two subprograms are used together. When I run, the operation always goes directly to 100, As a result, the data I calculated later cannot be written to my open file (100 is the endpoint of my do loop, and my subsequent operations must be within the loop and cannot be moved to write above 100). These two sentences were imitated by me based on other programs, and I donβt know why it can write the data to the file. I canβt write them to the file? What do the meanings of INFO1 and INFO2 in IF (INFO1. NE. 0) and IF (INFO2. NE. 0) mean?

``````    CALL ZGETRF( M/2, N/2, WIJGUU, LDA/2, IPIVW, INFO1 )
IF(INFO1.NE.0) GOTO 100
CALL ZGETRI( N/2, WIJGUU, LDA/2, IPIVW, WORKW, LWORK/2, INFO2 )
IF(INFO2.NE.0) GOTO 100
``````

γγγγγγγγγγγγγγγγγγγγγγγ
IF (NS.EQ.1)WRITE(20,555)EE0(L),DOSU(L),DOSD(L)
100 CONTINUE

From the LAPACK documentation (zgetrf):

``````          INFO is INTEGER
= 0:  successful exit
< 0:  if INFO = -i, the i-th argument had an illegal value
> 0:  if INFO = i, U(i,i) is exactly zero. The factorization
has been completed, but the factor U is exactly
singular, and division by zero will occur if it is used
to solve a system of equations.
``````

1 Like

You can replace

``````IF(INFO1.NE.0) GOTO 100
``````

by

``````if (info1 .ne. 0) then
print *, 'ZGETRF call failed, INFO1 = ', info1
go to 100
endif
``````

You may add corresponding code after the call to ZGETRI.

After running the modified program, you will know which call failed, and you can use the value of INFO1/INFO2 to look up the ZGETRF/ZGETRI documentation for the meaning of the error number returned in INFO1 or INFO2, as appropriate.

1 Like