|
kusano |
2b45e8 |
SUBROUTINE CGERCF ( M, N, ALPHA, X, INCX, Y, INCY, A, LDA )
|
|
kusano |
2b45e8 |
* .. Scalar Arguments ..
|
|
kusano |
2b45e8 |
COMPLEX ALPHA
|
|
kusano |
2b45e8 |
INTEGER INCX, INCY, LDA, M, N
|
|
kusano |
2b45e8 |
* .. Array Arguments ..
|
|
kusano |
2b45e8 |
COMPLEX A( LDA, * ), X( * ), Y( * )
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Purpose
|
|
kusano |
2b45e8 |
* =======
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* CGERC performs the rank 1 operation
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* A := alpha*x*conjg( y' ) + A,
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* where alpha is a scalar, x is an m element vector, y is an n element
|
|
kusano |
2b45e8 |
* vector and A is an m by n matrix.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Parameters
|
|
kusano |
2b45e8 |
* ==========
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* M - INTEGER.
|
|
kusano |
2b45e8 |
* On entry, M specifies the number of rows of the matrix A.
|
|
kusano |
2b45e8 |
* M must be at least zero.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* N - INTEGER.
|
|
kusano |
2b45e8 |
* On entry, N specifies the number of columns of the matrix A.
|
|
kusano |
2b45e8 |
* N must be at least zero.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* ALPHA - COMPLEX .
|
|
kusano |
2b45e8 |
* On entry, ALPHA specifies the scalar alpha.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* X - COMPLEX array of dimension at least
|
|
kusano |
2b45e8 |
* ( 1 + ( m - 1 )*abs( INCX ) ).
|
|
kusano |
2b45e8 |
* Before entry, the incremented array X must contain the m
|
|
kusano |
2b45e8 |
* element vector x.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* INCX - INTEGER.
|
|
kusano |
2b45e8 |
* On entry, INCX specifies the increment for the elements of
|
|
kusano |
2b45e8 |
* X. INCX must not be zero.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Y - COMPLEX array of dimension at least
|
|
kusano |
2b45e8 |
* ( 1 + ( n - 1 )*abs( INCY ) ).
|
|
kusano |
2b45e8 |
* Before entry, the incremented array Y must contain the n
|
|
kusano |
2b45e8 |
* element vector y.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* INCY - INTEGER.
|
|
kusano |
2b45e8 |
* On entry, INCY specifies the increment for the elements of
|
|
kusano |
2b45e8 |
* Y. INCY must not be zero.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* A - COMPLEX array of DIMENSION ( LDA, n ).
|
|
kusano |
2b45e8 |
* Before entry, the leading m by n part of the array A must
|
|
kusano |
2b45e8 |
* contain the matrix of coefficients. On exit, A is
|
|
kusano |
2b45e8 |
* overwritten by the updated matrix.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* LDA - INTEGER.
|
|
kusano |
2b45e8 |
* On entry, LDA specifies the first dimension of A as declared
|
|
kusano |
2b45e8 |
* in the calling (sub) program. LDA must be at least
|
|
kusano |
2b45e8 |
* max( 1, m ).
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Level 2 Blas routine.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* -- Written on 22-October-1986.
|
|
kusano |
2b45e8 |
* Jack Dongarra, Argonne National Lab.
|
|
kusano |
2b45e8 |
* Jeremy Du Croz, Nag Central Office.
|
|
kusano |
2b45e8 |
* Sven Hammarling, Nag Central Office.
|
|
kusano |
2b45e8 |
* Richard Hanson, Sandia National Labs.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* .. Parameters ..
|
|
kusano |
2b45e8 |
COMPLEX ZERO
|
|
kusano |
2b45e8 |
PARAMETER ( ZERO = ( 0.0E+0, 0.0E+0 ) )
|
|
kusano |
2b45e8 |
* .. Local Scalars ..
|
|
kusano |
2b45e8 |
COMPLEX TEMP
|
|
kusano |
2b45e8 |
INTEGER I, INFO, IX, J, JY, KX
|
|
kusano |
2b45e8 |
* .. External Subroutines ..
|
|
kusano |
2b45e8 |
EXTERNAL XERBLA
|
|
kusano |
2b45e8 |
* .. Intrinsic Functions ..
|
|
kusano |
2b45e8 |
INTRINSIC CONJG, MAX
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
* .. Executable Statements ..
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Test the input parameters.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
INFO = 0
|
|
kusano |
2b45e8 |
IF ( M.LT.0 )THEN
|
|
kusano |
2b45e8 |
INFO = 1
|
|
kusano |
2b45e8 |
ELSE IF( N.LT.0 )THEN
|
|
kusano |
2b45e8 |
INFO = 2
|
|
kusano |
2b45e8 |
ELSE IF( INCX.EQ.0 )THEN
|
|
kusano |
2b45e8 |
INFO = 5
|
|
kusano |
2b45e8 |
ELSE IF( INCY.EQ.0 )THEN
|
|
kusano |
2b45e8 |
INFO = 7
|
|
kusano |
2b45e8 |
ELSE IF( LDA.LT.MAX( 1, M ) )THEN
|
|
kusano |
2b45e8 |
INFO = 9
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
IF( INFO.NE.0 )THEN
|
|
kusano |
2b45e8 |
CALL XERBLA( 'CGERC ', INFO )
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Quick return if possible.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( ( M.EQ.0 ).OR.( N.EQ.0 ).OR.( ALPHA.EQ.ZERO ) )
|
|
kusano |
2b45e8 |
$ RETURN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Start the operations. In this version the elements of A are
|
|
kusano |
2b45e8 |
* accessed sequentially with one pass through A.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( INCY.GT.0 )THEN
|
|
kusano |
2b45e8 |
JY = 1
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
JY = 1 - ( N - 1 )*INCY
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
IF( INCX.EQ.1 )THEN
|
|
kusano |
2b45e8 |
DO 20, J = 1, N
|
|
kusano |
2b45e8 |
IF( Y( JY ).NE.ZERO )THEN
|
|
kusano |
2b45e8 |
TEMP = ALPHA*CONJG( Y( JY ) )
|
|
kusano |
2b45e8 |
DO 10, I = 1, M
|
|
kusano |
2b45e8 |
A( I, J ) = A( I, J ) + X( I )*TEMP
|
|
kusano |
2b45e8 |
10 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
JY = JY + INCY
|
|
kusano |
2b45e8 |
20 CONTINUE
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
IF( INCX.GT.0 )THEN
|
|
kusano |
2b45e8 |
KX = 1
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
KX = 1 - ( M - 1 )*INCX
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
DO 40, J = 1, N
|
|
kusano |
2b45e8 |
IF( Y( JY ).NE.ZERO )THEN
|
|
kusano |
2b45e8 |
TEMP = ALPHA*CONJG( Y( JY ) )
|
|
kusano |
2b45e8 |
IX = KX
|
|
kusano |
2b45e8 |
DO 30, I = 1, M
|
|
kusano |
2b45e8 |
A( I, J ) = A( I, J ) + X( IX )*TEMP
|
|
kusano |
2b45e8 |
IX = IX + INCX
|
|
kusano |
2b45e8 |
30 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
JY = JY + INCY
|
|
kusano |
2b45e8 |
40 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* End of CGERC .
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
END
|