LAPACK  3.8.0
LAPACK: Linear Algebra PACKage
scasum.f
Go to the documentation of this file.
1 *> \brief \b SCASUM
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * REAL FUNCTION SCASUM(N,CX,INCX)
12 *
13 * .. Scalar Arguments ..
14 * INTEGER INCX,N
15 * ..
16 * .. Array Arguments ..
17 * COMPLEX CX(*)
18 * ..
19 *
20 *
21 *> \par Purpose:
22 * =============
23 *>
24 *> \verbatim
25 *>
26 *> SCASUM takes the sum of the (|Re(.)| + |Im(.)|)'s of a complex vector and
27 *> returns a single precision result.
28 *> \endverbatim
29 *
30 * Arguments:
31 * ==========
32 *
33 *> \param[in] N
34 *> \verbatim
35 *> N is INTEGER
36 *> number of elements in input vector(s)
37 *> \endverbatim
38 *>
39 *> \param[in,out] CX
40 *> \verbatim
41 *> CX is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
42 *> \endverbatim
43 *>
44 *> \param[in] INCX
45 *> \verbatim
46 *> INCX is INTEGER
47 *> storage spacing between elements of SX
48 *> \endverbatim
49 *
50 * Authors:
51 * ========
52 *
53 *> \author Univ. of Tennessee
54 *> \author Univ. of California Berkeley
55 *> \author Univ. of Colorado Denver
56 *> \author NAG Ltd.
57 *
58 *> \date November 2017
59 *
60 *> \ingroup single_blas_level1
61 *
62 *> \par Further Details:
63 * =====================
64 *>
65 *> \verbatim
66 *>
67 *> jack dongarra, linpack, 3/11/78.
68 *> modified 3/93 to return if incx .le. 0.
69 *> modified 12/3/93, array(1) declarations changed to array(*)
70 *> \endverbatim
71 *>
72 * =====================================================================
73  REAL FUNCTION scasum(N,CX,INCX)
74 *
75 * -- Reference BLAS level1 routine (version 3.8.0) --
76 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
77 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
78 * November 2017
79 *
80 * .. Scalar Arguments ..
81  INTEGER INCX,N
82 * ..
83 * .. Array Arguments ..
84  COMPLEX CX(*)
85 * ..
86 *
87 * =====================================================================
88 *
89 * .. Local Scalars ..
90  REAL STEMP
91  INTEGER I,NINCX
92 * ..
93 * .. Intrinsic Functions ..
94  INTRINSIC abs,aimag,real
95 * ..
96  scasum = 0.0e0
97  stemp = 0.0e0
98  IF (n.LE.0 .OR. incx.LE.0) RETURN
99  IF (incx.EQ.1) THEN
100 *
101 * code for increment equal to 1
102 *
103  DO i = 1,n
104  stemp = stemp + abs(REAL(cx(i))) + abs(AIMAG(cx(i)))
105  END DO
106  ELSE
107 *
108 * code for increment not equal to 1
109 *
110  nincx = n*incx
111  DO i = 1,nincx,incx
112  stemp = stemp + abs(REAL(cx(i))) + abs(AIMAG(cx(i)))
113  END DO
114  END IF
115  scasum = stemp
116  RETURN
117  END
real function scasum(N, CX, INCX)
SCASUM
Definition: scasum.f:74