zrotg.c
Go to the documentation of this file.
00001 /* zrotg.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 zrotg_(doublecomplex *ca, doublecomplex *cb, doublereal *
00017         c__, doublecomplex *s)
00018 {
00019     /* System generated locals */
00020     doublereal d__1, d__2;
00021     doublecomplex z__1, z__2, z__3, z__4;
00022 
00023     /* Builtin functions */
00024     double z_abs(doublecomplex *);
00025     void z_div(doublecomplex *, doublecomplex *, doublecomplex *);
00026     double sqrt(doublereal);
00027     void d_cnjg(doublecomplex *, doublecomplex *);
00028 
00029     /* Local variables */
00030     doublereal norm;
00031     doublecomplex alpha;
00032     doublereal scale;
00033 
00034 /*     .. Scalar Arguments .. */
00035 /*     .. */
00036 
00037 /*  Purpose */
00038 /*  ======= */
00039 
00040 /*     determines a double complex Givens rotation. */
00041 
00042 /*     .. Local Scalars .. */
00043 /*     .. */
00044 /*     .. Intrinsic Functions .. */
00045 /*     .. */
00046     if (z_abs(ca) != 0.) {
00047         goto L10;
00048     }
00049     *c__ = 0.;
00050     s->r = 1., s->i = 0.;
00051     ca->r = cb->r, ca->i = cb->i;
00052     goto L20;
00053 L10:
00054     scale = z_abs(ca) + z_abs(cb);
00055     z__2.r = scale, z__2.i = 0.;
00056     z_div(&z__1, ca, &z__2);
00057 /* Computing 2nd power */
00058     d__1 = z_abs(&z__1);
00059     z__4.r = scale, z__4.i = 0.;
00060     z_div(&z__3, cb, &z__4);
00061 /* Computing 2nd power */
00062     d__2 = z_abs(&z__3);
00063     norm = scale * sqrt(d__1 * d__1 + d__2 * d__2);
00064     d__1 = z_abs(ca);
00065     z__1.r = ca->r / d__1, z__1.i = ca->i / d__1;
00066     alpha.r = z__1.r, alpha.i = z__1.i;
00067     *c__ = z_abs(ca) / norm;
00068     d_cnjg(&z__3, cb);
00069     z__2.r = alpha.r * z__3.r - alpha.i * z__3.i, z__2.i = alpha.r * z__3.i + 
00070             alpha.i * z__3.r;
00071     z__1.r = z__2.r / norm, z__1.i = z__2.i / norm;
00072     s->r = z__1.r, s->i = z__1.i;
00073     z__1.r = norm * alpha.r, z__1.i = norm * alpha.i;
00074     ca->r = z__1.r, ca->i = z__1.i;
00075 L20:
00076     return 0;
00077 } /* zrotg_ */


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