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


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