kusano 2b45e8
      DOUBLE PRECISION FUNCTION DZNRM2F( N, X, INCX )
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      INTEGER                           INCX, N
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX*16                        X( * )
kusano 2b45e8
*     ..
kusano 2b45e8
*
kusano 2b45e8
*  DZNRM2 returns the euclidean norm of a vector via the function
kusano 2b45e8
*  name, so that
kusano 2b45e8
*
kusano 2b45e8
*     DZNRM2 := sqrt( conjg( x' )*x )
kusano 2b45e8
*
kusano 2b45e8
*
kusano 2b45e8
*
kusano 2b45e8
*  -- This version written on 25-October-1982.
kusano 2b45e8
*     Modified on 14-October-1993 to inline the call to ZLASSQ.
kusano 2b45e8
*     Sven Hammarling, Nag Ltd.
kusano 2b45e8
*
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      DOUBLE PRECISION      ONE         , ZERO
kusano 2b45e8
      PARAMETER           ( ONE = 1.0D+0, ZERO = 0.0D+0 )
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      INTEGER               IX
kusano 2b45e8
      DOUBLE PRECISION      NORM, SCALE, SSQ, TEMP
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC             ABS, DIMAG, DBLE, SQRT
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
      IF( N.LT.1 .OR. INCX.LT.1 )THEN
kusano 2b45e8
         NORM  = ZERO
kusano 2b45e8
      ELSE
kusano 2b45e8
         SCALE = ZERO
kusano 2b45e8
         SSQ   = ONE
kusano 2b45e8
*        The following loop is equivalent to this call to the LAPACK
kusano 2b45e8
*        auxiliary routine:
kusano 2b45e8
*        CALL ZLASSQ( N, X, INCX, SCALE, SSQ )
kusano 2b45e8
*
kusano 2b45e8
         DO 10, IX = 1, 1 + ( N - 1 )*INCX, INCX
kusano 2b45e8
            IF( DBLE( X( IX ) ).NE.ZERO )THEN
kusano 2b45e8
               TEMP = ABS( DBLE( X( IX ) ) )
kusano 2b45e8
               IF( SCALE.LT.TEMP )THEN
kusano 2b45e8
                  SSQ   = ONE   + SSQ*( SCALE/TEMP )**2
kusano 2b45e8
                  SCALE = TEMP
kusano 2b45e8
               ELSE
kusano 2b45e8
                  SSQ   = SSQ   +     ( TEMP/SCALE )**2
kusano 2b45e8
               END IF
kusano 2b45e8
            END IF
kusano 2b45e8
            IF( DIMAG( X( IX ) ).NE.ZERO )THEN
kusano 2b45e8
               TEMP = ABS( DIMAG( X( IX ) ) )
kusano 2b45e8
               IF( SCALE.LT.TEMP )THEN
kusano 2b45e8
                  SSQ   = ONE   + SSQ*( SCALE/TEMP )**2
kusano 2b45e8
                  SCALE = TEMP
kusano 2b45e8
               ELSE
kusano 2b45e8
                  SSQ   = SSQ   +     ( TEMP/SCALE )**2
kusano 2b45e8
               END IF
kusano 2b45e8
            END IF
kusano 2b45e8
   10    CONTINUE
kusano 2b45e8
         NORM  = SCALE * SQRT( SSQ )
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
      DZNRM2F = NORM
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of DZNRM2.
kusano 2b45e8
*
kusano 2b45e8
      END