SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ PB_Cbinfo()

void PB_Cbinfo ( Int  OFFD,
Int  M,
Int  N,
Int  IMB1,
Int  INB1,
Int  MB,
Int  NB,
Int  MRROW,
Int  MRCOL,
Int LCMT00,
Int MBLKS,
Int NBLKS,
Int IMBLOC,
Int INBLOC,
Int LMBLOC,
Int LNBLOC,
Int ILOW,
Int LOW,
Int IUPP,
Int UPP 
)

Definition at line 25 of file PB_Cbinfo.c.

35{
36/*
37* Purpose
38* =======
39*
40* PB_Cbinfo initializes the local information of an m by n local array
41* owned by the process of relative coordinates ( MRROW, MRCOL ). Note
42* that if m or n is less or equal than zero, there is no data, in which
43* case this process does not need the local information computed by
44* this routine to proceed.
45*
46* Arguments
47* =========
48*
49* OFFD (global input) INTEGER
50* On entry, OFFD specifies the off-diagonal of the underlying
51* matrix of interest as follows:
52* OFFD = 0 specifies the main diagonal,
53* OFFD > 0 specifies lower subdiagonals, and
54* OFFD < 0 specifies upper superdiagonals.
55*
56* M (local input) INTEGER
57* On entry, M specifies the local number of rows of the under-
58* lying matrix owned by the process of relative coordinates
59* ( MRROW, MRCOL ). M must be at least zero.
60*
61* N (local input) INTEGER
62* On entry, N specifies the local number of columns of the un-
63* derlying matrix owned by the process of relative coordinates
64* ( MRROW, MRCOL ). N must be at least zero.
65*
66* IMB1 (global input) INTEGER
67* On input, IMB1 specifies the global true size of the first
68* block of rows of the underlying global submatrix. IMB1 must
69* be at least MIN( 1, M ).
70*
71* INB1 (global input) INTEGER
72* On input, INB1 specifies the global true size of the first
73* block of columns of the underlying global submatrix. INB1
74* must be at least MIN( 1, N ).
75*
76* MB (global input) INTEGER
77* On entry, MB specifies the blocking factor used to partition
78* the rows of the matrix. MB must be at least one.
79*
80* NB (global input) INTEGER
81* On entry, NB specifies the blocking factor used to partition
82* the the columns of the matrix. NB must be at least one.
83*
84* MRROW (local input) INTEGER
85* On entry, MRROW specifies the relative row coordinate of the
86* process that possesses these M rows. MRROW must be least zero
87* and strictly less than NPROW.
88*
89* MRCOL (local input) INTEGER
90* On entry, MRCOL specifies the relative column coordinate of
91* the process that possesses these N columns. MRCOL must be
92* least zero and strictly less than NPCOL.
93*
94* LCMT00 (local output) INTEGER
95* On exit, LCMT00 is the LCM value of the left upper block of
96* this m by n local block owned by the process of relative co-
97* ordinates ( MRROW, MRCOL ).
98*
99* MBLKS (local output) INTEGER
100* On exit, MBLKS specifies the local number of blocks of rows
101* corresponding to M. MBLKS must be at least zero.
102*
103* NBLKS (local output) INTEGER
104* On exit, NBLKS specifies the local number of blocks of co-
105* lumns corresponding to N. NBLKS must be at least zero.
106*
107* IMBLOC (local output) INTEGER
108* On exit, IMBLOC specifies the number of rows (size) of the
109* uppest blocks of this m by n local array owned by the process
110* of relative coordinates ( MRROW, MRCOL ). IMBLOC is at least
111* MIN( 1, M ).
112*
113* INBLOC (local output) INTEGER
114* On exit, INBLOC specifies the number of columns (size) of
115* the leftmost blocks of this m by n local array owned by the
116* process of relative coordinates ( MRROW, MRCOL ). INBLOC is
117* at least MIN( 1, N ).
118*
119* LMBLOC (local output) INTEGER
120* On exit, LMBLOC specifies the number of rows (size) of the
121* lowest blocks of this m by n local array owned by the process
122* of relative coordinates ( MRROW, MRCOL ). LMBLOC is at least
123* MIN( 1, M ).
124*
125* LNBLOC (local output) INTEGER
126* On exit, LNBLOC specifies the number of columns (size) of the
127* rightmost blocks of this m by n local array owned by the
128* process of relative coordinates ( MRROW, MRCOL ). LNBLOC is
129* at least MIN( 1, N ).
130*
131* ILOW (local output) INTEGER
132* On exit, ILOW is the lower bound characterizing the first co-
133* lumn block owning offdiagonals of this m by n array. ILOW
134* must be less or equal than zero.
135*
136* LOW (global output) INTEGER
137* On exit, LOW is the lower bound characterizing the column
138* blocks with te exception of the first one (see ILOW) owning
139* offdiagonals of this m by n array. LOW must be less or equal
140* than zero.
141*
142* IUPP (local output) INTEGER
143* On exit, IUPP is the upper bound characterizing the first row
144* block owning offdiagonals of this m by n array. IUPP must be
145* greater or equal than zero.
146*
147* UPP (global output) INTEGER
148* On exit, UPP is the upper bound characterizing the row
149* blocks with te exception of the first one (see IUPP) owning
150* offdiagonals of this m by n array. UPP must be greater or
151* equal than zero.
152*
153* -- Written on April 1, 1998 by
154* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
155*
156* ---------------------------------------------------------------------
157*/
158/*
159* .. Local Scalars ..
160*/
161 Int tmp1;
162/* ..
163* .. Executable Statements ..
164*
165*/
166/*
167* Initialize LOW, ILOW, UPP, IUPP, LMBLOC, LNBLOC, IMBLOC, INBLOC, MBLKS,
168* NBLKS and LCMT00.
169*/
170 *LOW = 1 - NB;
171 *UPP = MB - 1;
172
173 *LCMT00 = OFFD;
174
175 if( ( M <= 0 ) || ( N <= 0 ) )
176 {
177/*
178* If the local virtual array is empty, then simplify the remaining of the
179* initialization.
180*/
181 *IUPP = ( MRROW ? MB - 1 : ( IMB1 > 0 ? IMB1 - 1 : 0 ) );
182 *IMBLOC = 0;
183 *MBLKS = 0;
184 *LMBLOC = 0;
185
186 *ILOW = ( MRCOL ? 1 - NB : ( INB1 > 0 ? 1 - INB1 : 0 ) );
187 *INBLOC = 0;
188 *NBLKS = 0;
189 *LNBLOC = 0;
190
191 *LCMT00 += ( *LOW - *ILOW + MRCOL * NB ) - ( *IUPP - *UPP + MRROW * MB );
192
193 return;
194 }
195
196 if( MRROW )
197 {
198/*
199* I am not in the first relative process row. Use the first local row block
200* size MB to initialize the VM structure.
201*/
202 *IMBLOC = MIN( M, MB );
203 *IUPP = MB - 1;
204 *LCMT00 -= IMB1 - MB + MRROW * MB;
205 *MBLKS = ( M - 1 ) / MB + 1;
206 *LMBLOC = M - ( M / MB ) * MB;
207 if( !( *LMBLOC ) ) *LMBLOC = MB;
208
209 if( MRCOL )
210 {
211/*
212* I am not in the first relative process column. Use the first local column
213* block size NB to initialize the VM structure.
214*/
215 *INBLOC = MIN( N, NB );
216 *ILOW = 1 - NB;
217 *LCMT00 += INB1 - NB + MRCOL * NB;
218 *NBLKS = ( N - 1 ) / NB + 1;
219 *LNBLOC = N - ( N / NB ) * NB;
220 if( !( *LNBLOC ) ) *LNBLOC = NB;
221 }
222 else
223 {
224/*
225* I am in the first relative process column. Use the first column block size
226* INB1 to initialize the VM structure.
227*/
228 *INBLOC = INB1;
229 *ILOW = 1 - INB1;
230 tmp1 = N - INB1;
231 if( tmp1 )
232 {
233/*
234* There is more than one column block. Compute the number of local column
235* blocks and the size of the last one.
236*/
237 *NBLKS = ( tmp1 - 1 ) / NB + 2;
238 *LNBLOC = tmp1 - ( tmp1 / NB ) * NB;
239 if( !( *LNBLOC ) ) *LNBLOC = NB;
240 }
241 else
242 {
243/*
244* There is only one column block.
245*/
246 *NBLKS = 1;
247 *LNBLOC = INB1;
248 }
249 }
250 }
251 else
252 {
253/*
254* I am in the first relative process row. Use the first row block size IMB1 to
255* initialize the VM structure.
256*/
257 *IMBLOC = IMB1;
258 *IUPP = IMB1 - 1;
259 tmp1 = M - IMB1;
260 if( tmp1 )
261 {
262/*
263* There is more than one row block. Compute the number of local row blocks and
264* the size of the last one.
265*/
266 *MBLKS = ( tmp1 - 1 ) / MB + 2;
267 *LMBLOC = tmp1 - ( tmp1 / MB ) * MB;
268 if( !( *LMBLOC ) ) *LMBLOC = MB;
269 }
270 else
271 {
272/*
273* There is only one row block.
274*/
275 *MBLKS = 1;
276 *LMBLOC = IMB1;
277 }
278
279 if( MRCOL )
280 {
281/*
282* I am not in the first relative process column. Use the first local column
283* block size NB to initialize the VM structure.
284*/
285 *INBLOC = MIN( N, NB );
286 *ILOW = 1 - NB;
287 *LCMT00 += INB1 - NB + MRCOL * NB;
288 *NBLKS = ( N - 1 ) / NB + 1;
289 *LNBLOC = N - ( N / NB ) * NB;
290 if( !( *LNBLOC ) ) *LNBLOC = NB;
291 }
292 else
293 {
294/*
295* I am in the first relative process column. Use the first column block size
296* INB1 to initialize the VM structure.
297*/
298 *INBLOC = INB1;
299 *ILOW = 1 - INB1;
300 tmp1 = N - INB1;
301 if( tmp1 )
302 {
303/*
304* There is more than one column block. Compute the number of local column
305* blocks and the size of the last one.
306*/
307 *NBLKS = ( tmp1 - 1 ) / NB + 2;
308 *LNBLOC = tmp1 - ( tmp1 / NB ) * NB;
309 if( !( *LNBLOC ) ) *LNBLOC = NB;
310 }
311 else
312 {
313/*
314* There is only one column block.
315*/
316 *NBLKS = 1;
317 *LNBLOC = INB1;
318 }
319 }
320 }
321/*
322* End of PB_Cbinfo
323*/
324}
#define Int
Definition Bconfig.h:22
#define MIN(a_, b_)
Definition PBtools.h:76