LAPACK 3.3.0

dzsum1.f

Go to the documentation of this file.
00001       DOUBLE PRECISION FUNCTION DZSUM1( N, CX, INCX )
00002 *
00003 *  -- LAPACK auxiliary routine (version 3.2) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            INCX, N
00010 *     ..
00011 *     .. Array Arguments ..
00012       COMPLEX*16         CX( * )
00013 *     ..
00014 *
00015 *  Purpose
00016 *  =======
00017 *
00018 *  DZSUM1 takes the sum of the absolute values of a complex
00019 *  vector and returns a double precision result.
00020 *
00021 *  Based on DZASUM from the Level 1 BLAS.
00022 *  The change is to use the 'genuine' absolute value.
00023 *
00024 *  Contributed by Nick Higham for use with ZLACON.
00025 *
00026 *  Arguments
00027 *  =========
00028 *
00029 *  N       (input) INTEGER
00030 *          The number of elements in the vector CX.
00031 *
00032 *  CX      (input) COMPLEX*16 array, dimension (N)
00033 *          The vector whose elements will be summed.
00034 *
00035 *  INCX    (input) INTEGER
00036 *          The spacing between successive values of CX.  INCX > 0.
00037 *
00038 *  =====================================================================
00039 *
00040 *     .. Local Scalars ..
00041       INTEGER            I, NINCX
00042       DOUBLE PRECISION   STEMP
00043 *     ..
00044 *     .. Intrinsic Functions ..
00045       INTRINSIC          ABS
00046 *     ..
00047 *     .. Executable Statements ..
00048 *
00049       DZSUM1 = 0.0D0
00050       STEMP = 0.0D0
00051       IF( N.LE.0 )
00052      $   RETURN
00053       IF( INCX.EQ.1 )
00054      $   GO TO 20
00055 *
00056 *     CODE FOR INCREMENT NOT EQUAL TO 1
00057 *
00058       NINCX = N*INCX
00059       DO 10 I = 1, NINCX, INCX
00060 *
00061 *        NEXT LINE MODIFIED.
00062 *
00063          STEMP = STEMP + ABS( CX( I ) )
00064    10 CONTINUE
00065       DZSUM1 = STEMP
00066       RETURN
00067 *
00068 *     CODE FOR INCREMENT EQUAL TO 1
00069 *
00070    20 CONTINUE
00071       DO 30 I = 1, N
00072 *
00073 *        NEXT LINE MODIFIED.
00074 *
00075          STEMP = STEMP + ABS( CX( I ) )
00076    30 CONTINUE
00077       DZSUM1 = STEMP
00078       RETURN
00079 *
00080 *     End of DZSUM1
00081 *
00082       END
 All Files Functions