C
C     ..................................................................
C
C        SUBROUTINE CONVT
C
C        PURPOSE
C           CONVERT NUMBERS FROM SINGLE PRECISION TO DOUBLE PRECISION
C           OR FROM DOUBLE PRECISION TO SINGLE PRECISION.
C
C        USAGE
C           CALL CONVT (N,M,MODE,S,D,MS)
C
C        DESCRIPTION OF PARAMETERS
C           N    - NUMBER OF ROWS IN MATRICES S AND D.
C           M    - NUMBER OF COLUMNS IN MATRICES S AND D.
C           MODE - CODE INDICATING TYPE OF CONVERSION
C                    1 - FROM SINGLE PRECISION TO DOUBLE PRECISION
C                    2 - FROM DOUBLE PRECISION TO SINGLE PRECISION
C           S    - IF MODE=1, THIS MATRIX CONTAINS SINGLE PRECISION
C                  NUMBERS AS INPUT.  IF MODE=2, IT CONTAINS SINGLE
C                  PRECISION NUMBERS AS OUTPUT.  THE SIZE OF MATRIX S
C                  IS N BY M.
C           D    - IF MODE=1, THIS MATRIX CONTAINS DOUBLE PRECISION
C                  NUMBERS AS OUTPUT.  IF MODE=2, IT CONTAINS DOUBLE
C                  PRECISION NUMBERS AS INPUT.  THE SIZE OF MATRIX D IS
C                  N BY M.
C           MS   - ONE DIGIT NUMBER FOR STORAGE MODE OF MATRIX
C                    0 - GENERAL
C                    1 - SYMMETRIC
C                    2 - DIAGONAL
C
C        REMARKS
C           MATRIX D CANNOT BE IN THE SAME LOCATION AS MATRIX S.
C           MATRIX D MUST BE DEFINED BY A DOUBLE PRECISION STATEMENT IN
C           THE CALLING PROGRAM.
C
C        SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C           NONE
C
C        METHOD
C           ACCORDING TO THE TYPE OF CONVERSION INDICATED IN MODE, THIS
C           SUBROUTINE COPIES NUMBERS FROM MATRIX S TO MATRIX D OR FROM
C           MATRIX D TO MATRIX S.
C
C     ..................................................................
C
      SUBROUTINE CONVT (N,M,MODE,S,D,MS)
      DIMENSION S(1),D(1)
      DOUBLE PRECISION D
C
C        FIND STORAGE MODE OF MATRIX AND NUMBER OF DATA POINTS
C
      IF(MS-1) 2, 4, 6
    2 NM=N*M
      GO TO 8
    4 NM=((N+1)*N)/2
      GO TO 8
    6 NM=N
C
C        TEST TYPE OF CONVERSION
C
    8 IF(MODE-1) 10, 10, 20
C
C        SINGLE PRECISION TO DOUBLE PRECISION
C
   10 DO 15 L=1,NM
   15 D(L)=S(L)
      GO TO 30
C
C        DOUBLE PRECISION TO SINGLE PRECISION
C
   20 DO 25 L=1,NM
   25 S(L)=D(L)
C
   30 RETURN
      END
