ScaLAPACK  2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
PB_Cspan.c
Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------
00002 *
00003 *  -- PBLAS auxiliary routine (version 2.0) --
00004 *     University of Tennessee, Knoxville, Oak Ridge National Laboratory,
00005 *     and University of California, Berkeley.
00006 *     April 1, 1998
00007 *
00008 *  ---------------------------------------------------------------------
00009 */
00010 /*
00011 *  Include files
00012 */
00013 #include "../pblas.h"
00014 #include "../PBpblas.h"
00015 #include "../PBtools.h"
00016 #include "../PBblacs.h"
00017 #include "../PBblas.h"
00018 
00019 #ifdef __STDC__
00020 int PB_Cspan( int N, int I, int INB, int NB, int SRCPROC, int NPROCS )
00021 #else
00022 int PB_Cspan( N, I, INB, NB, SRCPROC, NPROCS )
00023 /*
00024 *  .. Scalar Arguments ..
00025 */
00026    int            I, INB, N, NB, NPROCS, SRCPROC;
00027 #endif
00028 {
00029 /*
00030 *  Purpose
00031 *  =======
00032 *
00033 *  PB_Cspan  returns  1  if  the rows (resp. columns) I:I+N-1 spans more
00034 *  than one process row (resp. column) and 0 otherwise.
00035 *
00036 *  Arguments
00037 *  =========
00038 *
00039 *  N       (global input) INTEGER
00040 *          On entry, N  specifies the number of rows/columns being dealt
00041 *          out. N must be at least zero.
00042 *
00043 *  I       (global input) INTEGER
00044 *          On entry, I  specifies the global index of the matrix  entry.
00045 *          I must be at least zero.
00046 *
00047 *  INB     (global input) INTEGER
00048 *          On entry,  INB  specifies  the size of the first block of the
00049 *          global matrix distribution. INB must be at least one.
00050 *
00051 *  NB      (global input) INTEGER
00052 *          On entry, NB specifies the size of the blocks used to  parti-
00053 *          tion the matrix. NB must be at least one.
00054 *
00055 *  SRCPROC (global input) INTEGER
00056 *          On entry, if SRCPROC = -1, the data  is not  distributed  but
00057 *          replicated,  in  which  case  this  routine return 0.
00058 *
00059 *  NPROCS  (global input) INTEGER
00060 *          On entry,  NPROCS  specifies the total number of process rows
00061 *          or columns over which the matrix is distributed.  NPROCS must
00062 *          be at least one.
00063 *
00064 *  -- Written on April 1, 1998 by
00065 *     Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
00066 *
00067 *  ---------------------------------------------------------------------
00068 */
00069 /* ..
00070 *  .. Executable Statements ..
00071 *
00072 */
00073 /*
00074 *  If the data is replicated or if there is only one process in this dimension
00075 *  of the process grid, the data does not span multiple processes. Finally, the
00076 *  case where I belongs to the first block is handled separately.
00077 */
00078    return( ( SRCPROC >= 0 ) &&
00079              ( ( NPROCS > 1 ) &&
00080                ( ( I < INB ) ? ( I + N > INB ) :
00081                  ( I + N > INB + ( ( I - INB ) / NB + 1 ) * NB ) ) ) );
00082 /*
00083 *  End of PB_Cspan
00084 */
00085 }