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