lsqr++/Lsqr.cpp
double dvec_norm2(dvec *vec)
{
  long   indx;
  double norm;
  
  norm = 0.0;

  for(indx = 0; indx < vec->length; indx++)
    norm += sqr(vec->elements[indx]);

  return sqrt(norm);
}
/*-------------------------------------------------------------------------*/
/*                                                                         */
/*  Define the function 'dvec_norm2()'.  This function takes a vector      */
/*  arguement and computes the Euclidean or L2 norm of this vector.  Note  */
/*  that this is a version of the BLAS function 'dnrm2()' rewritten to     */
/*  use the current data structures.                                       */
/*                                                                         */
/*-------------------------------------------------------------------------*/
Define the function 'dvec_norm2()'.  This function takes a vector
arguement and computes the Euclidean or L2 norm of this vector.  Note
that this is a version of the BLAS function 'dnrm2()' rewritten to
use the current data structures.
Define the function ' dvec_norm2 () ' . This function takes a vector arguement and computes the Euclidean or L2 norm of this vector . Note that this is a version of the BLAS function ' dnrm2 () ' rewritten to use the current data structures .
double dvec_norm2(dvec *vec)
{
  long   indx;
  double norm;
  norm = 0.0;
  for(indx = 0; indx < vec->length; indx++)
    norm += sqr(vec->elements[indx]);
  return sqrt(norm);
}
double dvec_norm2 ( dvec * vec ) { long indx ; double norm ; norm = 0.0 ; for ( indx = 0 ; indx < vec -> length ; indx ++ ) norm += sqr ( vec -> elements [ indx ] ) ; return sqrt ( norm ) ; }
Define the function 'dvec_norm2()'.
Define the function ' dvec_norm2 () ' .