IBM Books

Engineering and Scientific Subroutine Library for AIX Version 3 Release 3: Guide and Reference

SSYRK, DSYRK, CSYRK, ZSYRK, CHERK, and ZHERK--Rank-K Update of a Real or Complex Symmetric or a Complex Hermitian Matrix

These subroutines compute one of the following rank-k updates, where matrix C is stored in either upper or lower storage mode. SSYRK, DSYRK, CSYRK, and ZSYRK use the scalars alpha and beta, real or complex matrix A or its transpose, and real or complex symmetric matrix C to compute:

1. C <-- alphaAAT+betaC
2. C <-- alphaATA+betaC

CHERK and ZHERK use the scalars alpha and beta, complex matrix A or its complex conjugate transpose, and complex Hermitian matrix C to compute:

3. C <-- alphaAAH+betaC
4. C <-- alphaAHA+betaC

Table 79. Data Types

A, C alpha, beta Subprogram
Short-precision real Short-precision real SSYRK
Long-precision real Long-precision real DSYRK
Short-precision complex Short-precision complex CSYRK
Long-precision complex Long-precision complex ZSYRK
Short-precision complex Short-precision real CHERK
Long-precision complex Long-precision real ZHERK

Syntax

Fortran CALL SSYRK | DSYRK | CSYRK | ZSYRK | CHERK | ZHERK (uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
C and C++ ssyrk | dsyrk | csyrk | zsyrk | cherk | zherk (uplo, trans, n, k, alpha, a, lda, beta, c, ldc);
PL/I CALL SSYRK | DSYRK | CSYRK | ZSYRK | CHERK | ZHERK (uplo, trans, n, k, alpha, a, lda, beta, c, ldc);

On Entry

uplo
indicates the storage mode used for matrix C, where:

If uplo = 'U', C is stored in upper storage mode.

If uplo = 'L', C is stored in lower storage mode.

Specified as: a single character. It must be 'U' or 'L'.

trans
indicates the form of matrix A to use in the computation, where:

If trans = 'N', A is used, resulting in equation 1 or 3.

If trans = 'T', AT is used, resulting in equation 2.

If trans = 'C', AH is used, resulting in equation 4.

Specified as: a single character, where:

For SSYRK and DSYRK, it must be 'N', 'T', or 'C'.

For CSYRK and ZSYRK, it must be 'N' or 'T'.

For CHERK and ZHERK, it must be 'N' or 'C'.

n
is the order of matrix C. Specified as: a fullword integer; 0 <= n <= ldc and:

If trans = 'N', then n <= lda.

k
has the following meaning, where:

If trans = 'N', it is the number of columns in matrix A.

If trans = 'T' or 'C', it is the number of rows in matrix A.

Specified as: a fullword integer; k >= 0 and:

If trans = 'T' or 'C', then k <= lda.

alpha
is the scalar alpha. Specified as: a number of the data type indicated in Table 79.

a
is the rectangular matrix A, where:

If trans = 'N', A is n by k.

If trans = 'T' or 'C', A is k by n.

Note:
No data should be moved to form AT or AH; that is, the matrix A should always be stored in its untransposed form.

Specified as: a two-dimensional array, containing numbers of the data type indicated in Table 79, where:

If trans = 'N', its size must be lda by (at least) k.

If trans = 'T' or 'C', its size must be lda by (at least) n.

lda
is the leading dimension of the array specified for a. Specified as: a fullword integer; lda > 0 and:

If trans = 'N', lda >= n.

If trans = 'T' or 'C', lda >= k.

beta
is the scalar beta. Specified as: a number of the data type indicated in Table 79.

c
is matrix C of order n, which is real symmetric, complex symmetric, or complex Hermitian, where:

If uplo = 'U', C is stored in upper storage mode.

If uplo = 'L', C is stored in lower storage mode.

Specified as: an ldc by (at least) n array, containing numbers of the data type indicated in Table 79.

ldc
is the leading dimension of the array specified for c. Specified as: a fullword integer; ldc > 0 and ldc >= n.

On Return

c
is matrix C of order n, which is real symmetric, complex symmetric, or complex Hermitian, containing the results of the computation, where:

If uplo = 'U', C is stored in upper storage mode.

If uplo = 'L', C is stored in lower storage mode.

Returned as: an ldc by (at least) n array, containing numbers of the data type indicated in Table 79.

Notes
  1. These subroutines accept lowercase letters for the uplo and trans arguments.
  2. For SSYRK and DSYRK, if you specify 'C' for the trans argument, it is interpreted as though you specified 'T'.
  3. Matrices A and C must have no common elements; otherwise, results are unpredictable.
  4. The imaginary parts of the diagonal elements of a complex Hermitian matrix A are assumed to be zero, so you do not have to set these values. On output, they are set to zero, except when beta is one and alpha or k is zero, in which case no computation is performed.
  5. For a description of how symmetric matrices are stored in upper and lower storage mode, see Symmetric Matrix. For a description of how complex Hermitian matrices are stored in upper and lower storage mode, see Complex Hermitian Matrix.

Function

These subroutines can perform the following rank-k updates. For SSYRK and DSYRK, matrix C is real symmetric. For CSYRK and ZSYRK, matrix C is complex symmetric. They perform:

1. C<--alphaAAT+betaC
2. C<--alphaATA+betaC

For CHERK and ZHERK, matrix C is complex Hermitian. They perform:

3. C<--alphaAAH+betaC
4. C<--alphaAHA+betaC

where:

alpha and beta are scalars.
A is a rectangular matrix, which is n by k for equations 1 and 3, and is k by n for equations 2 and 4.
C is a matrix of order n of the type indicated above, stored in upper or lower storage mode.

See references [32] and [38]. In the following two cases, no computation is performed:

Assuming the above conditions do not exist, if beta is not one, and alpha is zero or k is zero, then betaC is returned.

Error Conditions

Resource Errors

Unable to allocate internal work area.

Computational Errors

None

Input-Argument Errors
  1. lda, ldc <= 0
  2. ldc < n
  3. k, n < 0
  4. uplo <> 'U' or 'L'
  5. trans <> 'N', 'T', or 'C' for SSYRK and DSYRK
  6. trans <> 'N' or 'T' for CSYRK and ZSYRK
  7. trans <> 'N' or 'C' for CHERK and ZHERK
  8. trans = 'N' and lda < n
  9. trans = 'T' or 'C' and lda < k

Example 1

This example shows the computation C<--alphaAAT+betaC, where A is an 8 by 2 real rectangular matrix, and C is a real symmetric matrix of order 8, stored in upper storage mode.

Call Statement and Input
            UPLO TRANS   N   K   ALPHA   A  LDA  BETA  C   LDC
             |     |     |   |     |     |   |    |    |    |
CALL SSYRK( 'U' , 'N' ,  8 , 2 ,  1.0  , A , 9 , 1.0 , C , 10 )
        *           *
        | 0.0   8.0 |
        | 1.0   9.0 |
        | 2.0  10.0 |
        | 3.0  11.0 |
A    =  | 4.0  12.0 |
        | 5.0  13.0 |
        | 6.0  14.0 |
        | 7.0  15.0 |
        |  .     .  |
        *           *
        *                                            *
        | 0.0  1.0  3.0  6.0  10.0  15.0  21.0  28.0 |
        |  .   2.0  4.0  7.0  11.0  16.0  22.0  29.0 |
        |  .    .   5.0  8.0  12.0  17.0  23.0  30.0 |
        |  .    .    .   9.0  13.0  18.0  24.0  31.0 |
C    =  |  .    .    .    .   14.0  19.0  25.0  32.0 |
        |  .    .    .    .     .   20.0  26.0  33.0 |
        |  .    .    .    .     .     .   27.0  34.0 |
        |  .    .    .    .     .     .     .   35.0 |
        |  .    .    .    .     .     .     .     .  |
        |  .    .    .    .     .     .     .     .  |
        *                                            *

Output
        *                                                      *
        | 64.0  73.0   83.0   94.0  106.0  119.0  133.0  148.0 |
        |   .   84.0   96.0  109.0  123.0  138.0  154.0  171.0 |
        |   .     .   109.0  124.0  140.0  157.0  175.0  194.0 |
        |   .     .      .   139.0  157.0  176.0  196.0  217.0 |
C    =  |   .     .      .      .   174.0  195.0  217.0  240.0 |
        |   .     .      .      .      .   214.0  238.0  263.0 |
        |   .     .      .      .      .      .   259.0  286.0 |
        |   .     .      .      .      .      .      .   309.0 |
        |   .     .      .      .      .      .      .      .  |
        |   .     .      .      .      .      .      .      .  |
        *                                                      *

Example 2

This example shows the computation C<--alphaATA+betaC, where A is a 3 by 8 real rectangular matrix, and C is a real symmetric matrix of order 8, stored in lower storage mode.

Call Statement and Input
            UPLO TRANS   N   K   ALPHA   A  LDA  BETA  C  LDC
             |     |     |   |     |     |   |    |    |   |
CALL SSYRK( 'L' , 'T' ,  8 , 3 ,  1.0  , A , 4 , 1.0 , C , 8 )
        *                                             *
        | 0.0  3.0  6.0   9.0  12.0  15.0  18.0  21.0 |
A    =  | 1.0  4.0  7.0  10.0  13.0  16.0  19.0  22.0 |
        | 2.0  5.0  8.0  11.0  14.0  17.0  20.0  23.0 |
        |  .    .    .     .     .     .     .     .  |
        *                                             *
        *                                               *
        | 0.0    .     .     .     .     .     .     .  |
        | 1.0   8.0    .     .     .     .     .     .  |
        | 2.0   9.0  15.0    .     .     .     .     .  |
C    =  | 3.0  10.0  16.0  21.0    .     .     .     .  |
        | 4.0  11.0  17.0  22.0  26.0    .     .     .  |
        | 5.0  12.0  18.0  23.0  27.0  30.0    .     .  |
        | 6.0  13.0  19.0  24.0  28.0  31.0  33.0    .  |
        | 7.0  14.0  20.0  25.0  29.0  32.0  34.0  35.0 |
        *                                               *

Output
        *                                                          *
        |  5.0     .      .      .      .       .       .       .  |
        | 15.0   58.0     .      .      .       .       .       .  |
        | 25.0   95.0  164.0     .      .       .       .       .  |
C    =  | 35.0  132.0  228.0  323.0     .       .       .       .  |
        | 45.0  169.0  292.0  414.0  535.0      .       .       .  |
        | 55.0  206.0  356.0  505.0  653.0   800.0      .       .  |
        | 65.0  243.0  420.0  596.0  771.0   945.0  1118.0      .  |
        | 75.0  280.0  484.0  687.0  889.0  1090.0  1290.0  1489.0 |
        *                                                          *

Example 3

This example shows the computation C<--alphaAAT+betaC, where A is a 3 by 5 complex rectangular matrix, and C is a complex symmetric matrix of order 3, stored in upper storage mode.

Call Statement and Input
            UPLO TRANS   N   K   ALPHA   A  LDA  BETA   C  LDC
             |     |     |   |     |     |   |    |     |   |
CALL CSYRK( 'U' , 'N' ,  3 , 5 , ALPHA , A , 3 , BETA , C , 4 )
ALPHA    =  (1.0, 1.0)
BETA     =  (1.0, 1.0)
        *                                                        *
        | (2.0, 0.0) (3.0, 2.0) (4.0, 1.0) (1.0, 7.0) (0.0, 0.0) |
A    =  | (3.0, 3.0) (8.0, 0.0) (2.0, 5.0) (2.0, 4.0) (1.0, 2.0) |
        | (1.0, 3.0) (2.0, 1.0) (6.0, 0.0) (3.0, 2.0) (2.0, 2.0) |
        *                                                        *
        *                                  *
        | (2.0, 1.0) (1.0, 9.0) (4.0, 5.0) |
C    =  |     .      (3.0, 1.0) (6.0, 7.0) |
        |     .          .      (8.0, 1.0) |
        |     .          .          .      |
        *                                  *

Output
        *                                            *
        | (-57.0, 13.0) (-63.0, 79.0) (-24.0,  70.0) |
C    =  |       .       (-28.0, 90.0) (-55.0, 103.0) |
        |       .             .        (13.0,  75.0) |
        |       .             .             .        |
        *                                            *

Example 4

This example shows the computation C<--alphaAHA+betaC, where A is a 5 by 3 complex rectangular matrix, and C is a complex Hermitian matrix of order 3, stored in lower storage mode.

Note:
The imaginary parts of the diagonal elements of a complex Hermitian matrix are assumed to be zero, so you do not have to set these values. On output, they are set to zero.

Call Statement and Input
            UPLO TRANS   N   K   ALPHA   A  LDA  BETA   C  LDC
             |     |     |   |     |     |   |    |     |   |
CALL CHERK( 'L' , 'C' ,  3 , 5 ,  1.0  , A , 5 , 1.0  , C , 4 )
        *                                  *
        | (2.0, 0.0) (3.0, 2.0) (4.0, 1.0) |
        | (3.0, 3.0) (8.0, 0.0) (2.0, 5.0) |
A    =  | (1.0, 3.0) (2.0, 1.0) (6.0, 0.0) |
        | (3.0, 3.0) (8.0, 0.0) (2.0, 5.0) |
        | (1.0, 9.0) (3.0, 0.0) (6.0, 7.0) |
        *                                  *
        *                                    *
        | (6.0,  . )       .           .     |
C    =  | (3.0, 4.0)  (10.0,  . )      .     |
        | (9.0, 1.0)  (12.0, 2.0)  (3.0, . ) |
        |     .            .           .     |
        *                                    *

Output
        *                                             *
        | (138.0,  0.0)        .               .      |
C    =  |  (65.0, 80.0)  (165.0,   0.0)        .      |
        | (134.0, 46.0)   (88.0, -88.0)  (199.0, 0.0) |
        |       .              .               .      |
        *                                             *


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]