dzasum.c
Go to the documentation of this file.
00001 /* dzasum.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 dzasum_(integer *n, doublecomplex *zx, integer *incx)
00017 {
00018     /* System generated locals */
00019     integer i__1;
00020     doublereal ret_val;
00021 
00022     /* Local variables */
00023     integer i__, ix;
00024     doublereal stemp;
00025     extern doublereal dcabs1_(doublecomplex *);
00026 
00027 /*     .. Scalar Arguments .. */
00028 /*     .. */
00029 /*     .. Array Arguments .. */
00030 /*     .. */
00031 
00032 /*  Purpose */
00033 /*  ======= */
00034 
00035 /*     takes the sum of the absolute values. */
00036 /*     jack dongarra, 3/11/78. */
00037 /*     modified 3/93 to return if incx .le. 0. */
00038 /*     modified 12/3/93, array(1) declarations changed to array(*) */
00039 
00040 
00041 /*     .. Local Scalars .. */
00042 /*     .. */
00043 /*     .. External Functions .. */
00044 /*     .. */
00045     /* Parameter adjustments */
00046     --zx;
00047 
00048     /* Function Body */
00049     ret_val = 0.;
00050     stemp = 0.;
00051     if (*n <= 0 || *incx <= 0) {
00052         return ret_val;
00053     }
00054     if (*incx == 1) {
00055         goto L20;
00056     }
00057 
00058 /*        code for increment not equal to 1 */
00059 
00060     ix = 1;
00061     i__1 = *n;
00062     for (i__ = 1; i__ <= i__1; ++i__) {
00063         stemp += dcabs1_(&zx[ix]);
00064         ix += *incx;
00065 /* L10: */
00066     }
00067     ret_val = stemp;
00068     return ret_val;
00069 
00070 /*        code for increment equal to 1 */
00071 
00072 L20:
00073     i__1 = *n;
00074     for (i__ = 1; i__ <= i__1; ++i__) {
00075         stemp += dcabs1_(&zx[i__]);
00076 /* L30: */
00077     }
00078     ret_val = stemp;
00079     return ret_val;
00080 } /* dzasum_ */


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