ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
PB_Cfirstnb.c
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------
2 *
3 * -- PBLAS auxiliary routine (version 2.0) --
4 * University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5 * and University of California, Berkeley.
6 * April 1, 1998
7 *
8 * ---------------------------------------------------------------------
9 */
10 /*
11 * Include files
12 */
13 #include "../pblas.h"
14 #include "../PBpblas.h"
15 #include "../PBtools.h"
16 #include "../PBblacs.h"
17 #include "../PBblas.h"
18 
19 #ifdef __STDC__
20 int PB_Cfirstnb( int N, int I, int INB, int NB )
21 #else
22 int PB_Cfirstnb( N, I, INB, NB )
23 /*
24 * .. Scalar Arguments ..
25 */
26  int I, INB, N, NB;
27 #endif
28 {
29 /*
30 * Purpose
31 * =======
32 *
33 * PB_Cfirstnb returns the global number of matrix rows or columns of the
34 * first block, if N rows or columns are given out starting from the
35 * global index I. Note that if N is equal 0, this routine returns 0.
36 *
37 * Arguments
38 * =========
39 *
40 * N (global input) INTEGER
41 * On entry, N specifies the number of rows/columns being dealt
42 * out. N must be at least zero.
43 *
44 * I (global input) INTEGER
45 * On entry, I specifies the global index of the matrix entry.
46 * I must be at least zero.
47 *
48 * INB (global input) INTEGER
49 * On entry, INB specifies the size of the first block of the
50 * global matrix distribution. INB must be at least one.
51 *
52 * NB (global input) INTEGER
53 * On entry, NB specifies the size of the blocks used to parti-
54 * tion the matrix. NB must be at least one.
55 *
56 * -- Written on April 1, 1998 by
57 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
58 *
59 * ---------------------------------------------------------------------
60 */
61 /*
62 * .. Local Scalars ..
63 */
64  int inbt;
65 /* ..
66 * .. Executable Statements ..
67 *
68 */
69  inbt = ( ( INB -= I ) <= 0 ? ( (-INB) / NB + 1 ) * NB + INB : INB );
70  return( MIN( inbt, N ) );
71 /*
72 * End of PB_Cfirstnb
73 */
74 }
PB_Cfirstnb
int PB_Cfirstnb(int N, int I, int INB, int NB)
Definition: PB_Cfirstnb.c:22
MIN
#define MIN(a_, b_)
Definition: PBtools.h:76