File:  [local] / rpl / lapack / blas / dznrm2.f
Revision 1.15: download - view: text, annotated - select for diffs - revision graph
Tue May 29 07:19:42 2018 UTC (5 years, 11 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_35, rpl-4_1_34, rpl-4_1_33, rpl-4_1_32, rpl-4_1_31, rpl-4_1_30, rpl-4_1_29, rpl-4_1_28, HEAD
Mise à jour de Blas.

    1: *> \brief \b DZNRM2
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at
    6: *            http://www.netlib.org/lapack/explore-html/
    7: *
    8: *  Definition:
    9: *  ===========
   10: *
   11: *       DOUBLE PRECISION FUNCTION DZNRM2(N,X,INCX)
   12: *
   13: *       .. Scalar Arguments ..
   14: *       INTEGER INCX,N
   15: *       ..
   16: *       .. Array Arguments ..
   17: *       COMPLEX*16 X(*)
   18: *       ..
   19: *
   20: *
   21: *> \par Purpose:
   22: *  =============
   23: *>
   24: *> \verbatim
   25: *>
   26: *> DZNRM2 returns the euclidean norm of a vector via the function
   27: *> name, so that
   28: *>
   29: *>    DZNRM2 := sqrt( x**H*x )
   30: *> \endverbatim
   31: *
   32: *  Arguments:
   33: *  ==========
   34: *
   35: *> \param[in] N
   36: *> \verbatim
   37: *>          N is INTEGER
   38: *>         number of elements in input vector(s)
   39: *> \endverbatim
   40: *>
   41: *> \param[in] X
   42: *> \verbatim
   43: *>          X is COMPLEX*16 array, dimension (N)
   44: *>         complex vector with N elements
   45: *> \endverbatim
   46: *>
   47: *> \param[in] INCX
   48: *> \verbatim
   49: *>          INCX is INTEGER
   50: *>         storage spacing between elements of X
   51: *> \endverbatim
   52: *
   53: *  Authors:
   54: *  ========
   55: *
   56: *> \author Univ. of Tennessee
   57: *> \author Univ. of California Berkeley
   58: *> \author Univ. of Colorado Denver
   59: *> \author NAG Ltd.
   60: *
   61: *> \date November 2017
   62: *
   63: *> \ingroup double_blas_level1
   64: *
   65: *> \par Further Details:
   66: *  =====================
   67: *>
   68: *> \verbatim
   69: *>
   70: *>  -- This version written on 25-October-1982.
   71: *>     Modified on 14-October-1993 to inline the call to ZLASSQ.
   72: *>     Sven Hammarling, Nag Ltd.
   73: *> \endverbatim
   74: *>
   75: *  =====================================================================
   76:       DOUBLE PRECISION FUNCTION DZNRM2(N,X,INCX)
   77: *
   78: *  -- Reference BLAS level1 routine (version 3.8.0) --
   79: *  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
   80: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
   81: *     November 2017
   82: *
   83: *     .. Scalar Arguments ..
   84:       INTEGER INCX,N
   85: *     ..
   86: *     .. Array Arguments ..
   87:       COMPLEX*16 X(*)
   88: *     ..
   89: *
   90: *  =====================================================================
   91: *
   92: *     .. Parameters ..
   93:       DOUBLE PRECISION ONE,ZERO
   94:       PARAMETER (ONE=1.0D+0,ZERO=0.0D+0)
   95: *     ..
   96: *     .. Local Scalars ..
   97:       DOUBLE PRECISION NORM,SCALE,SSQ,TEMP
   98:       INTEGER IX
   99: *     ..
  100: *     .. Intrinsic Functions ..
  101:       INTRINSIC ABS,DBLE,DIMAG,SQRT
  102: *     ..
  103:       IF (N.LT.1 .OR. INCX.LT.1) THEN
  104:           NORM = ZERO
  105:       ELSE
  106:           SCALE = ZERO
  107:           SSQ = ONE
  108: *        The following loop is equivalent to this call to the LAPACK
  109: *        auxiliary routine:
  110: *        CALL ZLASSQ( N, X, INCX, SCALE, SSQ )
  111: *
  112:           DO 10 IX = 1,1 + (N-1)*INCX,INCX
  113:               IF (DBLE(X(IX)).NE.ZERO) THEN
  114:                   TEMP = ABS(DBLE(X(IX)))
  115:                   IF (SCALE.LT.TEMP) THEN
  116:                       SSQ = ONE + SSQ* (SCALE/TEMP)**2
  117:                       SCALE = TEMP
  118:                   ELSE
  119:                       SSQ = SSQ + (TEMP/SCALE)**2
  120:                   END IF
  121:               END IF
  122:               IF (DIMAG(X(IX)).NE.ZERO) THEN
  123:                   TEMP = ABS(DIMAG(X(IX)))
  124:                   IF (SCALE.LT.TEMP) THEN
  125:                       SSQ = ONE + SSQ* (SCALE/TEMP)**2
  126:                       SCALE = TEMP
  127:                   ELSE
  128:                       SSQ = SSQ + (TEMP/SCALE)**2
  129:                   END IF
  130:               END IF
  131:    10     CONTINUE
  132:           NORM = SCALE*SQRT(SSQ)
  133:       END IF
  134: *
  135:       DZNRM2 = NORM
  136:       RETURN
  137: *
  138: *     End of DZNRM2.
  139: *
  140:       END

CVSweb interface <joel.bertrand@systella.fr>