next up previous contents
Next: Notes for SCAL Up: Speeding up the Level Previous: Notes for IAMAX   Contents

Notes for NRM2

  1. Performs $nrm2 \leftarrow \vert\vert x \vert\vert _ {2} $
  2. An index file input line looks like:
    <ID> <incX> <source file> <author name>
    

  3. For complex, if both vectors have unit stride, the real routine is called with 2*N.

  4. The user should be aware that this routine was originally added to the BLAS mostly for accuracy concerns, not for optimization. The simple implementation of this routine:
       for (nrm2=0.0, i=0; i < N; i++, X += incX) nrm2 += *X * *X;
       return(sqrt(nrm2));
    
    will needlessly overflow for half of the exponent range. Thus, a good implementation must either use extended precision or a scaling algorithm (such as the sum of squares used in the reference BLAS) to prevent overflow in the squaring process.



R. Clint Whaley 2001-08-04