srotg.c
Go to the documentation of this file.
00001 /* srotg.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 /* Table of constant values */
00017 
00018 static real c_b4 = 1.f;
00019 
00020 /* Subroutine */ int srotg_(real *sa, real *sb, real *c__, real *s)
00021 {
00022     /* System generated locals */
00023     real r__1, r__2;
00024 
00025     /* Builtin functions */
00026     double sqrt(doublereal), r_sign(real *, real *);
00027 
00028     /* Local variables */
00029     real r__, z__, roe, scale;
00030 
00031 /*     .. Scalar Arguments .. */
00032 /*     .. */
00033 
00034 /*  Purpose */
00035 /*  ======= */
00036 
00037 /*     construct givens plane rotation. */
00038 /*     jack dongarra, linpack, 3/11/78. */
00039 
00040 
00041 /*     .. Local Scalars .. */
00042 /*     .. */
00043 /*     .. Intrinsic Functions .. */
00044 /*     .. */
00045     roe = *sb;
00046     if (dabs(*sa) > dabs(*sb)) {
00047         roe = *sa;
00048     }
00049     scale = dabs(*sa) + dabs(*sb);
00050     if (scale != 0.f) {
00051         goto L10;
00052     }
00053     *c__ = 1.f;
00054     *s = 0.f;
00055     r__ = 0.f;
00056     z__ = 0.f;
00057     goto L20;
00058 L10:
00059 /* Computing 2nd power */
00060     r__1 = *sa / scale;
00061 /* Computing 2nd power */
00062     r__2 = *sb / scale;
00063     r__ = scale * sqrt(r__1 * r__1 + r__2 * r__2);
00064     r__ = r_sign(&c_b4, &roe) * r__;
00065     *c__ = *sa / r__;
00066     *s = *sb / r__;
00067     z__ = 1.f;
00068     if (dabs(*sa) > dabs(*sb)) {
00069         z__ = *s;
00070     }
00071     if (dabs(*sb) >= dabs(*sa) && *c__ != 0.f) {
00072         z__ = 1.f / *c__;
00073     }
00074 L20:
00075     *sa = r__;
00076     *sb = z__;
00077     return 0;
00078 } /* srotg_ */


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