LAPACK 3.3.1
Linear Algebra PACKage

scasum.f

Go to the documentation of this file.
00001       REAL FUNCTION SCASUM(N,CX,INCX)
00002 *     .. Scalar Arguments ..
00003       INTEGER INCX,N
00004 *     ..
00005 *     .. Array Arguments ..
00006       COMPLEX CX(*)
00007 *     ..
00008 *
00009 *  Purpose
00010 *  =======
00011 *
00012 *     SCASUM takes the sum of the absolute values of a complex vector and
00013 *     returns a single precision result.
00014 *
00015 *  Further Details
00016 *  ===============
00017 *
00018 *     jack dongarra, linpack, 3/11/78.
00019 *     modified 3/93 to return if incx .le. 0.
00020 *     modified 12/3/93, array(1) declarations changed to array(*)
00021 *
00022 *  =====================================================================
00023 *
00024 *     .. Local Scalars ..
00025       REAL STEMP
00026       INTEGER I,NINCX
00027 *     ..
00028 *     .. Intrinsic Functions ..
00029       INTRINSIC ABS,AIMAG,REAL
00030 *     ..
00031       SCASUM = 0.0e0
00032       STEMP = 0.0e0
00033       IF (N.LE.0 .OR. INCX.LE.0) RETURN
00034       IF (INCX.EQ.1) THEN
00035 *
00036 *        code for increment equal to 1
00037 *
00038          DO I = 1,N
00039             STEMP = STEMP + ABS(REAL(CX(I))) + ABS(AIMAG(CX(I)))
00040          END DO
00041       ELSE
00042 *
00043 *        code for increment not equal to 1
00044 *
00045          NINCX = N*INCX
00046          DO I = 1,NINCX,INCX
00047             STEMP = STEMP + ABS(REAL(CX(I))) + ABS(AIMAG(CX(I)))
00048          END DO
00049       END IF
00050       SCASUM = STEMP
00051       RETURN
00052       END
 All Files Functions