dzsum1.c
Go to the documentation of this file.
00001 /* dzsum1.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 dzsum1_(integer *n, doublecomplex *cx, integer *incx)
00017 {
00018     /* System generated locals */
00019     integer i__1, i__2;
00020     doublereal ret_val;
00021 
00022     /* Builtin functions */
00023     double z_abs(doublecomplex *);
00024 
00025     /* Local variables */
00026     integer i__, nincx;
00027     doublereal stemp;
00028 
00029 
00030 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00031 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00032 /*     November 2006 */
00033 
00034 /*     .. Scalar Arguments .. */
00035 /*     .. */
00036 /*     .. Array Arguments .. */
00037 /*     .. */
00038 
00039 /*  Purpose */
00040 /*  ======= */
00041 
00042 /*  DZSUM1 takes the sum of the absolute values of a complex */
00043 /*  vector and returns a double precision result. */
00044 
00045 /*  Based on DZASUM from the Level 1 BLAS. */
00046 /*  The change is to use the 'genuine' absolute value. */
00047 
00048 /*  Contributed by Nick Higham for use with ZLACON. */
00049 
00050 /*  Arguments */
00051 /*  ========= */
00052 
00053 /*  N       (input) INTEGER */
00054 /*          The number of elements in the vector CX. */
00055 
00056 /*  CX      (input) COMPLEX*16 array, dimension (N) */
00057 /*          The vector whose elements will be summed. */
00058 
00059 /*  INCX    (input) INTEGER */
00060 /*          The spacing between successive values of CX.  INCX > 0. */
00061 
00062 /*  ===================================================================== */
00063 
00064 /*     .. Local Scalars .. */
00065 /*     .. */
00066 /*     .. Intrinsic Functions .. */
00067 /*     .. */
00068 /*     .. Executable Statements .. */
00069 
00070     /* Parameter adjustments */
00071     --cx;
00072 
00073     /* Function Body */
00074     ret_val = 0.;
00075     stemp = 0.;
00076     if (*n <= 0) {
00077         return ret_val;
00078     }
00079     if (*incx == 1) {
00080         goto L20;
00081     }
00082 
00083 /*     CODE FOR INCREMENT NOT EQUAL TO 1 */
00084 
00085     nincx = *n * *incx;
00086     i__1 = nincx;
00087     i__2 = *incx;
00088     for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00089 
00090 /*        NEXT LINE MODIFIED. */
00091 
00092         stemp += z_abs(&cx[i__]);
00093 /* L10: */
00094     }
00095     ret_val = stemp;
00096     return ret_val;
00097 
00098 /*     CODE FOR INCREMENT EQUAL TO 1 */
00099 
00100 L20:
00101     i__2 = *n;
00102     for (i__ = 1; i__ <= i__2; ++i__) {
00103 
00104 /*        NEXT LINE MODIFIED. */
00105 
00106         stemp += z_abs(&cx[i__]);
00107 /* L30: */
00108     }
00109     ret_val = stemp;
00110     return ret_val;
00111 
00112 /*     End of DZSUM1 */
00113 
00114 } /* dzsum1_ */


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