      PROGRAM MAINMU
C
C     ------------------------------------------------------------
C
C     Testexample for MULCON
C
C*  Purpose           Testexample for code MULCON
C*  Version           0.9
C*  Revision          July 1985
C*  Latest Change     January 1991
C*  Library           CodeLib
C*  Code              Fortran 77, Double Precision
C*  Environment       Standard Fortran 77 environment on PC's,
C                     workstations and hosts.
C
C     ------------------------------------------------------------
C
      IMPLICIT DOUBLE PRECISION(A-H,O-Z)
      DIMENSION T(101),X(2,101),XW(2,101),INFO(9)
      DIMENSION RWORK(100000),IWORK(50000)
      EXTERNAL FTEST,JTEST,BTEST,MUDIFX
      COMMON /MUVALS/ SMALL1,THMAX,THR,ITMAX,IGNMAX
      COMMON /MUUNIT/ IPR,IDIAG
      DATA PI/3.1415 92653 58979D0/
      INTEGER IFAIL
      DOUBLE PRECISION CPTIME,CPSTR,CPEND
      IDIAG=0
      IPR=6
      N=2
      M=21
      DO 7 I=1,21
      T(I)=0.D0+DBLE(I-1)*.050D0
7     CONTINUE
      DO 1 I=1,N
      DO 1 J=1,M
      X(I,J)=0.D0
      XW(I,J)=1.D0
1     CONTINUE
      TAU=0.06D0
      TAUMIN=0.06D0
      TAUMAX=4.D0
      UMAX=1000.D0
      THMAX=1.D0
      THR=.1D0
      EPS=1.D-5
      INFO(1)=2
      INFO(2)=999
      INFO(3)=1
      INFO(4)=1
      LRWORK=100000
      LIWORK=50000
      CALL ZIBSEC(CPSTR,IFAIL)
      CALL MULCON(FTEST,JTEST,BTEST,MUDIFX,N,M,T,X,XW,TAU,TAUMIN,TAUMAX,
     &   UMAX,EPS,INFO,RWORK,LRWORK,IWORK,LIWORK)
      CALL ZIBSEC(CPEND,IFAIL)
      CPTIME=CPEND-CPSTR
      WRITE(6,100) CPTIME
100   FORMAT('0 TIME USED: ',F9.3,' SEC')
      STOP
      END
      SUBROUTINE FTEST(T,X,TAU,DX)
      IMPLICIT DOUBLE PRECISION(A-H,O-Z)
      DIMENSION X(2),DX(2)
      DX(1)=X(2)
      DX(2)=-TAU*EXP(X(1))
      RETURN
      END
      SUBROUTINE JTEST(T,X,TAU,DFDX,DFDTAU)
      IMPLICIT DOUBLE PRECISION(A-H,O-Z)
      DIMENSION X(2),DFDX(2,2),DFDTAU(2)
      DFDX(1,1)=0.D0
      DFDX(1,2)=1.D0
      DFDX(2,1)=-TAU*EXP(X(1))
      DFDX(2,2)=0.D0
      DFDTAU(1)=0.D0
      DFDTAU(2)=-EXP(X(1))
      RETURN
      END
      SUBROUTINE BTEST(XA,XB,TAU,R)
      IMPLICIT DOUBLE PRECISION(A-H,O-Z)
      DIMENSION XA(2),XB(2),R(2)
      R(1)=XA(1)
      R(2)=XB(1)
      RETURN
      END
      REAL FUNCTION SECOND(IDUMMY)
C
C     This subroutine is machine dependent. It's contents
C     may be replaced by code, which delivers the actual
C     time stamp, to get a time measurement. 
C
      SECOND=0.0E0
      RETURN
      END
