LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
scsum1.f
Go to the documentation of this file.
00001 *> \brief \b SCSUM1
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download SCSUM1 + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/scsum1.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/scsum1.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/scsum1.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       REAL             FUNCTION SCSUM1( N, CX, INCX )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       INTEGER            INCX, N
00025 *       ..
00026 *       .. Array Arguments ..
00027 *       COMPLEX            CX( * )
00028 *       ..
00029 *  
00030 *
00031 *> \par Purpose:
00032 *  =============
00033 *>
00034 *> \verbatim
00035 *>
00036 *> SCSUM1 takes the sum of the absolute values of a complex
00037 *> vector and returns a single precision result.
00038 *>
00039 *> Based on SCASUM from the Level 1 BLAS.
00040 *> The change is to use the 'genuine' absolute value.
00041 *> \endverbatim
00042 *
00043 *  Arguments:
00044 *  ==========
00045 *
00046 *> \param[in] N
00047 *> \verbatim
00048 *>          N is INTEGER
00049 *>          The number of elements in the vector CX.
00050 *> \endverbatim
00051 *>
00052 *> \param[in] CX
00053 *> \verbatim
00054 *>          CX is COMPLEX array, dimension (N)
00055 *>          The vector whose elements will be summed.
00056 *> \endverbatim
00057 *>
00058 *> \param[in] INCX
00059 *> \verbatim
00060 *>          INCX is INTEGER
00061 *>          The spacing between successive values of CX.  INCX > 0.
00062 *> \endverbatim
00063 *
00064 *  Authors:
00065 *  ========
00066 *
00067 *> \author Univ. of Tennessee 
00068 *> \author Univ. of California Berkeley 
00069 *> \author Univ. of Colorado Denver 
00070 *> \author NAG Ltd. 
00071 *
00072 *> \date November 2011
00073 *
00074 *> \ingroup complexOTHERauxiliary
00075 *
00076 *> \par Contributors:
00077 *  ==================
00078 *>
00079 *> Nick Higham for use with CLACON.
00080 *
00081 *  =====================================================================
00082       REAL             FUNCTION SCSUM1( N, CX, INCX )
00083 *
00084 *  -- LAPACK auxiliary routine (version 3.4.0) --
00085 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00086 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00087 *     November 2011
00088 *
00089 *     .. Scalar Arguments ..
00090       INTEGER            INCX, N
00091 *     ..
00092 *     .. Array Arguments ..
00093       COMPLEX            CX( * )
00094 *     ..
00095 *
00096 *  =====================================================================
00097 *
00098 *     .. Local Scalars ..
00099       INTEGER            I, NINCX
00100       REAL               STEMP
00101 *     ..
00102 *     .. Intrinsic Functions ..
00103       INTRINSIC          ABS
00104 *     ..
00105 *     .. Executable Statements ..
00106 *
00107       SCSUM1 = 0.0E0
00108       STEMP = 0.0E0
00109       IF( N.LE.0 )
00110      $   RETURN
00111       IF( INCX.EQ.1 )
00112      $   GO TO 20
00113 *
00114 *     CODE FOR INCREMENT NOT EQUAL TO 1
00115 *
00116       NINCX = N*INCX
00117       DO 10 I = 1, NINCX, INCX
00118 *
00119 *        NEXT LINE MODIFIED.
00120 *
00121          STEMP = STEMP + ABS( CX( I ) )
00122    10 CONTINUE
00123       SCSUM1 = STEMP
00124       RETURN
00125 *
00126 *     CODE FOR INCREMENT EQUAL TO 1
00127 *
00128    20 CONTINUE
00129       DO 30 I = 1, N
00130 *
00131 *        NEXT LINE MODIFIED.
00132 *
00133          STEMP = STEMP + ABS( CX( I ) )
00134    30 CONTINUE
00135       SCSUM1 = STEMP
00136       RETURN
00137 *
00138 *     End of SCSUM1
00139 *
00140       END
 All Files Functions