      DOUBLE PRECISION FUNCTION SPDOT (N,X,INDEX,Y)
      INTEGER N, INDEX(*)
      DOUBLE PRECISION X(*), Y(*)
      INTEGER I, II
      SPDOT = 0.0D0
      DO 100 I=1,N
         II = INDEX(I)
         SPDOT = SPDOT + X(II)*Y(I)
 100  CONTINUE
      RETURN
      END
