scasum.c
Go to the documentation of this file.
00001 /* scasum.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 doublereal scasum_(integer *n, complex *cx, integer *incx)
00017 {
00018     /* System generated locals */
00019     integer i__1, i__2, i__3;
00020     real ret_val, r__1, r__2;
00021 
00022     /* Builtin functions */
00023     double r_imag(complex *);
00024 
00025     /* Local variables */
00026     integer i__, nincx;
00027     real stemp;
00028 
00029 /*     .. Scalar Arguments .. */
00030 /*     .. */
00031 /*     .. Array Arguments .. */
00032 /*     .. */
00033 
00034 /*  Purpose */
00035 /*  ======= */
00036 
00037 /*     takes the sum of the absolute values of a complex vector and */
00038 /*     returns a single precision result. */
00039 /*     jack dongarra, linpack, 3/11/78. */
00040 /*     modified 3/93 to return if incx .le. 0. */
00041 /*     modified 12/3/93, array(1) declarations changed to array(*) */
00042 
00043 
00044 /*     .. Local Scalars .. */
00045 /*     .. */
00046 /*     .. Intrinsic Functions .. */
00047 /*     .. */
00048     /* Parameter adjustments */
00049     --cx;
00050 
00051     /* Function Body */
00052     ret_val = 0.f;
00053     stemp = 0.f;
00054     if (*n <= 0 || *incx <= 0) {
00055         return ret_val;
00056     }
00057     if (*incx == 1) {
00058         goto L20;
00059     }
00060 
00061 /*        code for increment not equal to 1 */
00062 
00063     nincx = *n * *incx;
00064     i__1 = nincx;
00065     i__2 = *incx;
00066     for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00067         i__3 = i__;
00068         stemp = stemp + (r__1 = cx[i__3].r, dabs(r__1)) + (r__2 = r_imag(&cx[
00069                 i__]), dabs(r__2));
00070 /* L10: */
00071     }
00072     ret_val = stemp;
00073     return ret_val;
00074 
00075 /*        code for increment equal to 1 */
00076 
00077 L20:
00078     i__2 = *n;
00079     for (i__ = 1; i__ <= i__2; ++i__) {
00080         i__1 = i__;
00081         stemp = stemp + (r__1 = cx[i__1].r, dabs(r__1)) + (r__2 = r_imag(&cx[
00082                 i__]), dabs(r__2));
00083 /* L30: */
00084     }
00085     ret_val = stemp;
00086     return ret_val;
00087 } /* scasum_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:58