|
kusano |
2b45e8 |
SUBROUTINE CHER2KF( UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB,
|
|
kusano |
2b45e8 |
$ BETA, C, LDC )
|
|
kusano |
2b45e8 |
* .. Scalar Arguments ..
|
|
kusano |
2b45e8 |
CHARACTER*1 UPLO, TRANS
|
|
kusano |
2b45e8 |
INTEGER N, K, LDA, LDB, LDC
|
|
kusano |
2b45e8 |
REAL BETA
|
|
kusano |
2b45e8 |
COMPLEX ALPHA
|
|
kusano |
2b45e8 |
* .. Array Arguments ..
|
|
kusano |
2b45e8 |
COMPLEX A( LDA, * ), B( LDB, * ), C( LDC, * )
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Purpose
|
|
kusano |
2b45e8 |
* =======
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* CHER2K performs one of the hermitian rank 2k operations
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* C := alpha*A*conjg( B' ) + conjg( alpha )*B*conjg( A' ) + beta*C,
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* or
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* C := alpha*conjg( A' )*B + conjg( alpha )*conjg( B' )*A + beta*C,
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* where alpha and beta are scalars with beta real, C is an n by n
|
|
kusano |
2b45e8 |
* hermitian matrix and A and B are n by k matrices in the first case
|
|
kusano |
2b45e8 |
* and k by n matrices in the second case.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Parameters
|
|
kusano |
2b45e8 |
* ==========
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* UPLO - CHARACTER*1.
|
|
kusano |
2b45e8 |
* On entry, UPLO specifies whether the upper or lower
|
|
kusano |
2b45e8 |
* triangular part of the array C is to be referenced as
|
|
kusano |
2b45e8 |
* follows:
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* UPLO = 'U' or 'u' Only the upper triangular part of C
|
|
kusano |
2b45e8 |
* is to be referenced.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* UPLO = 'L' or 'l' Only the lower triangular part of C
|
|
kusano |
2b45e8 |
* is to be referenced.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* TRANS - CHARACTER*1.
|
|
kusano |
2b45e8 |
* On entry, TRANS specifies the operation to be performed as
|
|
kusano |
2b45e8 |
* follows:
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* TRANS = 'N' or 'n' C := alpha*A*conjg( B' ) +
|
|
kusano |
2b45e8 |
* conjg( alpha )*B*conjg( A' ) +
|
|
kusano |
2b45e8 |
* beta*C.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* TRANS = 'C' or 'c' C := alpha*conjg( A' )*B +
|
|
kusano |
2b45e8 |
* conjg( alpha )*conjg( B' )*A +
|
|
kusano |
2b45e8 |
* beta*C.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* N - INTEGER.
|
|
kusano |
2b45e8 |
* On entry, N specifies the order of the matrix C. N must be
|
|
kusano |
2b45e8 |
* at least zero.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* K - INTEGER.
|
|
kusano |
2b45e8 |
* On entry with TRANS = 'N' or 'n', K specifies the number
|
|
kusano |
2b45e8 |
* of columns of the matrices A and B, and on entry with
|
|
kusano |
2b45e8 |
* TRANS = 'C' or 'c', K specifies the number of rows of the
|
|
kusano |
2b45e8 |
* matrices A and B. K must be at least zero.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* ALPHA - COMPLEX .
|
|
kusano |
2b45e8 |
* On entry, ALPHA specifies the scalar alpha.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* A - COMPLEX array of DIMENSION ( LDA, ka ), where ka is
|
|
kusano |
2b45e8 |
* k when TRANS = 'N' or 'n', and is n otherwise.
|
|
kusano |
2b45e8 |
* Before entry with TRANS = 'N' or 'n', the leading n by k
|
|
kusano |
2b45e8 |
* part of the array A must contain the matrix A, otherwise
|
|
kusano |
2b45e8 |
* the leading k by n part of the array A must contain the
|
|
kusano |
2b45e8 |
* matrix A.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* LDA - INTEGER.
|
|
kusano |
2b45e8 |
* On entry, LDA specifies the first dimension of A as declared
|
|
kusano |
2b45e8 |
* in the calling (sub) program. When TRANS = 'N' or 'n'
|
|
kusano |
2b45e8 |
* then LDA must be at least max( 1, n ), otherwise LDA must
|
|
kusano |
2b45e8 |
* be at least max( 1, k ).
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* B - COMPLEX array of DIMENSION ( LDB, kb ), where kb is
|
|
kusano |
2b45e8 |
* k when TRANS = 'N' or 'n', and is n otherwise.
|
|
kusano |
2b45e8 |
* Before entry with TRANS = 'N' or 'n', the leading n by k
|
|
kusano |
2b45e8 |
* part of the array B must contain the matrix B, otherwise
|
|
kusano |
2b45e8 |
* the leading k by n part of the array B must contain the
|
|
kusano |
2b45e8 |
* matrix B.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* LDB - INTEGER.
|
|
kusano |
2b45e8 |
* On entry, LDB specifies the first dimension of B as declared
|
|
kusano |
2b45e8 |
* in the calling (sub) program. When TRANS = 'N' or 'n'
|
|
kusano |
2b45e8 |
* then LDB must be at least max( 1, n ), otherwise LDB must
|
|
kusano |
2b45e8 |
* be at least max( 1, k ).
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* BETA - REAL .
|
|
kusano |
2b45e8 |
* On entry, BETA specifies the scalar beta.
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* C - COMPLEX array of DIMENSION ( LDC, n ).
|
|
kusano |
2b45e8 |
* Before entry with UPLO = 'U' or 'u', the leading n by n
|
|
kusano |
2b45e8 |
* upper triangular part of the array C must contain the upper
|
|
kusano |
2b45e8 |
* triangular part of the hermitian matrix and the strictly
|
|
kusano |
2b45e8 |
* lower triangular part of C is not referenced. On exit, the
|
|
kusano |
2b45e8 |
* upper triangular part of the array C is overwritten by the
|
|
kusano |
2b45e8 |
* upper triangular part of the updated matrix.
|
|
kusano |
2b45e8 |
* Before entry with UPLO = 'L' or 'l', the leading n by n
|
|
kusano |
2b45e8 |
* lower triangular part of the array C must contain the lower
|
|
kusano |
2b45e8 |
* triangular part of the hermitian matrix and the strictly
|
|
kusano |
2b45e8 |
* upper triangular part of C is not referenced. On exit, the
|
|
kusano |
2b45e8 |
* lower triangular part of the array C is overwritten by the
|
|
kusano |
2b45e8 |
* lower triangular part of the updated matrix.
|
|
kusano |
2b45e8 |
* Note that the imaginary parts of the diagonal elements need
|
|
kusano |
2b45e8 |
* not be set, they are assumed to be zero, and on exit they
|
|
kusano |
2b45e8 |
* are set to zero.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* LDC - INTEGER.
|
|
kusano |
2b45e8 |
* On entry, LDC specifies the first dimension of C as declared
|
|
kusano |
2b45e8 |
* in the calling (sub) program. LDC must be at least
|
|
kusano |
2b45e8 |
* max( 1, n ).
|
|
kusano |
2b45e8 |
* Unchanged on exit.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Level 3 Blas routine.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* -- Written on 8-February-1989.
|
|
kusano |
2b45e8 |
* Jack Dongarra, Argonne National Laboratory.
|
|
kusano |
2b45e8 |
* Iain Duff, AERE Harwell.
|
|
kusano |
2b45e8 |
* Jeremy Du Croz, Numerical Algorithms Group Ltd.
|
|
kusano |
2b45e8 |
* Sven Hammarling, Numerical Algorithms Group Ltd.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* -- Modified 8-Nov-93 to set C(J,J) to REAL( C(J,J) ) when BETA = 1.
|
|
kusano |
2b45e8 |
* Ed Anderson, Cray Research Inc.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* .. External Functions ..
|
|
kusano |
2b45e8 |
LOGICAL LSAME
|
|
kusano |
2b45e8 |
EXTERNAL LSAME
|
|
kusano |
2b45e8 |
* .. External Subroutines ..
|
|
kusano |
2b45e8 |
EXTERNAL XERBLA
|
|
kusano |
2b45e8 |
* .. Intrinsic Functions ..
|
|
kusano |
2b45e8 |
INTRINSIC CONJG, MAX, REAL
|
|
kusano |
2b45e8 |
* .. Local Scalars ..
|
|
kusano |
2b45e8 |
LOGICAL UPPER
|
|
kusano |
2b45e8 |
INTEGER I, INFO, J, L, NROWA
|
|
kusano |
2b45e8 |
COMPLEX TEMP1, TEMP2
|
|
kusano |
2b45e8 |
* .. Parameters ..
|
|
kusano |
2b45e8 |
REAL ONE
|
|
kusano |
2b45e8 |
PARAMETER ( ONE = 1.0E+0 )
|
|
kusano |
2b45e8 |
COMPLEX ZERO
|
|
kusano |
2b45e8 |
PARAMETER ( ZERO = ( 0.0E+0, 0.0E+0 ) )
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
* .. Executable Statements ..
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Test the input parameters.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( LSAME( TRANS, 'N' ) )THEN
|
|
kusano |
2b45e8 |
NROWA = N
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
NROWA = K
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
UPPER = LSAME( UPLO, 'U' )
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
INFO = 0
|
|
kusano |
2b45e8 |
IF( ( .NOT.UPPER ).AND.
|
|
kusano |
2b45e8 |
$ ( .NOT.LSAME( UPLO , 'L' ) ) )THEN
|
|
kusano |
2b45e8 |
INFO = 1
|
|
kusano |
2b45e8 |
ELSE IF( ( .NOT.LSAME( TRANS, 'N' ) ).AND.
|
|
kusano |
2b45e8 |
$ ( .NOT.LSAME( TRANS, 'C' ) ) )THEN
|
|
kusano |
2b45e8 |
INFO = 2
|
|
kusano |
2b45e8 |
ELSE IF( N .LT.0 )THEN
|
|
kusano |
2b45e8 |
INFO = 3
|
|
kusano |
2b45e8 |
ELSE IF( K .LT.0 )THEN
|
|
kusano |
2b45e8 |
INFO = 4
|
|
kusano |
2b45e8 |
ELSE IF( LDA.LT.MAX( 1, NROWA ) )THEN
|
|
kusano |
2b45e8 |
INFO = 7
|
|
kusano |
2b45e8 |
ELSE IF( LDB.LT.MAX( 1, NROWA ) )THEN
|
|
kusano |
2b45e8 |
INFO = 9
|
|
kusano |
2b45e8 |
ELSE IF( LDC.LT.MAX( 1, N ) )THEN
|
|
kusano |
2b45e8 |
INFO = 12
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
IF( INFO.NE.0 )THEN
|
|
kusano |
2b45e8 |
CALL XERBLA( 'CHER2K', INFO )
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Quick return if possible.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( ( N.EQ.0 ).OR.
|
|
kusano |
2b45e8 |
$ ( ( ( ALPHA.EQ.ZERO ).OR.( K.EQ.0 ) ).AND.( BETA.EQ.ONE ) ) )
|
|
kusano |
2b45e8 |
$ RETURN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* And when alpha.eq.zero.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( ALPHA.EQ.ZERO )THEN
|
|
kusano |
2b45e8 |
IF( UPPER )THEN
|
|
kusano |
2b45e8 |
IF( BETA.EQ.REAL( ZERO ) )THEN
|
|
kusano |
2b45e8 |
DO 20, J = 1, N
|
|
kusano |
2b45e8 |
DO 10, I = 1, J
|
|
kusano |
2b45e8 |
C( I, J ) = ZERO
|
|
kusano |
2b45e8 |
10 CONTINUE
|
|
kusano |
2b45e8 |
20 CONTINUE
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
DO 40, J = 1, N
|
|
kusano |
2b45e8 |
DO 30, I = 1, J - 1
|
|
kusano |
2b45e8 |
C( I, J ) = BETA*C( I, J )
|
|
kusano |
2b45e8 |
30 CONTINUE
|
|
kusano |
2b45e8 |
C( J, J ) = BETA*REAL( C( J, J ) )
|
|
kusano |
2b45e8 |
40 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
IF( BETA.EQ.REAL( ZERO ) )THEN
|
|
kusano |
2b45e8 |
DO 60, J = 1, N
|
|
kusano |
2b45e8 |
DO 50, I = J, N
|
|
kusano |
2b45e8 |
C( I, J ) = ZERO
|
|
kusano |
2b45e8 |
50 CONTINUE
|
|
kusano |
2b45e8 |
60 CONTINUE
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
DO 80, J = 1, N
|
|
kusano |
2b45e8 |
C( J, J ) = BETA*REAL( C( J, J ) )
|
|
kusano |
2b45e8 |
DO 70, I = J + 1, N
|
|
kusano |
2b45e8 |
C( I, J ) = BETA*C( I, J )
|
|
kusano |
2b45e8 |
70 CONTINUE
|
|
kusano |
2b45e8 |
80 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Start the operations.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( LSAME( TRANS, 'N' ) )THEN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Form C := alpha*A*conjg( B' ) + conjg( alpha )*B*conjg( A' ) +
|
|
kusano |
2b45e8 |
* C.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( UPPER )THEN
|
|
kusano |
2b45e8 |
DO 130, J = 1, N
|
|
kusano |
2b45e8 |
IF( BETA.EQ.REAL( ZERO ) )THEN
|
|
kusano |
2b45e8 |
DO 90, I = 1, J
|
|
kusano |
2b45e8 |
C( I, J ) = ZERO
|
|
kusano |
2b45e8 |
90 CONTINUE
|
|
kusano |
2b45e8 |
ELSE IF( BETA.NE.ONE )THEN
|
|
kusano |
2b45e8 |
DO 100, I = 1, J - 1
|
|
kusano |
2b45e8 |
C( I, J ) = BETA*C( I, J )
|
|
kusano |
2b45e8 |
100 CONTINUE
|
|
kusano |
2b45e8 |
C( J, J ) = BETA*REAL( C( J, J ) )
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
C( J, J ) = REAL( C( J, J ) )
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
DO 120, L = 1, K
|
|
kusano |
2b45e8 |
IF( ( A( J, L ).NE.ZERO ).OR.
|
|
kusano |
2b45e8 |
$ ( B( J, L ).NE.ZERO ) )THEN
|
|
kusano |
2b45e8 |
TEMP1 = ALPHA*CONJG( B( J, L ) )
|
|
kusano |
2b45e8 |
TEMP2 = CONJG( ALPHA*A( J, L ) )
|
|
kusano |
2b45e8 |
DO 110, I = 1, J - 1
|
|
kusano |
2b45e8 |
C( I, J ) = C( I, J ) + A( I, L )*TEMP1 +
|
|
kusano |
2b45e8 |
$ B( I, L )*TEMP2
|
|
kusano |
2b45e8 |
110 CONTINUE
|
|
kusano |
2b45e8 |
C( J, J ) = REAL( C( J, J ) ) +
|
|
kusano |
2b45e8 |
$ REAL( A( J, L )*TEMP1 +
|
|
kusano |
2b45e8 |
$ B( J, L )*TEMP2 )
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
120 CONTINUE
|
|
kusano |
2b45e8 |
130 CONTINUE
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
DO 180, J = 1, N
|
|
kusano |
2b45e8 |
IF( BETA.EQ.REAL( ZERO ) )THEN
|
|
kusano |
2b45e8 |
DO 140, I = J, N
|
|
kusano |
2b45e8 |
C( I, J ) = ZERO
|
|
kusano |
2b45e8 |
140 CONTINUE
|
|
kusano |
2b45e8 |
ELSE IF( BETA.NE.ONE )THEN
|
|
kusano |
2b45e8 |
DO 150, I = J + 1, N
|
|
kusano |
2b45e8 |
C( I, J ) = BETA*C( I, J )
|
|
kusano |
2b45e8 |
150 CONTINUE
|
|
kusano |
2b45e8 |
C( J, J ) = BETA*REAL( C( J, J ) )
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
C( J, J ) = REAL( C( J, J ) )
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
DO 170, L = 1, K
|
|
kusano |
2b45e8 |
IF( ( A( J, L ).NE.ZERO ).OR.
|
|
kusano |
2b45e8 |
$ ( B( J, L ).NE.ZERO ) )THEN
|
|
kusano |
2b45e8 |
TEMP1 = ALPHA*CONJG( B( J, L ) )
|
|
kusano |
2b45e8 |
TEMP2 = CONJG( ALPHA*A( J, L ) )
|
|
kusano |
2b45e8 |
DO 160, I = J + 1, N
|
|
kusano |
2b45e8 |
C( I, J ) = C( I, J ) + A( I, L )*TEMP1 +
|
|
kusano |
2b45e8 |
$ B( I, L )*TEMP2
|
|
kusano |
2b45e8 |
160 CONTINUE
|
|
kusano |
2b45e8 |
C( J, J ) = REAL( C( J, J ) ) +
|
|
kusano |
2b45e8 |
$ REAL( A( J, L )*TEMP1 +
|
|
kusano |
2b45e8 |
$ B( J, L )*TEMP2 )
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
170 CONTINUE
|
|
kusano |
2b45e8 |
180 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Form C := alpha*conjg( A' )*B + conjg( alpha )*conjg( B' )*A +
|
|
kusano |
2b45e8 |
* C.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( UPPER )THEN
|
|
kusano |
2b45e8 |
DO 210, J = 1, N
|
|
kusano |
2b45e8 |
DO 200, I = 1, J
|
|
kusano |
2b45e8 |
TEMP1 = ZERO
|
|
kusano |
2b45e8 |
TEMP2 = ZERO
|
|
kusano |
2b45e8 |
DO 190, L = 1, K
|
|
kusano |
2b45e8 |
TEMP1 = TEMP1 + CONJG( A( L, I ) )*B( L, J )
|
|
kusano |
2b45e8 |
TEMP2 = TEMP2 + CONJG( B( L, I ) )*A( L, J )
|
|
kusano |
2b45e8 |
190 CONTINUE
|
|
kusano |
2b45e8 |
IF( I.EQ.J )THEN
|
|
kusano |
2b45e8 |
IF( BETA.EQ.REAL( ZERO ) )THEN
|
|
kusano |
2b45e8 |
C( J, J ) = REAL( ALPHA *TEMP1 +
|
|
kusano |
2b45e8 |
$ CONJG( ALPHA )*TEMP2 )
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
C( J, J ) = BETA*REAL( C( J, J ) ) +
|
|
kusano |
2b45e8 |
$ REAL( ALPHA *TEMP1 +
|
|
kusano |
2b45e8 |
$ CONJG( ALPHA )*TEMP2 )
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
IF( BETA.EQ.REAL( ZERO ) )THEN
|
|
kusano |
2b45e8 |
C( I, J ) = ALPHA*TEMP1 + CONJG( ALPHA )*TEMP2
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
C( I, J ) = BETA *C( I, J ) +
|
|
kusano |
2b45e8 |
$ ALPHA*TEMP1 + CONJG( ALPHA )*TEMP2
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
200 CONTINUE
|
|
kusano |
2b45e8 |
210 CONTINUE
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
DO 240, J = 1, N
|
|
kusano |
2b45e8 |
DO 230, I = J, N
|
|
kusano |
2b45e8 |
TEMP1 = ZERO
|
|
kusano |
2b45e8 |
TEMP2 = ZERO
|
|
kusano |
2b45e8 |
DO 220, L = 1, K
|
|
kusano |
2b45e8 |
TEMP1 = TEMP1 + CONJG( A( L, I ) )*B( L, J )
|
|
kusano |
2b45e8 |
TEMP2 = TEMP2 + CONJG( B( L, I ) )*A( L, J )
|
|
kusano |
2b45e8 |
220 CONTINUE
|
|
kusano |
2b45e8 |
IF( I.EQ.J )THEN
|
|
kusano |
2b45e8 |
IF( BETA.EQ.REAL( ZERO ) )THEN
|
|
kusano |
2b45e8 |
C( J, J ) = REAL( ALPHA *TEMP1 +
|
|
kusano |
2b45e8 |
$ CONJG( ALPHA )*TEMP2 )
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
C( J, J ) = BETA*REAL( C( J, J ) ) +
|
|
kusano |
2b45e8 |
$ REAL( ALPHA *TEMP1 +
|
|
kusano |
2b45e8 |
$ CONJG( ALPHA )*TEMP2 )
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
IF( BETA.EQ.REAL( ZERO ) )THEN
|
|
kusano |
2b45e8 |
C( I, J ) = ALPHA*TEMP1 + CONJG( ALPHA )*TEMP2
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
C( I, J ) = BETA *C( I, J ) +
|
|
kusano |
2b45e8 |
$ ALPHA*TEMP1 + CONJG( ALPHA )*TEMP2
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
230 CONTINUE
|
|
kusano |
2b45e8 |
240 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* End of CHER2K.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
END
|