      SUBROUTINE TRANS31(GAMMAS,IAX,IVEC,MATRIX,NULL)
C
C ROTATE THREE ELEMENT VECTOR
C
      REAL*4 OUTVAL(3),MATRIX(3,3),GAMMAS(IAX,IVEC),NULL
C
      IF (IAX.NE.3) RETURN
C
      DO IREC = 1,IVEC
C
C ROTATE FILL-FREE VECTORS
C
       IF (GAMMAS(1,IREC).NE.NULL.AND.
     &     GAMMAS(2,IREC).NE.NULL.AND.
     &     GAMMAS(3,IREC).NE.NULL) THEN
C
C ROTATE THREE ELEMENT VECTOR
C
        OUTVAL(1) = MATRIX(1,1)*GAMMAS(1,IREC) + 
     &              MATRIX(1,2)*GAMMAS(2,IREC) + 
     &              MATRIX(1,3)*GAMMAS(3,IREC)
        OUTVAL(2) = MATRIX(2,1)*GAMMAS(1,IREC) + 
     &              MATRIX(2,2)*GAMMAS(2,IREC) + 
     &              MATRIX(2,3)*GAMMAS(3,IREC)
        OUTVAL(3) = MATRIX(3,1)*GAMMAS(1,IREC) + 
     &              MATRIX(3,2)*GAMMAS(2,IREC) + 
     &              MATRIX(3,3)*GAMMAS(3,IREC)
C
C REASSIGN ORIGINAL GAMMA COMPONENTS WITH OUTPUT VECTOR VALUES
C
        GAMMAS(1,IREC) = OUTVAL(1)
        GAMMAS(2,IREC) = OUTVAL(2)
        GAMMAS(3,IREC) = OUTVAL(3)
C
       ELSE
C
        GAMMAS(1,IREC) = NULL
        GAMMAS(2,IREC) = NULL
        GAMMAS(3,IREC) = NULL
C
       END IF
C
      END DO
C
      RETURN
      END
