HP MLIB User's Guide Vol. 1 7th Ed.

288 HP MLIB User’s Guide
SSYR2K/DSYR2K/CHER2K/CSYR2K/ZHER2K/ZSYR2K Rank-2k update
Error conditions are:
uplo ’L’ or ’l’ or ’U’ or ’u’
trans ’N’ or ’n’ or ’T’ or ’t’ or ’C’ or ’c’
n < 0
k < 0
lda too small
ldb too small
ldc < max(m,1)
Also, note that some of the values of trans listed above are invalid in
subprograms CHER2K, CSYR2K, ZHER2K, and ZSYR2K.
Actual character arguments in a subroutine call can be longer than the
corresponding dummy arguments. Therefore, readability of the CALL
statement may be improved, for example, by coding the uplo argument as
’LOWER’ for ’L’ or ’UPPER’ for ’U’. Refer to “Example 2.”
Example 1 Apply a REAL*4 rank-6 update AB
T
+ BA
T
to an 8-by-8 real symmetric matrix
C whose upper triangle is stored in the upper triangle of an array C of
dimension 10-by-10, where A is an 8-by-3 real matrix stored in an array A, also
of dimension 10-by-10.
CHARACTER*1 UPLO,TRANS
INTEGER*4 N,K,LDA,LDB,LDC
REAL*4 ALPHA,BETA,A(10,10),B(10,10),C(10,10)
UPLO = ’U’
TRANS = ’N’
N = 8
K = 3
ALPHA = 1.0
BETA = 1.0
LDA = 10
LDB = 10
LDC = 10
CALL SSYR2K (UPLO,TRANS,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC)
Example 2 Apply a COMPLEX*8 Hermitian rank-4 update 2AB*2BA* to a 9-by-9
complex Hermitian matrix C whose lower triangle is stored in the lower
triangle of an array C of dimension 10-by-10, where A is a 9-by-2 complex
matrix stored in an array A of dimension 10-by-10.
INTEGER*4 N,K,LDA,LDB,LDC
COMPLEX*8 A(10,10),B(10,10),C(10,10)
N = 9
K = 2
LDA = 10
LDB = 10
LDC = 10
CALL CHER2K (’LOWER’,’NONTRANS’,N,K,-2.0,A,LDA,B,LDB,
& 1.0,C,LDC)