kusano 7d535a
kusano 7d535a
/*  -- translated by f2c (version 19940927).
kusano 7d535a
   You must link the resulting object file with the libraries:
kusano 7d535a
	-lf2c -lm   (in that order)
kusano 7d535a
*/
kusano 7d535a
kusano 7d535a
#include "f2c.h"
kusano 7d535a
kusano 7d535a
/* Subroutine */ int cgemv_(char *trans, integer *m, integer *n, complex *
kusano 7d535a
	alpha, complex *a, integer *lda, complex *x, integer *incx, complex *
kusano 7d535a
	beta, complex *y, integer *incy)
kusano 7d535a
{
kusano 7d535a
kusano 7d535a
kusano 7d535a
    /* System generated locals */
kusano 7d535a
    integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
kusano 7d535a
    complex q__1, q__2, q__3;
kusano 7d535a
kusano 7d535a
    /* Builtin functions */
kusano 7d535a
    void r_cnjg(complex *, complex *);
kusano 7d535a
kusano 7d535a
    /* Local variables */
kusano 7d535a
    static integer info;
kusano 7d535a
    static complex temp;
kusano 7d535a
    static integer lenx, leny, i, j;
kusano 7d535a
    extern logical lsame_(char *, char *);
kusano 7d535a
    static integer ix, iy, jx, jy, kx, ky;
kusano 7d535a
    extern /* Subroutine */ int xerbla_(char *, integer *);
kusano 7d535a
    static logical noconj;
kusano 7d535a
kusano 7d535a
kusano 7d535a
/*  Purpose   
kusano 7d535a
    =======   
kusano 7d535a
kusano 7d535a
    CGEMV  performs one of the matrix-vector operations   
kusano 7d535a
kusano 7d535a
       y := alpha*A*x + beta*y,   or   y := alpha*A'*x + beta*y,   or   
kusano 7d535a
kusano 7d535a
       y := alpha*conjg( A' )*x + beta*y,   
kusano 7d535a
kusano 7d535a
    where alpha and beta are scalars, x and y are vectors and A is an   
kusano 7d535a
    m by n matrix.   
kusano 7d535a
kusano 7d535a
    Parameters   
kusano 7d535a
    ==========   
kusano 7d535a
kusano 7d535a
    TRANS  - CHARACTER*1.   
kusano 7d535a
             On entry, TRANS specifies the operation to be performed as   
kusano 7d535a
             follows:   
kusano 7d535a
kusano 7d535a
                TRANS = 'N' or 'n'   y := alpha*A*x + beta*y.   
kusano 7d535a
kusano 7d535a
                TRANS = 'T' or 't'   y := alpha*A'*x + beta*y.   
kusano 7d535a
kusano 7d535a
                TRANS = 'C' or 'c'   y := alpha*conjg( A' )*x + beta*y.   
kusano 7d535a
kusano 7d535a
             Unchanged on exit.   
kusano 7d535a
kusano 7d535a
    M      - INTEGER.   
kusano 7d535a
             On entry, M specifies the number of rows of the matrix A.   
kusano 7d535a
             M must be at least zero.   
kusano 7d535a
             Unchanged on exit.   
kusano 7d535a
kusano 7d535a
    N      - INTEGER.   
kusano 7d535a
             On entry, N specifies the number of columns of the matrix A. 
kusano 7d535a
  
kusano 7d535a
             N must be at least zero.   
kusano 7d535a
             Unchanged on exit.   
kusano 7d535a
kusano 7d535a
    ALPHA  - COMPLEX         .   
kusano 7d535a
             On entry, ALPHA specifies the scalar alpha.   
kusano 7d535a
             Unchanged on exit.   
kusano 7d535a
kusano 7d535a
    A      - COMPLEX          array of DIMENSION ( LDA, n ).   
kusano 7d535a
             Before entry, the leading m by n part of the array A must   
kusano 7d535a
             contain the matrix of coefficients.   
kusano 7d535a
             Unchanged on exit.   
kusano 7d535a
kusano 7d535a
    LDA    - INTEGER.   
kusano 7d535a
             On entry, LDA specifies the first dimension of A as declared 
kusano 7d535a
  
kusano 7d535a
             in the calling (sub) program. LDA must be at least   
kusano 7d535a
             max( 1, m ).   
kusano 7d535a
             Unchanged on exit.   
kusano 7d535a
kusano 7d535a
    X      - COMPLEX          array of DIMENSION at least   
kusano 7d535a
             ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'   
kusano 7d535a
             and at least   
kusano 7d535a
             ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.   
kusano 7d535a
             Before entry, the incremented array X must contain the   
kusano 7d535a
             vector x.   
kusano 7d535a
             Unchanged on exit.   
kusano 7d535a
kusano 7d535a
    INCX   - INTEGER.   
kusano 7d535a
             On entry, INCX specifies the increment for the elements of   
kusano 7d535a
             X. INCX must not be zero.   
kusano 7d535a
             Unchanged on exit.   
kusano 7d535a
kusano 7d535a
    BETA   - COMPLEX         .   
kusano 7d535a
             On entry, BETA specifies the scalar beta. When BETA is   
kusano 7d535a
             supplied as zero then Y need not be set on input.   
kusano 7d535a
             Unchanged on exit.   
kusano 7d535a
kusano 7d535a
    Y      - COMPLEX          array of DIMENSION at least   
kusano 7d535a
             ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'   
kusano 7d535a
             and at least   
kusano 7d535a
             ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.   
kusano 7d535a
             Before entry with BETA non-zero, the incremented array Y   
kusano 7d535a
             must contain the vector y. On exit, Y is overwritten by the 
kusano 7d535a
  
kusano 7d535a
             updated vector y.   
kusano 7d535a
kusano 7d535a
    INCY   - INTEGER.   
kusano 7d535a
             On entry, INCY specifies the increment for the elements of   
kusano 7d535a
             Y. INCY must not be zero.   
kusano 7d535a
             Unchanged on exit.   
kusano 7d535a
kusano 7d535a
kusano 7d535a
    Level 2 Blas routine.   
kusano 7d535a
kusano 7d535a
    -- Written on 22-October-1986.   
kusano 7d535a
       Jack Dongarra, Argonne National Lab.   
kusano 7d535a
       Jeremy Du Croz, Nag Central Office.   
kusano 7d535a
       Sven Hammarling, Nag Central Office.   
kusano 7d535a
       Richard Hanson, Sandia National Labs.   
kusano 7d535a
kusano 7d535a
kusano 7d535a
kusano 7d535a
       Test the input parameters.   
kusano 7d535a
kusano 7d535a
    
kusano 7d535a
   Parameter adjustments   
kusano 7d535a
       Function Body */
kusano 7d535a
#define X(I) x[(I)-1]
kusano 7d535a
#define Y(I) y[(I)-1]
kusano 7d535a
kusano 7d535a
#define A(I,J) a[(I)-1 + ((J)-1)* ( *lda)]
kusano 7d535a
kusano 7d535a
    info = 0;
kusano 7d535a
    if (! lsame_(trans, "N") && ! lsame_(trans, "T") && ! 
kusano 7d535a
	    lsame_(trans, "C")) {
kusano 7d535a
	info = 1;
kusano 7d535a
    } else if (*m < 0) {
kusano 7d535a
	info = 2;
kusano 7d535a
    } else if (*n < 0) {
kusano 7d535a
	info = 3;
kusano 7d535a
    } else if (*lda < max(1,*m)) {
kusano 7d535a
	info = 6;
kusano 7d535a
    } else if (*incx == 0) {
kusano 7d535a
	info = 8;
kusano 7d535a
    } else if (*incy == 0) {
kusano 7d535a
	info = 11;
kusano 7d535a
    }
kusano 7d535a
    if (info != 0) {
kusano 7d535a
	xerbla_("CGEMV ", &info);
kusano 7d535a
	return 0;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Quick return if possible. */
kusano 7d535a
kusano 7d535a
    if (*m == 0 || *n == 0 || alpha->r == 0.f && alpha->i == 0.f && (beta->r 
kusano 7d535a
	    == 1.f && beta->i == 0.f)) {
kusano 7d535a
	return 0;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
    noconj = lsame_(trans, "T");
kusano 7d535a
kusano 7d535a
/*     Set  LENX  and  LENY, the lengths of the vectors x and y, and set 
kusano 7d535a
  
kusano 7d535a
       up the start points in  X  and  Y. */
kusano 7d535a
kusano 7d535a
    if (lsame_(trans, "N")) {
kusano 7d535a
	lenx = *n;
kusano 7d535a
	leny = *m;
kusano 7d535a
    } else {
kusano 7d535a
	lenx = *m;
kusano 7d535a
	leny = *n;
kusano 7d535a
    }
kusano 7d535a
    if (*incx > 0) {
kusano 7d535a
	kx = 1;
kusano 7d535a
    } else {
kusano 7d535a
	kx = 1 - (lenx - 1) * *incx;
kusano 7d535a
    }
kusano 7d535a
    if (*incy > 0) {
kusano 7d535a
	ky = 1;
kusano 7d535a
    } else {
kusano 7d535a
	ky = 1 - (leny - 1) * *incy;
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
/*     Start the operations. In this version the elements of A are   
kusano 7d535a
       accessed sequentially with one pass through A.   
kusano 7d535a
kusano 7d535a
       First form  y := beta*y. */
kusano 7d535a
kusano 7d535a
    if (beta->r != 1.f || beta->i != 0.f) {
kusano 7d535a
	if (*incy == 1) {
kusano 7d535a
	    if (beta->r == 0.f && beta->i == 0.f) {
kusano 7d535a
		i__1 = leny;
kusano 7d535a
		for (i = 1; i <= leny; ++i) {
kusano 7d535a
		    i__2 = i;
kusano 7d535a
		    Y(i).r = 0.f, Y(i).i = 0.f;
kusano 7d535a
/* L10: */
kusano 7d535a
		}
kusano 7d535a
	    } else {
kusano 7d535a
		i__1 = leny;
kusano 7d535a
		for (i = 1; i <= leny; ++i) {
kusano 7d535a
		    i__2 = i;
kusano 7d535a
		    i__3 = i;
kusano 7d535a
		    q__1.r = beta->r * Y(i).r - beta->i * Y(i).i, 
kusano 7d535a
			    q__1.i = beta->r * Y(i).i + beta->i * Y(i)
kusano 7d535a
			    .r;
kusano 7d535a
		    Y(i).r = q__1.r, Y(i).i = q__1.i;
kusano 7d535a
/* L20: */
kusano 7d535a
		}
kusano 7d535a
	    }
kusano 7d535a
	} else {
kusano 7d535a
	    iy = ky;
kusano 7d535a
	    if (beta->r == 0.f && beta->i == 0.f) {
kusano 7d535a
		i__1 = leny;
kusano 7d535a
		for (i = 1; i <= leny; ++i) {
kusano 7d535a
		    i__2 = iy;
kusano 7d535a
		    Y(iy).r = 0.f, Y(iy).i = 0.f;
kusano 7d535a
		    iy += *incy;
kusano 7d535a
/* L30: */
kusano 7d535a
		}
kusano 7d535a
	    } else {
kusano 7d535a
		i__1 = leny;
kusano 7d535a
		for (i = 1; i <= leny; ++i) {
kusano 7d535a
		    i__2 = iy;
kusano 7d535a
		    i__3 = iy;
kusano 7d535a
		    q__1.r = beta->r * Y(iy).r - beta->i * Y(iy).i, 
kusano 7d535a
			    q__1.i = beta->r * Y(iy).i + beta->i * Y(iy)
kusano 7d535a
			    .r;
kusano 7d535a
		    Y(iy).r = q__1.r, Y(iy).i = q__1.i;
kusano 7d535a
		    iy += *incy;
kusano 7d535a
/* L40: */
kusano 7d535a
		}
kusano 7d535a
	    }
kusano 7d535a
	}
kusano 7d535a
    }
kusano 7d535a
    if (alpha->r == 0.f && alpha->i == 0.f) {
kusano 7d535a
	return 0;
kusano 7d535a
    }
kusano 7d535a
    if (lsame_(trans, "N")) {
kusano 7d535a
kusano 7d535a
/*        Form  y := alpha*A*x + y. */
kusano 7d535a
kusano 7d535a
	jx = kx;
kusano 7d535a
	if (*incy == 1) {
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= *n; ++j) {
kusano 7d535a
		i__2 = jx;
kusano 7d535a
		if (X(jx).r != 0.f || X(jx).i != 0.f) {
kusano 7d535a
		    i__2 = jx;
kusano 7d535a
		    q__1.r = alpha->r * X(jx).r - alpha->i * X(jx).i, 
kusano 7d535a
			    q__1.i = alpha->r * X(jx).i + alpha->i * X(jx)
kusano 7d535a
			    .r;
kusano 7d535a
		    temp.r = q__1.r, temp.i = q__1.i;
kusano 7d535a
		    i__2 = *m;
kusano 7d535a
		    for (i = 1; i <= *m; ++i) {
kusano 7d535a
			i__3 = i;
kusano 7d535a
			i__4 = i;
kusano 7d535a
			i__5 = i + j * a_dim1;
kusano 7d535a
			q__2.r = temp.r * A(i,j).r - temp.i * A(i,j).i, 
kusano 7d535a
				q__2.i = temp.r * A(i,j).i + temp.i * A(i,j)
kusano 7d535a
				.r;
kusano 7d535a
			q__1.r = Y(i).r + q__2.r, q__1.i = Y(i).i + 
kusano 7d535a
				q__2.i;
kusano 7d535a
			Y(i).r = q__1.r, Y(i).i = q__1.i;
kusano 7d535a
/* L50: */
kusano 7d535a
		    }
kusano 7d535a
		}
kusano 7d535a
		jx += *incx;
kusano 7d535a
/* L60: */
kusano 7d535a
	    }
kusano 7d535a
	} else {
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= *n; ++j) {
kusano 7d535a
		i__2 = jx;
kusano 7d535a
		if (X(jx).r != 0.f || X(jx).i != 0.f) {
kusano 7d535a
		    i__2 = jx;
kusano 7d535a
		    q__1.r = alpha->r * X(jx).r - alpha->i * X(jx).i, 
kusano 7d535a
			    q__1.i = alpha->r * X(jx).i + alpha->i * X(jx)
kusano 7d535a
			    .r;
kusano 7d535a
		    temp.r = q__1.r, temp.i = q__1.i;
kusano 7d535a
		    iy = ky;
kusano 7d535a
		    i__2 = *m;
kusano 7d535a
		    for (i = 1; i <= *m; ++i) {
kusano 7d535a
			i__3 = iy;
kusano 7d535a
			i__4 = iy;
kusano 7d535a
			i__5 = i + j * a_dim1;
kusano 7d535a
			q__2.r = temp.r * A(i,j).r - temp.i * A(i,j).i, 
kusano 7d535a
				q__2.i = temp.r * A(i,j).i + temp.i * A(i,j)
kusano 7d535a
				.r;
kusano 7d535a
			q__1.r = Y(iy).r + q__2.r, q__1.i = Y(iy).i + 
kusano 7d535a
				q__2.i;
kusano 7d535a
			Y(iy).r = q__1.r, Y(iy).i = q__1.i;
kusano 7d535a
			iy += *incy;
kusano 7d535a
/* L70: */
kusano 7d535a
		    }
kusano 7d535a
		}
kusano 7d535a
		jx += *incx;
kusano 7d535a
/* L80: */
kusano 7d535a
	    }
kusano 7d535a
	}
kusano 7d535a
    } else {
kusano 7d535a
kusano 7d535a
/*        Form  y := alpha*A'*x + y  or  y := alpha*conjg( A' )*x + y.
kusano 7d535a
 */
kusano 7d535a
kusano 7d535a
	jy = ky;
kusano 7d535a
	if (*incx == 1) {
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= *n; ++j) {
kusano 7d535a
		temp.r = 0.f, temp.i = 0.f;
kusano 7d535a
		if (noconj) {
kusano 7d535a
		    i__2 = *m;
kusano 7d535a
		    for (i = 1; i <= *m; ++i) {
kusano 7d535a
			i__3 = i + j * a_dim1;
kusano 7d535a
			i__4 = i;
kusano 7d535a
			q__2.r = A(i,j).r * X(i).r - A(i,j).i * X(i)
kusano 7d535a
				.i, q__2.i = A(i,j).r * X(i).i + A(i,j)
kusano 7d535a
				.i * X(i).r;
kusano 7d535a
			q__1.r = temp.r + q__2.r, q__1.i = temp.i + q__2.i;
kusano 7d535a
			temp.r = q__1.r, temp.i = q__1.i;
kusano 7d535a
/* L90: */
kusano 7d535a
		    }
kusano 7d535a
		} else {
kusano 7d535a
		    i__2 = *m;
kusano 7d535a
		    for (i = 1; i <= *m; ++i) {
kusano 7d535a
			r_cnjg(&q__3, &A(i,j));
kusano 7d535a
			i__3 = i;
kusano 7d535a
			q__2.r = q__3.r * X(i).r - q__3.i * X(i).i, 
kusano 7d535a
				q__2.i = q__3.r * X(i).i + q__3.i * X(i)
kusano 7d535a
				.r;
kusano 7d535a
			q__1.r = temp.r + q__2.r, q__1.i = temp.i + q__2.i;
kusano 7d535a
			temp.r = q__1.r, temp.i = q__1.i;
kusano 7d535a
/* L100: */
kusano 7d535a
		    }
kusano 7d535a
		}
kusano 7d535a
		i__2 = jy;
kusano 7d535a
		i__3 = jy;
kusano 7d535a
		q__2.r = alpha->r * temp.r - alpha->i * temp.i, q__2.i = 
kusano 7d535a
			alpha->r * temp.i + alpha->i * temp.r;
kusano 7d535a
		q__1.r = Y(jy).r + q__2.r, q__1.i = Y(jy).i + q__2.i;
kusano 7d535a
		Y(jy).r = q__1.r, Y(jy).i = q__1.i;
kusano 7d535a
		jy += *incy;
kusano 7d535a
/* L110: */
kusano 7d535a
	    }
kusano 7d535a
	} else {
kusano 7d535a
	    i__1 = *n;
kusano 7d535a
	    for (j = 1; j <= *n; ++j) {
kusano 7d535a
		temp.r = 0.f, temp.i = 0.f;
kusano 7d535a
		ix = kx;
kusano 7d535a
		if (noconj) {
kusano 7d535a
		    i__2 = *m;
kusano 7d535a
		    for (i = 1; i <= *m; ++i) {
kusano 7d535a
			i__3 = i + j * a_dim1;
kusano 7d535a
			i__4 = ix;
kusano 7d535a
			q__2.r = A(i,j).r * X(ix).r - A(i,j).i * X(ix)
kusano 7d535a
				.i, q__2.i = A(i,j).r * X(ix).i + A(i,j)
kusano 7d535a
				.i * X(ix).r;
kusano 7d535a
			q__1.r = temp.r + q__2.r, q__1.i = temp.i + q__2.i;
kusano 7d535a
			temp.r = q__1.r, temp.i = q__1.i;
kusano 7d535a
			ix += *incx;
kusano 7d535a
/* L120: */
kusano 7d535a
		    }
kusano 7d535a
		} else {
kusano 7d535a
		    i__2 = *m;
kusano 7d535a
		    for (i = 1; i <= *m; ++i) {
kusano 7d535a
			r_cnjg(&q__3, &A(i,j));
kusano 7d535a
			i__3 = ix;
kusano 7d535a
			q__2.r = q__3.r * X(ix).r - q__3.i * X(ix).i, 
kusano 7d535a
				q__2.i = q__3.r * X(ix).i + q__3.i * X(ix)
kusano 7d535a
				.r;
kusano 7d535a
			q__1.r = temp.r + q__2.r, q__1.i = temp.i + q__2.i;
kusano 7d535a
			temp.r = q__1.r, temp.i = q__1.i;
kusano 7d535a
			ix += *incx;
kusano 7d535a
/* L130: */
kusano 7d535a
		    }
kusano 7d535a
		}
kusano 7d535a
		i__2 = jy;
kusano 7d535a
		i__3 = jy;
kusano 7d535a
		q__2.r = alpha->r * temp.r - alpha->i * temp.i, q__2.i = 
kusano 7d535a
			alpha->r * temp.i + alpha->i * temp.r;
kusano 7d535a
		q__1.r = Y(jy).r + q__2.r, q__1.i = Y(jy).i + q__2.i;
kusano 7d535a
		Y(jy).r = q__1.r, Y(jy).i = q__1.i;
kusano 7d535a
		jy += *incy;
kusano 7d535a
/* L140: */
kusano 7d535a
	    }
kusano 7d535a
	}
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
    return 0;
kusano 7d535a
kusano 7d535a
/*     End of CGEMV . */
kusano 7d535a
kusano 7d535a
} /* cgemv_ */
kusano 7d535a