14 #include "../PBpblas.h"
15 #include "../PBtools.h"
16 #include "../PBblacs.h"
17 #include "../PBblas.h"
20 void PB_Cchkvec(
int ICTXT,
char * ROUT,
char * VNAME,
int N,
int NPOS0,
21 int IX,
int JX,
int * DESCX,
int INCX,
int DPOS0,
24 void PB_Cchkvec( ICTXT, ROUT, VNAME, N, NPOS0, IX, JX, DESCX, INCX,
29 int DPOS0, ICTXT, IX, * INFO, INCX, JX, N, NPOS0;
108 int dpos, icpos, ixpos, jxpos, mycol, myrow, np, npcol, npos,
118 if( *INFO >= 0 ) *INFO =
BIGNUM;
119 else if( *INFO < -
DESCMULT ) *INFO = -(*INFO);
142 *INFO =
MIN( *INFO, npos );
143 PB_Cwarn( ICTXT, -1, ROUT,
"%s sub( %s ) = %d, it must be at least 0",
144 "Illegal length of", VNAME, N );
152 *INFO =
MIN( *INFO, ixpos );
153 PB_Cwarn( ICTXT, -1, ROUT,
"Illegal I%s = %d, I%s must be at least 1",
154 VNAME, IX+1, VNAME );
161 *INFO =
MIN( *INFO, jxpos );
162 PB_Cwarn( ICTXT, -1, ROUT,
"Illegal J%s = %d, J%s must be at least 1",
163 VNAME, JX+1, VNAME );
172 PB_Cwarn( ICTXT, -1, ROUT,
"%s %d for matrix %s. PBLAS accepts: %d or %d",
173 "Illegal descriptor type", DESCX[
DTYPE_], VNAME,
176 else *INFO = -(*INFO);
183 if( DESCX[
CTXT_] != ICTXT )
190 PB_Cwarn( ICTXT, -1, ROUT,
"DESC%s[CTXT_] = %d %s= %d", VNAME,
191 DESCX[
CTXT_],
"does not match other operand's context ",
194 else *INFO = -(*INFO);
201 if( DESCX[
IMB_] < 1 )
206 *INFO =
MIN( *INFO, dpos +
IMB_ );
207 PB_Cwarn( ICTXT, -1, ROUT,
"Illegal DESC%s[IMB_] = %d, DESC%s[IMB_] %s",
208 VNAME, DESCX[
IMB_], VNAME,
"must be at least 1" );
210 if( DESCX[
INB_] < 1 )
215 *INFO =
MIN( *INFO, dpos +
INB_ );
216 PB_Cwarn( ICTXT, -1, ROUT,
"Illegal DESC%s[INB_] = %d, DESC%s[INB_] %s",
217 VNAME, DESCX[
INB_], VNAME,
"must be at least 1" );
224 *INFO =
MIN( *INFO, dpos +
MB_ );
225 PB_Cwarn( ICTXT, -1, ROUT,
"Illegal DESC%s[MB_] = %d, DESC%s[MB_] %s",
226 VNAME, DESCX[
MB_], VNAME,
"must be at least 1" );
233 *INFO =
MIN( *INFO, dpos +
NB_ );
234 PB_Cwarn( ICTXT, -1, ROUT,
"Illegal DESC%s[NB_] = %d, DESC%s[NB_] %s",
235 VNAME, DESCX[
NB_], VNAME,
"must be at least 1" );
238 if( ( DESCX[
RSRC_] < -1 ) || ( DESCX[
RSRC_] >= nprow ) )
245 "Illegal DESC%s[RSRC_] = %d, DESC%s[RSRC_] %s%d", VNAME,
246 DESCX[
RSRC_], VNAME,
"must be either -1, or >= 0 and < ",
249 if( ( DESCX[
CSRC_] < -1 ) || ( DESCX[
CSRC_] >= npcol ) )
256 "Illegal DESC%s[CSRC_] = %d, DESC%s[CSRC_] %s%d", VNAME,
257 DESCX[
CSRC_], VNAME,
"must be either -1, or >= 0 and < ",
261 if( INCX != 1 && INCX != DESCX[
M_] )
266 *INFO =
MIN( *INFO, icpos );
268 "Illegal INC%s = %d, INC%s should be either 1 or %d", VNAME,
282 *INFO =
MIN( *INFO, dpos +
M_ );
283 PB_Cwarn( ICTXT, -1, ROUT,
"DESC%s[M_] = %d, it must be at least 0",
292 *INFO =
MIN( *INFO, dpos +
N_ );
293 PB_Cwarn( ICTXT, -1, ROUT,
"DESC%s[N_] = %d, it must be at least 0",
297 if( DESCX[
LLD_] < 1 )
302 *INFO =
MIN( *INFO, dpos +
LLD_ );
303 PB_Cwarn( ICTXT, -1, ROUT,
"DESC%s[LLD_] = %d, it must be at least 1",
304 VNAME, DESCX[
LLD_] );
317 *INFO =
MIN( *INFO, dpos +
M_ );
319 "Illegal DESC%s[M_] = %d, it must be at least 1", VNAME,
328 *INFO =
MIN( *INFO, dpos +
N_ );
330 "Illegal DESC%s[N_] = %d, it must be at least 1", VNAME,
334 if( ( DESCX[
M_] >= 1 ) && ( DESCX[
N_] >= 1 ) )
336 if( INCX == DESCX[
M_] )
341 if( IX >= DESCX[
M_] )
346 *INFO =
MIN( *INFO, ixpos );
347 PB_Cwarn( ICTXT, -1, ROUT,
"%s I%s = %d, DESC%s[M_] = %d",
348 "Array subscript out of bounds:", VNAME, IX+1, VNAME,
351 if( JX+N > DESCX[
N_] )
356 *INFO =
MIN( *INFO, jxpos );
358 "%s N = %d, J%s = %d, DESC%s[N_] = %d",
359 "Operation out of bounds:", N, VNAME, JX+1, VNAME,
368 if( JX >= DESCX[
N_] )
373 *INFO =
MIN( *INFO, jxpos );
374 PB_Cwarn( ICTXT, -1, ROUT,
"%s J%s = %d, DESC%s[N_] = %d",
375 "Array subscript out of bounds:", VNAME, JX+1, VNAME,
378 if( IX+N > DESCX[
M_] )
383 *INFO =
MIN( *INFO, ixpos );
385 "%s N = %d, I%s = %d, DESC%s[M_] = %d",
386 "Operation out of bounds:", N, VNAME, IX+1, VNAME,
397 DESCX[
RSRC_], nprow );
398 if( DESCX[
LLD_] <
MAX( 1, np ) )
401 DESCX[
CSRC_], npcol );
406 if( DESCX[
LLD_] < 1 )
408 *INFO =
MIN( *INFO, dpos +
LLD_ );
410 "DESC%s[LLD_] = %d, it must be at least 1", VNAME,
419 *INFO =
MIN( *INFO, dpos +
LLD_ );
421 "DESC%s[LLD_] = %d, it must be at least %d", VNAME,
431 if( *INFO ==
BIGNUM ) *INFO = 0;
433 else *INFO = -(*INFO);