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