# sgedi.f

          SUBROUTINE SGEDI (A, LDA, N, IPVT, DET, WORK, JOB)
    C***BEGIN PROLOGUE  SGEDI
    C***PURPOSE  Compute the determinant and inverse of a matrix using the
    C            factors computed by SGECO or SGEFA.
    C***LIBRARY   SLATEC (LINPACK)
    C***CATEGORY  D2A1, D3A1
    C***TYPE      SINGLE PRECISION (SGEDI-S, DGEDI-D, CGEDI-C)
    C***KEYWORDS  DETERMINANT, INVERSE, LINEAR ALGEBRA, LINPACK, MATRIX
    C***AUTHOR  Moler, C. B., (U. of New Mexico)
    C***DESCRIPTION
    C
    C     SGEDI computes the determinant and inverse of a matrix
    C     using the factors computed by SGECO or SGEFA.
    C
    C     On Entry
    C
    C        A       REAL(LDA, N)
    C                the output from SGECO or SGEFA.
    C
    C        LDA     INTEGER
    C                the leading dimension of the array  A .
    C
    C        N       INTEGER
    C                the order of the matrix  A .
    C
    C        IPVT    INTEGER(N)
    C                the pivot vector from SGECO or SGEFA.
    C
    C        WORK    REAL(N)
    C                work vector.  Contents destroyed.
    C
    C        JOB     INTEGER
    C                = 11   both determinant and inverse.
    C                = 01   inverse only.
    C                = 10   determinant only.
    C
    C     On Return
    C
    C        A       inverse of original matrix if requested.
    C                Otherwise unchanged.
    C
    C        DET     REAL(2)
    C                determinant of original matrix if requested.
    C                Otherwise not referenced.
    C                Determinant = DET(1) * 10.0**DET(2)
    C                with  1.0 .LE. ABS(DET(1)) .LT. 10.0
    C                or  DET(1) .EQ. 0.0 .
    C
    C     Error Condition
    C
    C        A division by zero will occur if the input factor contains
    C        a zero on the diagonal and the inverse is requested.
    C        It will not occur if the subroutines are called correctly
    C        and if SGECO has set RCOND .GT. 0.0 or SGEFA has set
    C        INFO .EQ. 0 .
    C
    C***REFERENCES  J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
    C                 Stewart, LINPACK Users' Guide, SIAM, 1979.
    C***ROUTINES CALLED  SAXPY, SSCAL, SSWAP
    C***REVISION HISTORY  (YYMMDD)
    C   780814  DATE WRITTEN
    C   890831  Modified array declarations.  (WRB)
    C   890831  REVISION DATE from Version 3.2
    C   891214  Prologue converted to Version 4.0 format.  (BAB)
    C   900326  Removed duplicate information from DESCRIPTION section.
    C           (WRB)
    C   920501  Reformatted the REFERENCES section.  (WRB)
    C***END PROLOGUE  SGEDI