C$TEST SDBA
C TO RUN AS A MAIN PROGRAM REMOVE NEXT LINE
      SUBROUTINE SDBA
C***********************************************************************
C
C  EXAMPLE OF USE OF THE PORT PROGRAM DL2SF
C
C***********************************************************************
      INTEGER I,I1MACH,IWRITE,K,N,NT
      REAL X(51),Y(51),T(100),A(100),
     1 XCHECK(101),YCHECK(101,2),ERR(2)
C
      K = 4
C
C MAKE THE ABSCISSAE FOR THE FIT.
C
      CALL UMD(0.0E0,3.14E0,51,X)
C
C MAKE THE DATA.
C
      DO 1000 I = 1, 51
      Y(I) = SIN(X(I))
 1000 CONTINUE
C
C MAKE THE CHECK POINTS
C
      CALL UMD(X(1),X(51),101,XCHECK)
C
C MAKE THE MESH.
C
      N = 2
C
      CALL MNPB(X,51,N,K,T,NT)
C
C DO THE FIT.
C
      CALL DL2SF(X,Y,51,K,T,NT,A)
C
C EVALUATE THE ERROR IN THE FIT AND ITS DERIVATIVES
C AT THE CHECK POINTS
C
      CALL SPLND(K,T,NT,A,XCHECK,101,2,YCHECK)
C
      CALL SETR(2,0.0E0,ERR)
      DO 1001 I = 1, 101
      ERR(1) = AMAX1(ERR(1),ABS(YCHECK(I,1)-SIN(XCHECK(I))))
      ERR(2) = AMAX1(ERR(2),ABS(YCHECK(I,2)-COS(XCHECK(I))))
 1001 CONTINUE
C
      IWRITE = I1MACH(2)
      WRITE(IWRITE,1006) ERR(1),ERR(2)
 1006 FORMAT(9H ERROR = ,2E10.2)
C
      STOP
C
      END
