This routine is an approximate matrix inverter and would be replaced by PDA_DGEFA followed by PDA_DGEDI. The NAG code might look like
INTEGER IA, N, IX, IFAIL
DOUBLE PRECISION A(IA,N), X(IX,N), WORK(N)
IFAIL = 1
CALL F01AAF( A, IA, N, X, IX, WORK, IFAIL )
IF ( IFAIL .NE. 0 ) THEN
An error has occurred
END IF
The SLATEC routines invert the matrix in situ, so A must be copied to X first. It is important that PDA_DGEDI be called only if PDA_DGEFA signals correct processing as IFAIL = 0. Otherwise PDA_DGEDI will encounter a division by zero. The last argument to PDA_DGEDI determines the returned information, 1 chooses inverted matrix but no determinant.
INTEGER I, J, IA, N, IX, IFAIL
INTEGER IPVT(N)
DOUBLE PRECISION A(IA,N), X(IX,N), WORK(N), DUMMY(2)
DO 2 J = 1, N
DO 1 I = 1, N
X(I,J) = A(I,J)
1 CONTINUE
2 CONTINUE
CALL PDA_DGEFA( X, IX, N, IPVT, IFAIL )
IF ( IFAIL .NE. 0 ) THEN
An error has occurred
ELSE
CALL PDA_DGEDI( X, IX, N, IPVT, DUMMY, WORK, 1 )
END IF
PDA [1ex