* Last processed by NICE on 12-Jun-2000 15:53:00
* Customized for :  IEEE, LINUX, UNIX, MOTIF, F77
      SUBROUTINE AMTINV(CMAT,NPAR)
C----------------------------------------------------------------------
C POINT
C 	Matrix inversion through Gauss maximum pivot
C	Dimensionned for size MVAR, MVAR
C J.Cernicharo, S.Guilloteau
C----------------------------------------------------------------------
      INCLUDE 'size.inc'
      INTEGER NPAR
      REAL*8 CMAT(MVAR,MVAR)
      REAL*8 AMAT(MVAR,MVAR+1),RESOL(MVAR),AMAX
      INTEGER J,L
*
      IF (NPAR.EQ.1) THEN
         CMAT(1,1)=1./CMAT(1,1)
         RETURN
      ENDIF
      AMAX=-1.0D10
      DO J=1,NPAR
         DO L=1,NPAR
            AMAX = MAX(CMAT(J,L),AMAX)
         ENDDO
      ENDDO
      DO J=1,NPAR
         DO L=1,NPAR
            AMAT(J,L)=CMAT(J,L)/AMAX
         ENDDO
      ENDDO
      DO J=1,NPAR+1
         DO L=1,NPAR
            AMAT(L,NPAR+1)=0.0D0
         ENDDO
         AMAT(J,NPAR+1)=1.0D0
         CALL GAUSS(AMAT,RESOL,NPAR)
         DO L=1,NPAR
            CMAT(L,J)=RESOL(L)/AMAX
         ENDDO
      ENDDO
      END
