cgerc.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 184 行
HTML
184 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>cgerc.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.string { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.string a { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
SUBROUTINE <a name="CGERC.1"></a><a href="cgerc.f.html#CGERC.1">CGERC</a>(M,N,ALPHA,X,INCX,Y,INCY,A,LDA)
<span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> COMPLEX ALPHA
INTEGER INCX,INCY,LDA,M,N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> COMPLEX A(LDA,*),X(*),Y(*)
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="CGERC.13"></a><a href="cgerc.f.html#CGERC.1">CGERC</a> performs the rank 1 operation
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A := alpha*x*conjg( y' ) + A,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where alpha is a scalar, x is an m element vector, y is an n element
</span><span class="comment">*</span><span class="comment"> vector and A is an m by n matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> ==========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> M - INTEGER.
</span><span class="comment">*</span><span class="comment"> On entry, M specifies the number of rows of the matrix A.
</span><span class="comment">*</span><span class="comment"> M must be at least zero.
</span><span class="comment">*</span><span class="comment"> Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> N - INTEGER.
</span><span class="comment">*</span><span class="comment"> On entry, N specifies the number of columns of the matrix A.
</span><span class="comment">*</span><span class="comment"> N must be at least zero.
</span><span class="comment">*</span><span class="comment"> Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> ALPHA - COMPLEX .
</span><span class="comment">*</span><span class="comment"> On entry, ALPHA specifies the scalar alpha.
</span><span class="comment">*</span><span class="comment"> Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> X - COMPLEX array of dimension at least
</span><span class="comment">*</span><span class="comment"> ( 1 + ( m - 1 )*abs( INCX ) ).
</span><span class="comment">*</span><span class="comment"> Before entry, the incremented array X must contain the m
</span><span class="comment">*</span><span class="comment"> element vector x.
</span><span class="comment">*</span><span class="comment"> Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> INCX - INTEGER.
</span><span class="comment">*</span><span class="comment"> On entry, INCX specifies the increment for the elements of
</span><span class="comment">*</span><span class="comment"> X. INCX must not be zero.
</span><span class="comment">*</span><span class="comment"> Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Y - COMPLEX array of dimension at least
</span><span class="comment">*</span><span class="comment"> ( 1 + ( n - 1 )*abs( INCY ) ).
</span><span class="comment">*</span><span class="comment"> Before entry, the incremented array Y must contain the n
</span><span class="comment">*</span><span class="comment"> element vector y.
</span><span class="comment">*</span><span class="comment"> Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> INCY - INTEGER.
</span><span class="comment">*</span><span class="comment"> On entry, INCY specifies the increment for the elements of
</span><span class="comment">*</span><span class="comment"> Y. INCY must not be zero.
</span><span class="comment">*</span><span class="comment"> Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A - COMPLEX array of DIMENSION ( LDA, n ).
</span><span class="comment">*</span><span class="comment"> Before entry, the leading m by n part of the array A must
</span><span class="comment">*</span><span class="comment"> contain the matrix of coefficients. On exit, A is
</span><span class="comment">*</span><span class="comment"> overwritten by the updated matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDA - INTEGER.
</span><span class="comment">*</span><span class="comment"> On entry, LDA specifies the first dimension of A as declared
</span><span class="comment">*</span><span class="comment"> in the calling (sub) program. LDA must be at least
</span><span class="comment">*</span><span class="comment"> max( 1, m ).
</span><span class="comment">*</span><span class="comment"> Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Level 2 Blas routine.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- Written on 22-October-1986.
</span><span class="comment">*</span><span class="comment"> Jack Dongarra, Argonne National Lab.
</span><span class="comment">*</span><span class="comment"> Jeremy Du Croz, Nag Central Office.
</span><span class="comment">*</span><span class="comment"> Sven Hammarling, Nag Central Office.
</span><span class="comment">*</span><span class="comment"> Richard Hanson, Sandia National Labs.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> COMPLEX ZERO
PARAMETER (ZERO= (0.0E+0,0.0E+0))
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> COMPLEX TEMP
INTEGER I,INFO,IX,J,JY,KX
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="XERBLA.89"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC CONJG,MAX
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
IF (M.LT.0) THEN
INFO = 1
ELSE IF (N.LT.0) THEN
INFO = 2
ELSE IF (INCX.EQ.0) THEN
INFO = 5
ELSE IF (INCY.EQ.0) THEN
INFO = 7
ELSE IF (LDA.LT.MAX(1,M)) THEN
INFO = 9
END IF
IF (INFO.NE.0) THEN
CALL <a name="XERBLA.110"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>(<span class="string">'<a name="CGERC.110"></a><a href="cgerc.f.html#CGERC.1">CGERC</a> '</span>,INFO)
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Quick return if possible.
</span><span class="comment">*</span><span class="comment">
</span> IF ((M.EQ.0) .OR. (N.EQ.0) .OR. (ALPHA.EQ.ZERO)) RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Start the operations. In this version the elements of A are
</span><span class="comment">*</span><span class="comment"> accessed sequentially with one pass through A.
</span><span class="comment">*</span><span class="comment">
</span> IF (INCY.GT.0) THEN
JY = 1
ELSE
JY = 1 - (N-1)*INCY
END IF
IF (INCX.EQ.1) THEN
DO 20 J = 1,N
IF (Y(JY).NE.ZERO) THEN
TEMP = ALPHA*CONJG(Y(JY))
DO 10 I = 1,M
A(I,J) = A(I,J) + X(I)*TEMP
10 CONTINUE
END IF
JY = JY + INCY
20 CONTINUE
ELSE
IF (INCX.GT.0) THEN
KX = 1
ELSE
KX = 1 - (M-1)*INCX
END IF
DO 40 J = 1,N
IF (Y(JY).NE.ZERO) THEN
TEMP = ALPHA*CONJG(Y(JY))
IX = KX
DO 30 I = 1,M
A(I,J) = A(I,J) + X(IX)*TEMP
IX = IX + INCX
30 CONTINUE
END IF
JY = JY + INCY
40 CONTINUE
END IF
<span class="comment">*</span><span class="comment">
</span> RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="CGERC.157"></a><a href="cgerc.f.html#CGERC.1">CGERC</a> .
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?