C$TEST LPSJ
C***********************************************************************
C
C  EXAMPLE OF USE OF THE PORT PROGRAM BPLD
C
C***********************************************************************
       SUBROUTINE BPDET(N,MU,G,IG,DETMAN,IDETEX)
C
C THIS SUBROUTINE COMPUTES THE DETERMINANT OF A
C BAND SYMMETRIC POSITIVE DEFINITE MATRIX STORED IN G.
C IT IS GIVEN BY DETMAN*BETA**IDETEX
C WHERE BETA IS THE BASE OF THE MACHINE
C AND DETMAN IS BETWEEN 1/BETA AND 1
C
       REAL G(IG,N),DETMAN
       REAL ONOVBE,M
       INTEGER E
       INTEGER IDETEX
       CALL BPLD(N,MU,G,IG,0.0)
C
C THE DETERMINANT IS THE PRODUCT OF THE ELEMENTS OF ROW 1 OF G
C WE TRY TO COMPUTE THIS PRODUCT IN A WAY THAT WILL
C AVOID UNDERFLOW AND OVERFLOW
C
       ONOVBE=1.0/FLOAT(I1MACH(10))
       DETMAN=ONOVBE
       BETA=FLOAT(I1MACH(10))
       IDETEX=1
       DO 10 I=1,N
           CALL UMKFL(G(1,I),E,M)
           DETMAN=DETMAN*M
           IDETEX=IDETEX+E
           IF(DETMAN.GE.ONOVBE) GO TO 10
              IDETEX=IDETEX-1
              DETMAN=DETMAN*BETA
  10   CONTINUE
       RETURN
       END
