IBM Books

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

PDSYRK, PZSYRK, and PZHERK--Rank-K Update of a Real or Complex Symmetric or a Complex Hermitian Matrix

PDSYRK and PZSYRK compute one of the following rank-k updates:

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

PZHERK computes one of the following rank-k updates:

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

where, in the formulas above:

A represents the global general submatrix:
C represents the global submatrix Cic:ic+n-1, jc:jc+n-1.

and:

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

In the following two cases, no computation is performed and the subroutine returns after doing some parameter checking:

See references [14] and [15].

Table 51. Data Types

A, C alpha, beta Subprogram
Long-precision real Long-precision real PDSYRK
Long-precision complex Long-precision complex PZSYRK
Long-precision complex Long-precision real PZHERK

Syntax

Fortran CALL PDSYRK | PZSYRK | PZHERK (uplo, trans, n, k, alpha, a, ia, ja, desc_a, beta, c, ic, jc, desc_c)
C and C++ pdsyrk | pzsyrk | pzherk (uplo, trans, n, k, alpha, a, ia, ja, desc_a, beta, c, ic, jc, desc_c);

On Entry

uplo
indicates whether the upper or lower triangular part of the global submatrix C is referenced, where:

If uplo = 'U', the upper triangular part is referenced.

If uplo = 'L', the lower triangular part is referenced.

Scope: global

Specified as: a single character; uplo = 'U' or 'L'.

trans
indicates which computation is performed, where:

If trans = 'N', A is used.

If trans = 'T', AT is used.

If trans = 'C', AH is used.

Scope: global

Specified as: a single character, where:

For PDSYRK, it must be 'N', 'T', or 'C'.

For PZSYRK, it must be 'N' or 'T'.

For PZHERK, it must be 'N' or 'C'.

n
is the order of the global submatrix C used in the computation, and:

If trans = 'N', it is the number of rows in submatrix A used in the computation.

If trans = 'T' or 'C', it is the number of columns in submatrix A used in the computation.

Scope: global

Specified as: a fullword integer; n >= 0.

k
has the following meaning:

If trans = 'N', it is the number of columns in submatrix A used in the computation.

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

Scope: global

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

alpha
is the scalar alpha.

Scope: global

Specified as: a number of the data type indicated in Table 51.

a
is the local part of the global general matrix A. This identifies the first element of the local array A. This subroutine computes the location of the first element of the local subarray used, based on ia, ja, desc_a, p, q, myrow, and mycol; therefore:

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

Scope: local

Specified as: an LLD_A by (at least) LOCq(N_A) array, containing numbers of the data type indicated in Table 51. Details about the block-cyclic data distribution of global matrix A are stored in desc_a.

ia
is the row index of the global matrix A, identifying the first row of the submatrix A.

Scope: global

Specified as: a fullword integer; 1 <= ia <= M_A, and:

If trans = 'N', then ia+n-1 <= M_A.

If trans = 'T' or 'C', then ia+k-1 <= M_A.

ja
is the column index of the global matrix A, identifying the first column of the submatrix A.

Scope: global

Specified as: a fullword integer; 1 <= ja <= N_A, and:

If trans = 'N', then ja+k-1 <= N_A.

If trans = 'T' or 'C', then ja+n-1 <= N_A.

desc_a
is the array descriptor for global matrix A, described in the following table:
desc_a Name Description Limits Scope
1 DTYPE_A Descriptor type DTYPE_A=1 Global
2 CTXT_A BLACS context Valid value, as returned by BLACS_GRIDINIT or BLACS_GRIDMAP Global
3 M_A Number of rows in the global matrix If n = 0 or k = 0:
M_A >= 0
Otherwise:
M_A >= 1
Global
4 N_A Number of columns in the global matrix If n = 0 or k = 0:
N_A >= 0
Otherwise:
N_A >= 1
Global
5 MB_A Row block size MB_A >= 1 Global
6 NB_A Column block size NB_A >= 1 Global
7 RSRC_A The process row of the p × q grid over which the first row of the global matrix is distributed 0 <= RSRC_A < p Global
8 CSRC_A The process column of the p × q grid over which the first column of the global matrix is distributed 0 <= CSRC_A < q Global
9 LLD_A The leading dimension of the local array LLD_A >= max(1,LOCp(M_A)) Local

Specified as: an array of (at least) length 9, containing fullword integers.

beta
is the scalar beta.

Scope: global

Specified as: a number of the data type indicated in Table 51.

c
is the local part of the global real or complex symmetric or complex Hermitian matrix C. This identifies the first element of the local array C. This subroutine computes the location of the first element of the local subarray used, based on ic, jc, desc_c, p, q, myrow, and mycol; therefore, the leading LOCp(ic+n-1) by LOCq(jc+n-1) part of the local array C must contain the local pieces of the leading ic+n-1 by jc+n-1 part of the global matrix, and:

When beta is zero, C need not be set on input.

Scope: local

Specified as: an LLD_C by (at least) LOCq(N_C) array, containing numbers of the data type indicated in Table 51. Details about the block-cyclic data distribution of global matrix C are stored in desc_c.

ic
is the row index of the global matrix C, identifying the first row of the submatrix C.

Scope: global

Specified as: a fullword integer; 1 <= ic <= M_C and ic+n-1 <= M_C.

jc
is the column index of the global matrix C, identifying the first column of the submatrix C.

Scope: global

Specified as: a fullword integer; 1 <= jc <= N_C and jc+n-1 <= N_C.

desc_c
is the array descriptor for global matrix C, described in the following table:
desc_c Name Description Limits Scope
1 DTYPE_C Descriptor type DTYPE_C=1 Global
2 CTXT_C BLACS context Valid value, as returned by BLACS_GRIDINIT or BLACS_GRIDMAP Global
3 M_C Number of rows in the global matrix If n = 0:
M_C >= 0
Otherwise:
M_C >= 1
Global
4 N_C Number of columns in the global matrix If n = 0:
N_C >= 0
Otherwise:
N_C >= 1
Global
5 MB_C Row block size MB_C >= 1 Global
6 NB_C Column block size NB_C >= 1 Global
7 RSRC_C The process row of the p × q grid over which the first row of the global matrix is distributed 0 <= RSRC_C < p Global
8 CSRC_C The process column of the p × q grid over which the first column of the global matrix is distributed 0 <= CSRC_C < q Global
9 LLD_C The leading dimension of the local array LLD_C >= max(1,LOCp(M_C)) Local

Specified as: an array of (at least) length 9, containing fullword integers.

On Return

c
is the updated local part of the global real or complex symmetric or complex Hermitian matrix C, containing the results of the computation.

Scope: local

Returned as: an LLD_C by (at least) LOCq(N_C) array, containing numbers of the data type indicated in Table 51.

Notes and Coding Rules
  1. These subroutines accept lowercase letters for the uplo and trans arguments.
  2. For PDSYRK, if you specify 'C' for the trans argument, it is interpreted as though you specified 'T'.
  3. The imaginary parts of the diagonal elements of a complex Hermitian matrix C 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.
  4. The matrices must have no common elements; otherwise, results are unpredictable.
  5. The NUMROC utility subroutine can be used to determine the values of LOCp(M_) and LOCq(N_) used in the argument descriptions above. For details, see Determining the Number of Rows and Columns in Your Local Arrays and NUMROC--Compute the Number of Rows or Columns of a Block-Cyclically Distributed Matrix Contained in a Process.
  6. For suggested block sizes, see Coding Tips for Optimizing Parallel Performance.
  7. The following values must be equal: CTXT_A = CTXT_C.
  8. If C is not contained within a single block, that is:
    n+mod(ic-1, MB_C) > MB_C
    n+mod(jc-1, NB_C) > NB_C

    then:

  9. If trans = 'N':
  10. If trans = 'T' or 'C':
  11. If C is contained within a single block:

Error Conditions

Computational Errors

None

Resource Errors

Unable to allocate work space

Input-Argument and Miscellaneous Errors

Stage 1 

  1. DTYPE_A is invalid.
  2. DTYPE_C is invalid.

Stage 2 

  1. CTXT_A is invalid.

Stage 3 

  1. This subroutine was called from outside the process grid.

Stage 4 

  1. uplo <> 'U' or 'L'
  2. trans <> 
  3. n < 0 and trans = 'N'
  4. n < 0 and trans = 'T' or 'C'
  5. n < 0 and trans is invalid.
  6. k < 0 and trans = 'N'
  7. k < 0 and trans = 'T' or 'C'
  8. k < 0 and trans is invalid.
  9. M_A < 0 and (n = 0 or k = 0); M_A < 1 otherwise
  10. N_A < 0 and (n = 0 or k = 0); N_A < 1 otherwise
  11. MB_A < 1
  12. NB_A < 1
  13. RSRC_A < 0 or RSRC_A >= p
  14. CSRC_A < 0 or CSRC_A >= q
  15. ia < 1
  16. ja < 1
  17. M_C < 0 and n = 0; M_C < 1 otherwise
  18. N_C < 0 and n = 0; N_C < 1 otherwise
  19. MB_C < 1
  20. NB_C < 1
  21. RSRC_C < 0 or RSRC_C >= p
  22. CSRC_C < 0 or CSRC_C >= q
  23. ic < 1
  24. jc < 1
  25. CTXT_A <> CTXT_C

If n <> 0 and k <> 0:

  1. ia > M_A
  2. ja > N_A
  3. trans = 'N' and ia+n-1 > M_A
  4. trans = 'N' and ja+k-1 > N_A
  5. trans = 'T' or 'C' and ia+k-1 > M_A
  6. trans = 'T' or 'C' and ja+n-1 > N_A

If n <> 0:

  1. ic > M_C
  2. jc > N_C
  3. ic+n-1 > M_C
  4. jc+n-1 > N_C

Stage 5 

  1. If C is not contained within a single block, that is:
    n+mod(ic-1, MB_C) > MB_C
    n+mod(jc-1, NB_C) > NB_C

    and NB_C <> MB_C.

  2. trans = 'N' and NB_C <> MB_A.
  3. trans = 'T' or 'C' and MB_C <> NB_A.

If C is not contained within a single block:

  1. mod(ic-1, MB_C) <> 0
  2. mod(jc-1, NB_C) <> 0
  3. trans = 'N' and mod(ia-1, MB_A) <> 0
  4. trans = 'T' or 'C' and mod(ja-1, NB_A) <> 0

Stage 6 

  1. LLD_A < max(1, LOCp(M_A))
  2. LLD_C < max(1, LOCp(M_C))
  3. If trans = 'N', then (in the process grid) the process row containing the first row of the submatrix C does not contain the first row of the submatrix A; that is, icrow <> iarow, where:
    icrow = mod((((ic-1)/MB_C)+RSRC_C), p)
    iarow = mod((((ia-1)/MB_A)+RSRC_A), p)
  4. If trans = 'T' or 'C', then (in the process grid) the process column containing the first column of the submatrix C does not contain the first column of the submatrix A; that is, iccol <> iacol, where:
    iccol = mod((((jc-1)/NB_C)+CSRC_C), q)
    iacol = mod((((ja-1)/NB_A)+CSRC_A), q)

If C is contained within a single block:

  1. If trans = 'N':
    p > 1 and n+mod(ia-1, MB_A) > MB_A
  2. If trans = 'T' or 'C':
    q > 1 and n+mod(ja-1, NB_A) > NB_A

Example 1

This example computes C = alphaAAT+betaC using a 2 × 3 process grid.

Call Statements and Input


 ORDER = 'R'
 NPROW = 2
 NPCOL = 3
 CALL BLACS_GET (0, 0, ICONTXT)
 CALL BLACS_GRIDINIT(ICONTXT, ORDER, NPROW, NPCOL)
 CALL BLACS_GRIDINFO(ICONTXT, NPROW, NPCOL, MYROW, MYCOL)
 
             UPLO   TRANS   N    K     ALPHA    A  IA  JA    DESC_A    BETA
               |      |     |    |       |      |   |   |      |         |
 CALL PDSYRK( 'L' ,  'N' ,  8  , 5  ,  1.0D0  , A , 1 , 1 ,  DESC_A ,  1.0D0 ,
 
               C  IC  JC   DESC_C
               |   |   |     |
               C , 1 , 1 , DESC_C )


Desc_A Desc_C
DTYPE_ 1 1
CTXT_ icontxt(IOBG26) icontxt(IOBG26)
M_ 8 8
N_ 5 8
MB_ 2 2
NB_ 2 2
RSRC_ 0 0
CSRC_ 0 0
LLD_ See below(EPSSL26) See below(EPSSL26)

Notes:

  1. icontxt is the output of the BLACS_GRIDINIT call.

  2. Each process should set the LLD_ as follows:
    LLD_A = MAX(1,NUMROC(M_A, MB_A, MYROW, RSRC_A, NPROW))
    LLD_C = MAX(1,NUMROC(M_C, MB_C, MYROW, RSRC_C, NPROW))
    

    In this example, LLD_A = LLD_C = 4 on all processes.

Global general 8 × 5 matrix A with block size 2 × 2:

B,D         0                1             2
     *                                         *
 0   |   0.0    8.0  |   16.0   24.0  |   32.0 |
     |   1.0    9.0  |   17.0   25.0  |   33.0 |
     | --------------|----------------|------- |
 1   |   2.0   10.0  |   18.0   26.0  |   34.0 |
     |   3.0   11.0  |   19.0   27.0  |   35.0 |
     | --------------|----------------|------- |
 2   |   4.0   12.0  |   20.0   28.0  |   36.0 |
     |   5.0   13.0  |   21.0   29.0  |   37.0 |
     | --------------|----------------|------- |
 3   |   6.0   14.0  |   22.0   30.0  |   38.0 |
     |   7.0   15.0  |   23.0   31.0  |   39.0 |
     *                                         *

The following is the 2 × 3 process grid:

B,D  |    0    |    1    |    2    
-----| ------- | ------- |------- 
0    |   P00   |   P01   |   P02
2    |         |         |
-----| ------- | ------- |------- 
1    |   P10   |   P11   |   P12
3    |         |         |

Local arrays for A:

p,q  |     0       |       1        |    2
-----|-------------|----------------|--------
     |  0.0   8.0  |   16.0   24.0  |   32.0
     |  1.0   9.0  |   17.0   25.0  |   33.0
 0   |  4.0  12.0  |   20.0   28.0  |   36.0
     |  5.0  13.0  |   21.0   29.0  |   37.0
-----|-------------|----------------|--------
     |  2.0  10.0  |   18.0   26.0  |   34.0
     |  3.0  11.0  |   19.0   27.0  |   35.0
 1   |  6.0  14.0  |   22.0   30.0  |   38.0
     |  7.0  15.0  |   23.0   31.0  |   39.0

Global real symmetric matrix C of order 8 block size 2 × 2:

B,D         0               1               2               3
     *                                                             *
 0   |   0.0    .   |     .     .   |     .     .   |     .     .  |
     |   1.0   8.0  |     .     .   |     .     .   |     .     .  |
     | -------------|---------------|---------------|------------- |
 1   |   2.0   9.0  |   15.0    .   |     .     .   |     .     .  |
     |   3.0  10.0  |   16.0  21.0  |     .     .   |     .     .  |
     | -------------|---------------|---------------|------------- |
 2   |   4.0  11.0  |   17.0  22.0  |   26.0    .   |     .     .  |
     |   5.0  12.0  |   18.0  23.0  |   27.0  30.0  |     .     .  |
     | -------------|---------------|---------------|------------- |
 3   |   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 |
     *                                                             *

The following is the 2 × 3 process grid:

B,D  |    0    |    1    |    2    
-----| ------- | ------- |------- 
0    |   P00   |   P01   |   P02
2    |         |         |
-----| ------- | ------- |------- 
1    |   P10   |   P11   |   P12
3    |         |         |

Local arrays for C:

p,q  |            0             |       1       |       2
-----|--------------------------|---------------|--------------
     |   0.0    .     .     .   |     .     .   |     .     .
     |   1.0   8.0    .     .   |     .     .   |     .     .
 0   |   4.0  11.0    .     .   |   17.0  22.0  |   26.0    .
     |   5.0  12.0    .     .   |   18.0  23.0  |   27.0  30.0
-----|--------------------------|---------------|--------------
     |   2.0   9.0    .     .   |   15.0    .   |     .     .
     |   3.0  10.0    .     .   |   16.0  21.0  |     .     .
 1   |   6.0  13.0  33.0    .   |   19.0  24.0  |   28.0  31.0
     |   7.0  14.0  34.0  35.0  |   20.0  25.0  |   29.0  32.0

Output:

Global real symmetric matrix C of order 8 with block size 2 × 2:


B,D           0                   1                   2                   3
     *                                                                             *
 0   |  1920.0      .   |       .       .   |       .       .   |       .       .  |
     |  2001.0  2093.0  |       .       .   |       .       .   |       .       .  |
     | -----------------|-------------------|-------------------|----------------- |
 1   |  2082.0  2179.0  |   2275.0      .   |       .       .   |       .       .  |
     |  2163.0  2265.0  |   2366.0  2466.0  |       .       .   |       .       .  |
     | -----------------|-------------------|-------------------|----------------- |
 2   |  2244.0  2351.0  |   2457.0  2562.0  |   2666.0      .   |       .       .  |
     |  2325.0  2437.0  |   2548.0  2658.0  |   2767.0  2875.0  |       .       .  |
     | -----------------|-------------------|-------------------|----------------- |
 3   |  2406.0  2523.0  |   2639.0  2754.0  |   2868.0  2981.0  |   3093.0      .  |
     |  2487.0  2609.0  |   2730.0  2850.0  |   2969.0  3087.0  |   3204.0  3320.0 |
     *                                                                             *

The following is the 2 × 3 process grid:

B,D  |    0    |    1    |    2    
-----| ------- | ------- |------- 
0    |   P00   |   P01   |   P02
2    |         |         |
-----| ------- | ------- |------- 
1    |   P10   |   P11   |   P12
3    |         |         |

Local arrays for C:


p,q  |                0                 |         1         |         2
-----|----------------------------------|-------------------|------------------
     |  1920.0      .       .       .   |       .       .   |       .       .
     |  2001.0  2093.0      .       .   |       .       .   |       .       .
 0   |  2244.0  2351.0      .       .   |   2457.0  2562.0  |   2666.0      .
     |  2325.0  2437.0      .       .   |   2548.0  2658.0  |   2767.0  2875.0
-----|----------------------------------|-------------------|------------------
     |  2082.0  2179.0      .       .   |   2275.0      .   |       .       .
     |  2163.0  2265.0      .       .   |   2366.0  2466.0  |       .       .
 1   |  2406.0  2523.0  3093.0      .   |   2639.0  2754.0  |   2868.0  2981.0
     |  2487.0  2609.0  3204.0  3320.0  |   2730.0  2850.0  |   2969.0  3087.0

Example 2

This example computes C = alphaAAT+betaC using a 2 × 3 process grid.

Call Statements and Input


 ORDER = 'R'
 NPROW = 2
 NPCOL = 3
 CALL BLACS_GET (0, 0, ICONTXT)
 CALL BLACS_GRIDINIT(ICONTXT, ORDER, NPROW, NPCOL)
 CALL BLACS_GRIDINFO(ICONTXT, NPROW, NPCOL, MYROW, MYCOL)
 
             UPLO   TRANS   N    K     ALPHA    A  IA  JA    DESC_A    BETA
               |      |     |    |       |      |   |   |      |         |
 CALL PZSYRK( 'U' ,  'N' ,  3  , 5  ,  ALPHA  , A , 1 , 1 ,  DESC_A ,  BETA ,
 
               C  IC  JC   DESC_C
               |   |   |     |
               C , 1 , 1 , DESC_C )
 
               ALPHA = (1.0, 1.0)
 
               BETA  = (1.0, 1.0)


Desc_A Desc_C
DTYPE_ 1 1
CTXT_ icontxt(IOBG27) icontxt(IOBG27)
M_ 3 3
N_ 5 3
MB_ 2 2
NB_ 2 2
RSRC_ 0 0
CSRC_ 0 0
LLD_ See below(EPSSL27) See below(EPSSL27)

Notes:

  1. icontxt is the output of the BLACS_GRIDINIT call.

  2. Each process should set the LLD_ as follows:
    LLD_A = MAX(1,NUMROC(M_A, MB_A, MYROW, RSRC_A, NPROW))
    LLD_C = MAX(1,NUMROC(M_C, MB_C, MYROW, RSRC_C, NPROW))
    

    In this example:
    LLD_A = LLD_C = 2 on P00, P01, and P02
    LLD_A = LLD_C = 1 on P10, P11, and P12

Global general 3 × 5 matrix A with block size 2 × 2:

 B,D             0                     1                2
     *                                                       *
 0   | (2.0,0.0) (3.0,2.0) | (4.0,1.0) (1.0,7.0) | (0.0,0.0) |
     | (30.,3.0) (8.0,0.0) | (2.0,5.0) (2.0,4.0) | (1.0,2.0) |
     | --------------------|---------------------|---------- |
 1   | (1.0,3.0) (2.0,1.0) | (6.0,0.0) (3.0,2.0) | (2.0,2.0) |
     *                                                       * 

The following is the 2 × 3 process grid:

B,D  |    0    |    1    |    2    
-----| ------- | ------- |------- 
0    |   P00   |   P01   |   P02
-----| ------- | ------- |------- 
1    |   P10   |   P11   |   P12

Local arrays for A:

p,q  |          0          |          1          |     2
-----|---------------------|---------------------|-----------
     | (2.0,0.0) (3.0,2.0) | (4.0,1.0) (1.0,7.0) | (0.0,0.0)
 0   | (3.0,3.0) (8.0,0.0) | (2.0,5.0) (2.0,4.0) | (1.0,2.0)
-----|---------------------|---------------------|-----------
 1   | (1.0,3.0) (2.0,1.0) | (6.0,0.0) (3.0,2.0) | (2.0,2.0)

Global complex symmetric matrix C of order 3 with block size 2 × 2:

B,D             0                1
     *                                 *
 0   | (2.0,1.0) (1.0,9.0) | (4.0,5.0) |
     |     .     (3.0,1.0) | (6.0,7.0) |
     | --------------------|---------- |
 1   |     .         .     | (8.0,1.0) |
     *                                 *

The following is the 2 × 3 process grid:

B,D  |    0    |    1    |    2    
-----| ------- | ------- |------- 
0    |   P00   |   P01   |   P02
-----| ------- | ------- |------- 
1    |   P10   |   P11   |   P12

Local arrays for C:

p,q  |          0          |     1     |     2
-----|---------------------|-----------|-----------
     | (2.0,1.0) (1.0,9.0) | (4.0,5.0) |     .
 0   |     .     (3.0,1.0) | (6.0,7.0) |     .
-----|---------------------|-----------|-----------
 1   |     .         .     | (8.0,1.0) |     .

Output:

Global complex symmetric matrix C of order 3 with block size 2 × 2:


B,D                 0                      1
     *                                             *
 0   | (-57.0, 13.0) (-63.0, 79.0) | (-24.0, 70.0) | 
     |       .       (-28.0, 90.0) | (-55.0,103.0) |
     | ----------------------------|---------------|
 1   |       .             .       | ( 13.0, 75.0) |
     *                                             *

The following is the 2 × 3 process grid:

B,D  |    0    |    1    |    2    
-----| ------- | ------- |------- 
0    |   P00   |   P01   |   P02
-----| ------- | ------- |------- 
1    |   P10   |   P11   |   P12

Local arrays for C:


p,q  |              0              |       1       |       2
-----|-----------------------------|---------------|---------------
     | (-57.0, 13.0) (-63.0, 79.0) | (-24.0, 70.0) |       .   
 0   |       .       (-28.0, 90.0) | (-55.0,103.0) |       .
-----|-----------------------------|---------------|---------------
 1   |       .             .       | ( 13.0, 75.0) |       .

Example 3

This example computes C = alphaAHA+betaC using a 3 × 2 process grid.

Note:
On output, the imaginary parts of the diagonal elements of a complex Hermitian matrix are set to zero, except when beta is one and alpha or k is zero.

Call Statements and Input


 ORDER = 'R'
 NPROW = 3
 NPCOL = 2
 CALL BLACS_GET (0, 0, ICONTXT)
 CALL BLACS_GRIDINIT(ICONTXT, ORDER, NPROW, NPCOL)
 CALL BLACS_GRIDINFO(ICONTXT, NPROW, NPCOL, MYROW, MYCOL)
 
             UPLO   TRANS   N    K     ALPHA    A  IA  JA    DESC_A    BETA
               |      |     |    |       |      |   |   |      |         |
 CALL PZHERK( 'L' ,  'C' ,  3  , 5  ,  ALPHA  , A , 1 , 1 ,  DESC_A ,  BETA ,
 
               C  IC  JC   DESC_C
               |   |   |     |
               C , 1 , 1 , DESC_C )
 
               ALPHA = 1.0
 
               BETA  = 1.0


Desc_A Desc_C
DTYPE_ 1 1
CTXT_ icontxt(IOBG28) icontxt(IOBG28)
M_ 5 3
N_ 3 3
MB_ 2 2
NB_ 2 2
RSRC_ 0 0
CSRC_ 0 0
LLD_ See below(EPSSL28) See below(EPSSL28)

Notes:

  1. icontxt is the output of the BLACS_GRIDINIT call.

  2. Each process should set the LLD_ as follows:
    LLD_A = MAX(1,NUMROC(M_A, MB_A, MYROW, RSRC_A, NPROW))
    LLD_C = MAX(1,NUMROC(M_C, MB_C, MYROW, RSRC_C, NPROW))
    

    In this example:
    LLD_A = 2 on P00, P01, P10, and P11
    LLD_A = 1 on P20 and P21
    LLD_C = 2 on P00 and P01
    LLD_C = 1 on P10 and P11

Global general 5 × 3 matrix A with block size 2 × 2:

B,D             0                1
     *                                 *
 0   | (2.0,0.0) (3.0,2.0) | (4.0,1.0) |
     | (3.0,3.0) (8.0,0.0) | (2.0,5.0) |
     | --------------------|-----------|
 1   | (1.0,3.0) (2.0,1.0) | (6.0,0.0) |
     | (3.0,3.0) (8.0,0.0) | (2.0,5.0) |
     | --------------------|-----------|
 2   | (1.0,9.0) (3.0,0.0) | (6.0,7.0) |
     *                                 *

The following is the 3 × 2 process grid:

B,D  |    0    |  1  
-----| ------- |-----
0    |   P00   |  P01
-----| ------- |-----
1    |   P10   |  P11
-----| ------- |-----
2    |   P20   |  P21

Local arrays for A:

p,q  |          0          |     1     |
-----|---------------------|-----------|
     | (2.0,0.0) (3.0,2.0) | (4.0,1.0) |
 0   | (3.0,3.0) (8.0,0.0) | (2.0,5.0) |
-----|---------------------|-----------|
     | (1.0,3.0) (2.0,1.0) | (6.0,0.0) |
 1   | (3.0,3.0) (8.0,0.0) | (2.0,5.0) |
-----|---------------------|-----------|
 2   | (1.0,9.0) (3.0,0.0) | (6.0,7.0) |
-----|---------------------|-----------|

Global complex Hermitian matrix C of order 3 with block size 2 × 2:

B,D             0              1
     *                                  *
 0   | (6.0,0.0)      .     |     .     |
     | (3.0,4.0) (10.0,0.0) |     .     |
     | ---------------------|-----------|
 1   | (9.0,1.0) (12.0,2.0) | (3.0,0.0) |
     *                                  *

The following is the 3 × 2 process grid:

B,D  |    0    |  1  
-----| ------- |-----
0    |   P00   |  P01
-----| ------- |-----
1    |   P10   |  P11
-----| ------- |-----
--   |   P20   |  P21

Local arrays for C:

p,q  |          0           |     1     |
-----|----------------------|-----------|
     | (6.0, . )      .     |     .     |
 0   | (3.0,4.0) (10.0, . ) |     .     |
-----|----------------------|-----------|
 1   | (9.0,1.0) (12.0,2.0) | (3.0, . ) |
-----|----------------------|-----------|
 2   |     .          .     |     .     |

Output:

Global complex Hermitian matrix C of order 3 with block size 2 × 2:


B,D                 0                      1
     *                                             *
 0   | (138.0,  0.0)       .       |       .       |
     | ( 65.0, 80.0) (165.0,  0.0) |       .       |
     | ----------------------------|---------------|
 1   | (134.0, 46.0) ( 88.0,-88.0) | (199.0,  0.0) |
     *                                             *

The following is the 3 × 2 process grid:

B,D  |    0    |  1  
-----| ------- |-----
0    |   P00   |  P01
-----| ------- |-----
1    |   P10   |  P11
-----| ------- |-----
--   |   P20   |  P21

Local arrays for C:


p,q  |              0              |       1       |
-----|-----------------------------|---------------|
     | (138.0,  0.0)       .       |       .       |
 0   | ( 65.0, 80.0) (165.0,  0.0) |       .       |
-----|-----------------------------|---------------|
 1   | (134.0, 46.0) ( 88.0,-88.0) | (199.0,  0.0) |
-----|-----------------------------|---------------|
 2   |       .             .       |       .       |


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