zdrscl.c
Go to the documentation of this file.
00001 /* zdrscl.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 /* Subroutine */ int zdrscl_(integer *n, doublereal *sa, doublecomplex *sx, 
00017         integer *incx)
00018 {
00019     doublereal mul, cden;
00020     logical done;
00021     doublereal cnum, cden1, cnum1;
00022     extern /* Subroutine */ int dlabad_(doublereal *, doublereal *);
00023     extern doublereal dlamch_(char *);
00024     extern /* Subroutine */ int zdscal_(integer *, doublereal *, 
00025             doublecomplex *, integer *);
00026     doublereal bignum, smlnum;
00027 
00028 
00029 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00030 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00031 /*     November 2006 */
00032 
00033 /*     .. Scalar Arguments .. */
00034 /*     .. */
00035 /*     .. Array Arguments .. */
00036 /*     .. */
00037 
00038 /*  Purpose */
00039 /*  ======= */
00040 
00041 /*  ZDRSCL multiplies an n-element complex vector x by the real scalar */
00042 /*  1/a.  This is done without overflow or underflow as long as */
00043 /*  the final result x/a does not overflow or underflow. */
00044 
00045 /*  Arguments */
00046 /*  ========= */
00047 
00048 /*  N       (input) INTEGER */
00049 /*          The number of components of the vector x. */
00050 
00051 /*  SA      (input) DOUBLE PRECISION */
00052 /*          The scalar a which is used to divide each component of x. */
00053 /*          SA must be >= 0, or the subroutine will divide by zero. */
00054 
00055 /*  SX      (input/output) COMPLEX*16 array, dimension */
00056 /*                         (1+(N-1)*abs(INCX)) */
00057 /*          The n-element vector x. */
00058 
00059 /*  INCX    (input) INTEGER */
00060 /*          The increment between successive values of the vector SX. */
00061 /*          > 0:  SX(1) = X(1) and SX(1+(i-1)*INCX) = x(i),     1< i<= n */
00062 
00063 /* ===================================================================== */
00064 
00065 /*     .. Parameters .. */
00066 /*     .. */
00067 /*     .. Local Scalars .. */
00068 /*     .. */
00069 /*     .. External Functions .. */
00070 /*     .. */
00071 /*     .. External Subroutines .. */
00072 /*     .. */
00073 /*     .. Intrinsic Functions .. */
00074 /*     .. */
00075 /*     .. Executable Statements .. */
00076 
00077 /*     Quick return if possible */
00078 
00079     /* Parameter adjustments */
00080     --sx;
00081 
00082     /* Function Body */
00083     if (*n <= 0) {
00084         return 0;
00085     }
00086 
00087 /*     Get machine parameters */
00088 
00089     smlnum = dlamch_("S");
00090     bignum = 1. / smlnum;
00091     dlabad_(&smlnum, &bignum);
00092 
00093 /*     Initialize the denominator to SA and the numerator to 1. */
00094 
00095     cden = *sa;
00096     cnum = 1.;
00097 
00098 L10:
00099     cden1 = cden * smlnum;
00100     cnum1 = cnum / bignum;
00101     if (abs(cden1) > abs(cnum) && cnum != 0.) {
00102 
00103 /*        Pre-multiply X by SMLNUM if CDEN is large compared to CNUM. */
00104 
00105         mul = smlnum;
00106         done = FALSE_;
00107         cden = cden1;
00108     } else if (abs(cnum1) > abs(cden)) {
00109 
00110 /*        Pre-multiply X by BIGNUM if CDEN is small compared to CNUM. */
00111 
00112         mul = bignum;
00113         done = FALSE_;
00114         cnum = cnum1;
00115     } else {
00116 
00117 /*        Multiply X by CNUM / CDEN and return. */
00118 
00119         mul = cnum / cden;
00120         done = TRUE_;
00121     }
00122 
00123 /*     Scale the vector X by MUL */
00124 
00125     zdscal_(n, &mul, &sx[1], incx);
00126 
00127     if (! done) {
00128         goto L10;
00129     }
00130 
00131     return 0;
00132 
00133 /*     End of ZDRSCL */
00134 
00135 } /* zdrscl_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:21