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


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