LAPACK 3.3.0
|
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) GO TO 20 00035 * 00036 * code for increment not equal to 1 00037 * 00038 NINCX = N*INCX 00039 DO 10 I = 1,NINCX,INCX 00040 STEMP = STEMP + ABS(REAL(CX(I))) + ABS(AIMAG(CX(I))) 00041 10 CONTINUE 00042 SCASUM = STEMP 00043 RETURN 00044 * 00045 * code for increment equal to 1 00046 * 00047 20 DO 30 I = 1,N 00048 STEMP = STEMP + ABS(REAL(CX(I))) + ABS(AIMAG(CX(I))) 00049 30 CONTINUE 00050 SCASUM = STEMP 00051 RETURN 00052 END