dladiv.c
Go to the documentation of this file.
00001 /* dladiv.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 dladiv_(doublereal *a, doublereal *b, doublereal *c__, 
00017         doublereal *d__, doublereal *p, doublereal *q)
00018 {
00019     doublereal e, f;
00020 
00021 
00022 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00023 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00024 /*     November 2006 */
00025 
00026 /*     .. Scalar Arguments .. */
00027 /*     .. */
00028 
00029 /*  Purpose */
00030 /*  ======= */
00031 
00032 /*  DLADIV performs complex division in  real arithmetic */
00033 
00034 /*                        a + i*b */
00035 /*             p + i*q = --------- */
00036 /*                        c + i*d */
00037 
00038 /*  The algorithm is due to Robert L. Smith and can be found */
00039 /*  in D. Knuth, The art of Computer Programming, Vol.2, p.195 */
00040 
00041 /*  Arguments */
00042 /*  ========= */
00043 
00044 /*  A       (input) DOUBLE PRECISION */
00045 /*  B       (input) DOUBLE PRECISION */
00046 /*  C       (input) DOUBLE PRECISION */
00047 /*  D       (input) DOUBLE PRECISION */
00048 /*          The scalars a, b, c, and d in the above expression. */
00049 
00050 /*  P       (output) DOUBLE PRECISION */
00051 /*  Q       (output) DOUBLE PRECISION */
00052 /*          The scalars p and q in the above expression. */
00053 
00054 /*  ===================================================================== */
00055 
00056 /*     .. Local Scalars .. */
00057 /*     .. */
00058 /*     .. Intrinsic Functions .. */
00059 /*     .. */
00060 /*     .. Executable Statements .. */
00061 
00062     if (abs(*d__) < abs(*c__)) {
00063         e = *d__ / *c__;
00064         f = *c__ + *d__ * e;
00065         *p = (*a + *b * e) / f;
00066         *q = (*b - *a * e) / f;
00067     } else {
00068         e = *c__ / *d__;
00069         f = *d__ + *c__ * e;
00070         *p = (*b + *a * e) / f;
00071         *q = (-(*a) + *b * e) / f;
00072     }
00073 
00074     return 0;
00075 
00076 /*     End of DLADIV */
00077 
00078 } /* dladiv_ */


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