ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
pzelset.f
Go to the documentation of this file.
1  SUBROUTINE pzelset( A, IA, JA, DESCA, ALPHA )
2 *
3 * -- ScaLAPACK tools routine (version 1.7) --
4 * University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5 * and University of California, Berkeley.
6 * May 1, 1997
7 *
8 * .. Scalar Arguments ..
9  INTEGER IA, JA
10  COMPLEX*16 ALPHA
11 * ..
12 * .. Array arguments ..
13  INTEGER DESCA( * )
14  COMPLEX*16 A( * )
15 * ..
16 *
17 * Purpose
18 * =======
19 *
20 * PZELSET sets the distributed matrix entry A( IA, JA ) to ALPHA.
21 *
22 * Notes
23 * =====
24 *
25 * Each global data object is described by an associated description
26 * vector. This vector stores the information required to establish
27 * the mapping between an object element and its corresponding process
28 * and memory location.
29 *
30 * Let A be a generic term for any 2D block cyclicly distributed array.
31 * Such a global array has an associated description vector DESCA.
32 * In the following comments, the character _ should be read as
33 * "of the global array".
34 *
35 * NOTATION STORED IN EXPLANATION
36 * --------------- -------------- --------------------------------------
37 * DTYPE_A(global) DESCA( DTYPE_ )The descriptor type. In this case,
38 * DTYPE_A = 1.
39 * CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
40 * the BLACS process grid A is distribu-
41 * ted over. The context itself is glo-
42 * bal, but the handle (the integer
43 * value) may vary.
44 * M_A (global) DESCA( M_ ) The number of rows in the global
45 * array A.
46 * N_A (global) DESCA( N_ ) The number of columns in the global
47 * array A.
48 * MB_A (global) DESCA( MB_ ) The blocking factor used to distribute
49 * the rows of the array.
50 * NB_A (global) DESCA( NB_ ) The blocking factor used to distribute
51 * the columns of the array.
52 * RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
53 * row of the array A is distributed.
54 * CSRC_A (global) DESCA( CSRC_ ) The process column over which the
55 * first column of the array A is
56 * distributed.
57 * LLD_A (local) DESCA( LLD_ ) The leading dimension of the local
58 * array. LLD_A >= MAX(1,LOCr(M_A)).
59 *
60 * Let K be the number of rows or columns of a distributed matrix,
61 * and assume that its process grid has dimension p x q.
62 * LOCr( K ) denotes the number of elements of K that a process
63 * would receive if K were distributed over the p processes of its
64 * process column.
65 * Similarly, LOCc( K ) denotes the number of elements of K that a
66 * process would receive if K were distributed over the q processes of
67 * its process row.
68 * The values of LOCr() and LOCc() may be determined via a call to the
69 * ScaLAPACK tool function, NUMROC:
70 * LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ),
71 * LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ).
72 * An upper bound for these quantities may be computed by:
73 * LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A
74 * LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A
75 *
76 * Arguments
77 * =========
78 *
79 * A (local output) COMPLEX*16 pointer into the local memory
80 * to an array of dimension (LLD_A,*) containing the local
81 * pieces of the distributed matrix A.
82 *
83 * IA (global input) INTEGER
84 * The row index in the global array A indicating the first
85 * row of sub( A ).
86 *
87 * JA (global input) INTEGER
88 * The column index in the global array A indicating the
89 * first column of sub( A ).
90 *
91 * DESCA (global and local input) INTEGER array of dimension DLEN_.
92 * The array descriptor for the distributed matrix A.
93 *
94 * ALPHA (local input) COMPLEX*16
95 * The scalar alpha.
96 *
97 * =====================================================================
98 *
99 * .. Parameters ..
100  INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
101  $ LLD_, MB_, M_, NB_, N_, RSRC_
102  parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
103  $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
104  $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
105 * ..
106 * .. Local Scalars ..
107  INTEGER IACOL, IAROW, IIA, JJA, MYCOL, MYROW, NPCOL,
108  $ NPROW
109 * ..
110 * .. External Subroutines ..
111  EXTERNAL blacs_gridinfo, infog2l
112 * ..
113 * .. Executable Statements ..
114 *
115 * Get grid parameters.
116 *
117  CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
118 *
119  CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
120  $ iarow, iacol )
121 *
122  IF( myrow.EQ.iarow .AND. mycol.EQ.iacol )
123  $ a( iia+(jja-1)*desca( lld_ ) ) = alpha
124 *
125  RETURN
126 *
127 * End of PZELSET
128 *
129  END
infog2l
subroutine infog2l(GRINDX, GCINDX, DESC, NPROW, NPCOL, MYROW, MYCOL, LRINDX, LCINDX, RSRC, CSRC)
Definition: infog2l.f:3
pzelset
subroutine pzelset(A, IA, JA, DESCA, ALPHA)
Definition: pzelset.f:2