3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE SSYRK(UPLO,TRANS,N,K,ALPHA,A,LDA,BETA,C,LDC)
13 * .. Scalar Arguments ..
16 * CHARACTER TRANS,UPLO
18 * .. Array Arguments ..
19 * REAL A(LDA,*),C(LDC,*)
28 *> SSYRK performs one of the symmetric rank k operations
30 *> C := alpha*A*A**T + beta*C,
34 *> C := alpha*A**T*A + beta*C,
36 *> where alpha and beta are scalars, C is an n by n symmetric matrix
37 *> and A is an n by k matrix in the first case and a k by n matrix
38 *> in the second case.
46 *> UPLO is CHARACTER*1
47 *> On entry, UPLO specifies whether the upper or lower
48 *> triangular part of the array C is to be referenced as
51 *> UPLO = 'U' or 'u' Only the upper triangular part of C
52 *> is to be referenced.
54 *> UPLO = 'L' or 'l' Only the lower triangular part of C
55 *> is to be referenced.
60 *> TRANS is CHARACTER*1
61 *> On entry, TRANS specifies the operation to be performed as
64 *> TRANS = 'N' or 'n' C := alpha*A*A**T + beta*C.
66 *> TRANS = 'T' or 't' C := alpha*A**T*A + beta*C.
68 *> TRANS = 'C' or 'c' C := alpha*A**T*A + beta*C.
74 *> On entry, N specifies the order of the matrix C. N must be
81 *> On entry with TRANS = 'N' or 'n', K specifies the number
82 *> of columns of the matrix A, and on entry with
83 *> TRANS = 'T' or 't' or 'C' or 'c', K specifies the number
84 *> of rows of the matrix A. K must be at least zero.
90 *> On entry, ALPHA specifies the scalar alpha.
95 *> A is REAL array of DIMENSION ( LDA, ka ), where ka is
96 *> k when TRANS = 'N' or 'n', and is n otherwise.
97 *> Before entry with TRANS = 'N' or 'n', the leading n by k
98 *> part of the array A must contain the matrix A, otherwise
99 *> the leading k by n part of the array A must contain the
106 *> On entry, LDA specifies the first dimension of A as declared
107 *> in the calling (sub) program. When TRANS = 'N' or 'n'
108 *> then LDA must be at least max( 1, n ), otherwise LDA must
109 *> be at least max( 1, k ).
115 *> On entry, BETA specifies the scalar beta.
120 *> C is REAL array of DIMENSION ( LDC, n ).
121 *> Before entry with UPLO = 'U' or 'u', the leading n by n
122 *> upper triangular part of the array C must contain the upper
123 *> triangular part of the symmetric matrix and the strictly
124 *> lower triangular part of C is not referenced. On exit, the
125 *> upper triangular part of the array C is overwritten by the
126 *> upper triangular part of the updated matrix.
127 *> Before entry with UPLO = 'L' or 'l', the leading n by n
128 *> lower triangular part of the array C must contain the lower
129 *> triangular part of the symmetric matrix and the strictly
130 *> upper triangular part of C is not referenced. On exit, the
131 *> lower triangular part of the array C is overwritten by the
132 *> lower triangular part of the updated matrix.
138 *> On entry, LDC specifies the first dimension of C as declared
139 *> in the calling (sub) program. LDC must be at least
146 *> \author Univ. of Tennessee
147 *> \author Univ. of California Berkeley
148 *> \author Univ. of Colorado Denver
151 *> \date November 2011
153 *> \ingroup single_blas_level3
155 *> \par Further Details:
156 * =====================
160 *> Level 3 Blas routine.
162 *> -- Written on 8-February-1989.
163 *> Jack Dongarra, Argonne National Laboratory.
164 *> Iain Duff, AERE Harwell.
165 *> Jeremy Du Croz, Numerical Algorithms Group Ltd.
166 *> Sven Hammarling, Numerical Algorithms Group Ltd.
169 * =====================================================================
170 SUBROUTINE SSYRK(UPLO,TRANS,N,K,ALPHA,A,LDA,BETA,C,LDC)
172 * -- Reference BLAS level3 routine (version 3.4.0) --
173 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
174 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
177 * .. Scalar Arguments ..
182 * .. Array Arguments ..
183 REAL A(LDA,*),C(LDC,*)
186 * =====================================================================
188 * .. External Functions ..
192 * .. External Subroutines ..
195 * .. Intrinsic Functions ..
198 * .. Local Scalars ..
200 INTEGER I,INFO,J,L,NROWA
205 PARAMETER (ONE=1.0E+0,ZERO=0.0E+0)
208 * Test the input parameters.
210 IF (LSAME(TRANS,'N')) THEN
215 UPPER = LSAME(UPLO,'U')
218 IF ((.NOT.UPPER) .AND. (.NOT.LSAME(UPLO,'L'))) THEN
220 ELSE IF ((.NOT.LSAME(TRANS,'N')) .AND.
221 + (.NOT.LSAME(TRANS,'T')) .AND.
222 + (.NOT.LSAME(TRANS,'C'))) THEN
224 ELSE IF (N.LT.0) THEN
226 ELSE IF (K.LT.0) THEN
228 ELSE IF (LDA.LT.MAX(1,NROWA)) THEN
230 ELSE IF (LDC.LT.MAX(1,N)) THEN
234 CALL XERBLA('SSYRK ',INFO)
238 * Quick return if possible.
240 IF ((N.EQ.0) .OR. (((ALPHA.EQ.ZERO).OR.
241 + (K.EQ.0)).AND. (BETA.EQ.ONE))) RETURN
243 * And when alpha.eq.zero.
245 IF (ALPHA.EQ.ZERO) THEN
247 IF (BETA.EQ.ZERO) THEN
261 IF (BETA.EQ.ZERO) THEN
278 * Start the operations.
280 IF (LSAME(TRANS,'N')) THEN
282 * Form C := alpha*A*A**T + beta*C.
286 IF (BETA.EQ.ZERO) THEN
290 ELSE IF (BETA.NE.ONE) THEN
296 IF (A(J,L).NE.ZERO) THEN
299 C(I,J) = C(I,J) + TEMP*A(I,L)
306 IF (BETA.EQ.ZERO) THEN
310 ELSE IF (BETA.NE.ONE) THEN
316 IF (A(J,L).NE.ZERO) THEN
319 C(I,J) = C(I,J) + TEMP*A(I,L)
327 * Form C := alpha*A**T*A + beta*C.
334 TEMP = TEMP + A(L,I)*A(L,J)
336 IF (BETA.EQ.ZERO) THEN
339 C(I,J) = ALPHA*TEMP + BETA*C(I,J)
348 TEMP = TEMP + A(L,I)*A(L,J)
350 IF (BETA.EQ.ZERO) THEN
353 C(I,J) = ALPHA*TEMP + BETA*C(I,J)