*     ************************************************************************

      subroutine isetvl( n, x, incx, ivl )

*     ************************************************************************

*     Purpose :
*     ---------

*     This subroutine sets the vector X to the integer constant
*     IVL by increments of INCX, and this is repeated N times.

*     Parameters :
*     ------------

*     n       ( int )

*       input  : number of components of X to set to IVL.
*       output : unmodified.

*     x       ( int )

*       input  : a vector containing the components to set
*                to the value IVL.
*       output : identical to the input value, except for the
*                components for the components 1+i*INCX
*                (i=0, ..., N-1) that are set to the value IVL.

*     incx    ( int )

*       input  : increment to consider between two successive
*                components of X to set to the value IVL.
*                If INCX is negative, then its absolute value
*                is considered.
*       output : unmodifed.

*     ivl     ( int )

*       input  : the value to assign to the selected components
*                of the vector X.
*       output : unmodified.

*     Routines used :
*     ---------------

*     None.

*     Programming :
*     -------------

*     Ph.L. Toint

*     Remarks :
*     ---------

*     This routine is written to complete blasd, and its parameter list
*     is similarly arranged.

*     ========================================================================

*     Routine parameters

      integer  x(*), incx, n, ivl

*     Internal variables

      integer  ix, m, i

      if( n.le.0 ) return

      if( incx.ne.1 ) then

        if( incx.lt.0 ) then
          ix = (- n + 1)*incx + 1
        else
          ix = 1
        endif

        do 100 i = ix , ix+(n-1)*incx , incx
          x(i) = ivl
  100   continue

      else

        m = mod(n,5)

        if( m.ne.0 ) then
          do 200 i = 1 , m
             x(i) = ivl
  200     continue
        endif

        if( n.ge.5 ) then
          ix = m + 1
          do 300 i = ix , n , 5
            x(i)   = ivl
            x(i+1) = ivl
            x(i+2) = ivl
            x(i+3) = ivl
            x(i+4) = ivl
  300     continue
        endif

      endif

      return
      end