LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
scasum.f
Go to the documentation of this file.
00001 *> \brief \b SCASUM
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *  Definition:
00009 *  ===========
00010 *
00011 *       REAL FUNCTION SCASUM(N,CX,INCX)
00012 * 
00013 *       .. Scalar Arguments ..
00014 *       INTEGER INCX,N
00015 *       ..
00016 *       .. Array Arguments ..
00017 *       COMPLEX CX(*)
00018 *       ..
00019 *  
00020 *
00021 *> \par Purpose:
00022 *  =============
00023 *>
00024 *> \verbatim
00025 *>
00026 *>    SCASUM takes the sum of the absolute values of a complex vector and
00027 *>    returns a single precision result.
00028 *> \endverbatim
00029 *
00030 *  Authors:
00031 *  ========
00032 *
00033 *> \author Univ. of Tennessee 
00034 *> \author Univ. of California Berkeley 
00035 *> \author Univ. of Colorado Denver 
00036 *> \author NAG Ltd. 
00037 *
00038 *> \date November 2011
00039 *
00040 *> \ingroup single_blas_level1
00041 *
00042 *> \par Further Details:
00043 *  =====================
00044 *>
00045 *> \verbatim
00046 *>
00047 *>     jack dongarra, linpack, 3/11/78.
00048 *>     modified 3/93 to return if incx .le. 0.
00049 *>     modified 12/3/93, array(1) declarations changed to array(*)
00050 *> \endverbatim
00051 *>
00052 *  =====================================================================
00053       REAL FUNCTION SCASUM(N,CX,INCX)
00054 *
00055 *  -- Reference BLAS level1 routine (version 3.4.0) --
00056 *  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
00057 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00058 *     November 2011
00059 *
00060 *     .. Scalar Arguments ..
00061       INTEGER INCX,N
00062 *     ..
00063 *     .. Array Arguments ..
00064       COMPLEX CX(*)
00065 *     ..
00066 *
00067 *  =====================================================================
00068 *
00069 *     .. Local Scalars ..
00070       REAL STEMP
00071       INTEGER I,NINCX
00072 *     ..
00073 *     .. Intrinsic Functions ..
00074       INTRINSIC ABS,AIMAG,REAL
00075 *     ..
00076       SCASUM = 0.0e0
00077       STEMP = 0.0e0
00078       IF (N.LE.0 .OR. INCX.LE.0) RETURN
00079       IF (INCX.EQ.1) THEN
00080 *
00081 *        code for increment equal to 1
00082 *
00083          DO I = 1,N
00084             STEMP = STEMP + ABS(REAL(CX(I))) + ABS(AIMAG(CX(I)))
00085          END DO
00086       ELSE
00087 *
00088 *        code for increment not equal to 1
00089 *
00090          NINCX = N*INCX
00091          DO I = 1,NINCX,INCX
00092             STEMP = STEMP + ABS(REAL(CX(I))) + ABS(AIMAG(CX(I)))
00093          END DO
00094       END IF
00095       SCASUM = STEMP
00096       RETURN
00097       END
 All Files Functions