Debian Codegraph @

debian/external_deps/fetk/punc/src/blas/scasum.c

raw
1 /* ./src_f77/scasum.f -- translated by f2c (version 20030320).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include <punc/vf2c.h>
7
8 doublereal scasum_(integer *n, realcomplex *cx, integer *incx)
9 {
10 /* System generated locals */
11 integer i__1, i__2, i__3;
12 real ret_val, r__1, r__2;
13
14 /* Builtin functions */
15 double r_imag(realcomplex *);
16
17 /* Local variables */
18 static integer i__, nincx;
19 static real stemp;
20
21
22 /* takes the sum of the absolute values of a complex vector and */
23 /* returns a single precision result. */
24 /* jack dongarra, linpack, 3/11/78. */
25 /* modified 3/93 to return if incx .le. 0. */
26 /* modified 12/3/93, array(1) declarations changed to array(*) */
27
28
29 /* Parameter adjustments */
30 --cx;
31
32 /* Function Body */
33 ret_val = 0.f;
34 stemp = 0.f;
35 if (*n <= 0 || *incx <= 0) {
36 return ret_val;
37 }
38 if (*incx == 1) {
39 goto L20;
40 }
41
42 /* code for increment not equal to 1 */
43
44 nincx = *n * *incx;
45 i__1 = nincx;
46 i__2 = *incx;
47 for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
48 i__3 = i__;
49 stemp = stemp + (r__1 = cx[i__3].r, dabs(r__1)) + (r__2 = r_imag(&cx[
50 i__]), dabs(r__2));
51 /* L10: */
52 }
53 ret_val = stemp;
54 return ret_val;
55
56 /* code for increment equal to 1 */
57
58 L20:
59 i__2 = *n;
60 for (i__ = 1; i__ <= i__2; ++i__) {
61 i__1 = i__;
62 stemp = stemp + (r__1 = cx[i__1].r, dabs(r__1)) + (r__2 = r_imag(&cx[
63 i__]), dabs(r__2));
64 /* L30: */
65 }
66 ret_val = stemp;
67 return ret_val;
68 } /* scasum_ */
69