      SUBROUTINE MVMGRC( TRANS, N, M, X, LDX, Y, LDY )
*     ..
*     .. Scalar Arguments ..
      INTEGER            LDY, LDX, M, N, TRANS
*     ..
*     .. Array Arguments ..
      DOUBLE PRECISION   Y( LDY, * ), X( LDX, * )
*     ..
*
*  Purpose
*  =======
*
*  Compute
*
*               Y(:,1:M) = op(A)*X(:,1:M)
*
*  where op(A) is A or A' (the transpose of A). The A is the Grcar 
*  matrix.
*
*  Arguments
*  =========
*
*  TRANS   (input) INTEGER
*          If TRANS = 0, compute Y(:,1:M) = A*X(:,1:M) 
*          If TRANS = 1, compute Y(:,1:M) = A'*X(:,1:M) 
*           
*  N       (input) INTEGER
*          The order of the matrix A. N has to be an even number.
*
*  M       (input) INTEGERS
*          The number of columns of X to multiply.
*
*  X       (input) DOUBLE PRECISION array, dimension ( LDX, M )
*          X contains the matrix (vectors) X.
*
*  LDX     (input) INTEGER
*          The leading dimension of array X, LDX >= max( 1, N ) 
*
*  Y       (output) DOUBLE PRECISION array, dimension (LDY, M )
*          contains the product of the matrix op(A) with X.
*
*  LDY     (input) INTEGER
*          The leading dimension of array Y, LDY >= max( 1, N ) 
*
*  ===================================================================
*
*     .. Local Variables .. 
      INTEGER            I, K 
*
      IF ( TRANS.EQ.0 ) THEN 
*
*	 Compute Y(:,1:M) = A*X(:,1:M)

         DO 20 K = 1,M
            Y( 1, K ) = X( 1, K ) + X( 2, K ) +X( 3, K ) + X( 4, K )
	    DO 10 I = 2,N-3   
	       Y( I, K ) = -X( I-1, K ) + X( I, K ) + X( I+1, K )
     $                      + X( I+2, K ) + X( I+3, K )
   10       CONTINUE
            Y( N-2, K ) = -X( N-3,k) + X( N-2, K ) + X( N-1, K ) 
     $                      + X( N, K )
            Y( N-1, K ) = -X( N-2,k) + X( N-1, K ) + X( N, K )
            Y( N, K )   = -X( N-1,k) + X( N, K )
   20    CONTINUE 
*
      ELSE 
*
*        Compute Y(:,1:M) = A'*X(:,1:M) 
*
         DO 40 K = 1, M 
            Y( 1, K ) = X( 1, K ) - X( 2, K ) 
            Y( 2, K ) = X( 1, K ) + X( 2, K ) - X( 3, K ) 
            Y( 3, K ) = X( 1, K ) + X( 2, K ) + X( 3, K ) - X( 4, K )        
            DO 30 I = 4, N-1
               Y( I, K ) = X( I-3, K ) + X( I-2, K ) + X( I-1, K ) +
     $                      X( I, K ) - X( I+1, K )
   30       CONTINUE
            Y( N, K ) = X( N-3, K ) + X( N-2, K ) + X( N-1, K ) +
     $                   X( N, K )  
   40    CONTINUE
      END IF 
*
      RETURN
*  
*     END OF MVMGRC
      END 
