LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ ssyr()

subroutine ssyr ( character  UPLO,
integer  N,
real  ALPHA,
real, dimension(*)  X,
integer  INCX,
real, dimension(lda,*)  A,
integer  LDA 
)

SSYR

Purpose:
 SSYR   performs the symmetric rank 1 operation

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

 where alpha is a real 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.
[in]N
          N is INTEGER
           On entry, N specifies the order of the matrix A.
           N must be at least zero.
[in]ALPHA
          ALPHA is REAL
           On entry, ALPHA specifies the scalar alpha.
[in]X
          X is REAL array, dimension at least
           ( 1 + ( n - 1 )*abs( INCX ) ).
           Before entry, the incremented array X must contain the n
           element vector x.
[in]INCX
          INCX is INTEGER
           On entry, INCX specifies the increment for the elements of
           X. INCX must not be zero.
[in,out]A
          A is REAL 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 ).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016
Further Details:
  Level 2 Blas routine.

  -- Written on 22-October-1986.
     Jack Dongarra, Argonne National Lab.
     Jeremy Du Croz, Nag Central Office.
     Sven Hammarling, Nag Central Office.
     Richard Hanson, Sandia National Labs.

Definition at line 134 of file ssyr.f.

134 *
135 * -- Reference BLAS level2 routine (version 3.7.0) --
136 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
137 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
138 * December 2016
139 *
140 * .. Scalar Arguments ..
141  REAL alpha
142  INTEGER incx,lda,n
143  CHARACTER uplo
144 * ..
145 * .. Array Arguments ..
146  REAL a(lda,*),x(*)
147 * ..
148 *
149 * =====================================================================
150 *
151 * .. Parameters ..
152  REAL zero
153  parameter(zero=0.0e+0)
154 * ..
155 * .. Local Scalars ..
156  REAL temp
157  INTEGER i,info,ix,j,jx,kx
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 *
170 * Test the input parameters.
171 *
172  info = 0
173  IF (.NOT.lsame(uplo,'U') .AND. .NOT.lsame(uplo,'L')) THEN
174  info = 1
175  ELSE IF (n.LT.0) THEN
176  info = 2
177  ELSE IF (incx.EQ.0) THEN
178  info = 5
179  ELSE IF (lda.LT.max(1,n)) THEN
180  info = 7
181  END IF
182  IF (info.NE.0) THEN
183  CALL xerbla('SSYR ',info)
184  RETURN
185  END IF
186 *
187 * Quick return if possible.
188 *
189  IF ((n.EQ.0) .OR. (alpha.EQ.zero)) RETURN
190 *
191 * Set the start point in X if the increment is not unity.
192 *
193  IF (incx.LE.0) THEN
194  kx = 1 - (n-1)*incx
195  ELSE IF (incx.NE.1) THEN
196  kx = 1
197  END IF
198 *
199 * Start the operations. In this version the elements of A are
200 * accessed sequentially with one pass through the triangular part
201 * of A.
202 *
203  IF (lsame(uplo,'U')) THEN
204 *
205 * Form A when A is stored in upper triangle.
206 *
207  IF (incx.EQ.1) THEN
208  DO 20 j = 1,n
209  IF (x(j).NE.zero) THEN
210  temp = alpha*x(j)
211  DO 10 i = 1,j
212  a(i,j) = a(i,j) + x(i)*temp
213  10 CONTINUE
214  END IF
215  20 CONTINUE
216  ELSE
217  jx = kx
218  DO 40 j = 1,n
219  IF (x(jx).NE.zero) THEN
220  temp = alpha*x(jx)
221  ix = kx
222  DO 30 i = 1,j
223  a(i,j) = a(i,j) + x(ix)*temp
224  ix = ix + incx
225  30 CONTINUE
226  END IF
227  jx = jx + incx
228  40 CONTINUE
229  END IF
230  ELSE
231 *
232 * Form A when A is stored in lower triangle.
233 *
234  IF (incx.EQ.1) THEN
235  DO 60 j = 1,n
236  IF (x(j).NE.zero) THEN
237  temp = alpha*x(j)
238  DO 50 i = j,n
239  a(i,j) = a(i,j) + x(i)*temp
240  50 CONTINUE
241  END IF
242  60 CONTINUE
243  ELSE
244  jx = kx
245  DO 80 j = 1,n
246  IF (x(jx).NE.zero) THEN
247  temp = alpha*x(jx)
248  ix = jx
249  DO 70 i = j,n
250  a(i,j) = a(i,j) + x(ix)*temp
251  ix = ix + incx
252  70 CONTINUE
253  END IF
254  jx = jx + incx
255  80 CONTINUE
256  END IF
257  END IF
258 *
259  RETURN
260 *
261 * End of SSYR .
262 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
Here is the call graph for this function:
Here is the caller graph for this function: