20 void pscnrm2_(
int * N,
float * NORM2,
21 float * X,
int * IX,
int * JX,
int * DESCX,
int * INCX )
23 void pscnrm2_( N, NORM2, X, IX, JX, DESCX, INCX )
27 int * INCX, * IX, * JX, * N;
175 char * Xptr = NULL, top;
176 int Xcol, Xi, Xii, Xj, Xjj, Xld, Xnp, Xnq, Xrow, ctxt, dst, dist,
177 info, k, mycol, mydist, myrow, npcol, nprow, src, size;
178 float Xtmp, scale, ssq, temp1, temp2;
195 if( !( info = ( ( nprow == -1 ) ? -( 601 +
CTXT_ ) : 0 ) ) )
196 PB_Cchkvec( ctxt,
"PSCNRM2",
"X", *N, 1, Xi, Xj, Xd, *INCX, 6, &info );
197 if( info ) {
PB_Cabort( ctxt,
"PSCNRM2", info );
return; }
206 if( *N == 0 )
return;
216 PB_Cinfog2l( Xi, Xj, Xd, nprow, npcol, myrow, mycol, &Xii, &Xjj,
221 if( ( *N == 1 ) && ( *INCX == 1 ) && ( Xd[
M_] == 1 ) )
226 if( ( ( myrow == Xrow ) || ( Xrow < 0 ) ) &&
227 ( ( mycol == Xcol ) || ( Xcol < 0 ) ) )
232 Xptr =
Mptr( ((
char *) X), Xii, Xjj, Xd[
LLD_], type->
size );
239 temp2 = scale / temp1;
240 ssq =
ONE + ssq * ( temp2 * temp2 );
245 temp2 = temp1 / scale;
246 ssq = ssq + ( temp2 * temp2 );
255 temp2 = scale / temp1;
256 ssq =
ONE + ssq * ( temp2 * temp2 );
261 temp2 = temp1 / scale;
262 ssq = ssq + ( temp2 * temp2 );
272 else if( *INCX == Xd[
M_] )
277 if( ( myrow == Xrow ) || ( Xrow < 0 ) )
292 Xptr =
Mptr( ((
char *) X), Xii, Xjj, Xld, size );
294 for( k = 0; k < Xnq; k++ )
302 temp2 = scale / temp1;
303 ssq =
ONE + ssq * ( temp2 * temp2 );
308 temp2 = temp1 / scale;
309 ssq = ssq + ( temp2 * temp2 );
318 temp2 = scale / temp1;
319 ssq =
ONE + ssq * ( temp2 * temp2 );
324 temp2 = temp1 / scale;
325 ssq = ssq + ( temp2 * temp2 );
334 if( ( npcol >= 2 ) && ( Xcol >= 0 ) )
348 dist = k * ( mydist - 1 );
350 Csgesd2d( ctxt, 2, 1, ((
char*) work), 2, myrow, dst );
360 Csgerv2d( ctxt, 2, 1, ((
char*)&work[2]), 2, myrow, src );
361 if( work[0] >= work[2] )
363 if( work[0] !=
ZERO )
365 temp1 = work[2] / work[0];
366 work[1] = work[1] + ( temp1 * temp1 ) * work[3];
371 temp1 = work[0] / work[2];
372 work[1] = work[3] + ( temp1 * temp1 ) * work[1];
380 if( k < npcol )
goto l_10;
389 Csgebs2d( ctxt,
ROW, &top, 2, 1, ((
char*)work), 2 );
399 sasqrtb_( &work[0], &work[1], NORM2 );
416 if( ( mycol == Xcol ) || ( Xcol < 0 ) )
430 Xptr =
Mptr( ((
char *) X), Xii, Xjj, Xd[
LLD_], size );
432 for( k = 0; k < Xnp; k++ )
440 temp2 = scale / temp1;
441 ssq =
ONE + ssq * ( temp2 * temp2 );
446 temp2 = temp1 / scale;
447 ssq = ssq + ( temp2 * temp2 );
456 temp2 = scale / temp1;
457 ssq =
ONE + ssq * ( temp2 * temp2 );
462 temp2 = temp1 / scale;
463 ssq = ssq + ( temp2 * temp2 );
472 if( ( nprow >= 2 ) && ( Xrow >= 0 ) )
486 dist = k * ( mydist - 1 );
488 Csgesd2d( ctxt, 2, 1, ((
char*)work), 2, dst, mycol );
498 Csgerv2d( ctxt, 2, 1, ((
char*)&work[2]), 2, src, mycol );
499 if( work[0] >= work[2] )
501 if( work[0] !=
ZERO )
503 temp1 = work[2] / work[0];
504 work[1] = work[1] + ( temp1 * temp1 ) * work[3];
509 temp1 = work[0] / work[2];
510 work[1] = work[3] + ( temp1 * temp1 ) * work[1];
518 if( k < nprow )
goto l_30;
537 sasqrtb_( &work[0], &work[1], NORM2 );