LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ csyr()

subroutine csyr ( character  uplo,
integer  n,
complex  alpha,
complex, dimension( * )  x,
integer  incx,
complex, dimension( lda, * )  a,
integer  lda 
)

CSYR performs the symmetric rank-1 update of a complex symmetric matrix.

Download CSYR + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 CSYR   performs the symmetric rank 1 operation

    A := alpha*x*x**H + A,

 where alpha is a complex scalar, x is an n element vector and A is an
 n by n symmetric matrix.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
           On entry, UPLO specifies whether the upper or lower
           triangular part of the array A is to be referenced as
           follows:

              UPLO = 'U' or 'u'   Only the upper triangular part of A
                                  is to be referenced.

              UPLO = 'L' or 'l'   Only the lower triangular part of A
                                  is to be referenced.

           Unchanged on exit.
[in]N
          N is INTEGER
           On entry, N specifies the order of the matrix A.
           N must be at least zero.
           Unchanged on exit.
[in]ALPHA
          ALPHA is COMPLEX
           On entry, ALPHA specifies the scalar alpha.
           Unchanged on exit.
[in]X
          X is COMPLEX array, dimension at least
           ( 1 + ( N - 1 )*abs( INCX ) ).
           Before entry, the incremented array X must contain the N-
           element vector x.
           Unchanged on exit.
[in]INCX
          INCX is INTEGER
           On entry, INCX specifies the increment for the elements of
           X. INCX must not be zero.
           Unchanged on exit.
[in,out]A
          A is COMPLEX array, dimension ( LDA, N )
           Before entry, with  UPLO = 'U' or 'u', the leading n by n
           upper triangular part of the array A must contain the upper
           triangular part of the symmetric matrix and the strictly
           lower triangular part of A is not referenced. On exit, the
           upper triangular part of the array A is overwritten by the
           upper triangular part of the updated matrix.
           Before entry, with UPLO = 'L' or 'l', the leading n by n
           lower triangular part of the array A must contain the lower
           triangular part of the symmetric matrix and the strictly
           upper triangular part of A is not referenced. On exit, the
           lower triangular part of the array A is overwritten by the
           lower triangular part of the updated matrix.
[in]LDA
          LDA is INTEGER
           On entry, LDA specifies the first dimension of A as declared
           in the calling (sub) program. LDA must be at least
           max( 1, N ).
           Unchanged on exit.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 134 of file csyr.f.

135*
136* -- LAPACK auxiliary routine --
137* -- LAPACK is a software package provided by Univ. of Tennessee, --
138* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
139*
140* .. Scalar Arguments ..
141 CHARACTER UPLO
142 INTEGER INCX, LDA, N
143 COMPLEX ALPHA
144* ..
145* .. Array Arguments ..
146 COMPLEX A( LDA, * ), X( * )
147* ..
148*
149* =====================================================================
150*
151* .. Parameters ..
152 COMPLEX ZERO
153 parameter( zero = ( 0.0e+0, 0.0e+0 ) )
154* ..
155* .. Local Scalars ..
156 INTEGER I, INFO, IX, J, JX, KX
157 COMPLEX TEMP
158* ..
159* .. External Functions ..
160 LOGICAL LSAME
161 EXTERNAL lsame
162* ..
163* .. External Subroutines ..
164 EXTERNAL xerbla
165* ..
166* .. Intrinsic Functions ..
167 INTRINSIC max
168* ..
169* .. Executable Statements ..
170*
171* Test the input parameters.
172*
173 info = 0
174 IF( .NOT.lsame( uplo, 'U' ) .AND. .NOT.lsame( uplo, 'L' ) ) THEN
175 info = 1
176 ELSE IF( n.LT.0 ) THEN
177 info = 2
178 ELSE IF( incx.EQ.0 ) THEN
179 info = 5
180 ELSE IF( lda.LT.max( 1, n ) ) THEN
181 info = 7
182 END IF
183 IF( info.NE.0 ) THEN
184 CALL xerbla( 'CSYR ', info )
185 RETURN
186 END IF
187*
188* Quick return if possible.
189*
190 IF( ( n.EQ.0 ) .OR. ( alpha.EQ.zero ) )
191 $ RETURN
192*
193* Set the start point in X if the increment is not unity.
194*
195 IF( incx.LE.0 ) THEN
196 kx = 1 - ( n-1 )*incx
197 ELSE IF( incx.NE.1 ) THEN
198 kx = 1
199 END IF
200*
201* Start the operations. In this version the elements of A are
202* accessed sequentially with one pass through the triangular part
203* of A.
204*
205 IF( lsame( uplo, 'U' ) ) THEN
206*
207* Form A when A is stored in upper triangle.
208*
209 IF( incx.EQ.1 ) THEN
210 DO 20 j = 1, n
211 IF( x( j ).NE.zero ) THEN
212 temp = alpha*x( j )
213 DO 10 i = 1, j
214 a( i, j ) = a( i, j ) + x( i )*temp
215 10 CONTINUE
216 END IF
217 20 CONTINUE
218 ELSE
219 jx = kx
220 DO 40 j = 1, n
221 IF( x( jx ).NE.zero ) THEN
222 temp = alpha*x( jx )
223 ix = kx
224 DO 30 i = 1, j
225 a( i, j ) = a( i, j ) + x( ix )*temp
226 ix = ix + incx
227 30 CONTINUE
228 END IF
229 jx = jx + incx
230 40 CONTINUE
231 END IF
232 ELSE
233*
234* Form A when A is stored in lower triangle.
235*
236 IF( incx.EQ.1 ) THEN
237 DO 60 j = 1, n
238 IF( x( j ).NE.zero ) THEN
239 temp = alpha*x( j )
240 DO 50 i = j, n
241 a( i, j ) = a( i, j ) + x( i )*temp
242 50 CONTINUE
243 END IF
244 60 CONTINUE
245 ELSE
246 jx = kx
247 DO 80 j = 1, n
248 IF( x( jx ).NE.zero ) THEN
249 temp = alpha*x( jx )
250 ix = jx
251 DO 70 i = j, n
252 a( i, j ) = a( i, j ) + x( ix )*temp
253 ix = ix + incx
254 70 CONTINUE
255 END IF
256 jx = jx + incx
257 80 CONTINUE
258 END IF
259 END IF
260*
261 RETURN
262*
263* End of CSYR
264*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: