1
/* -- translated by f2c (version 20050501).
2
You must link the resulting object file with libf2c:
3
on Microsoft Windows system, link with libf2c.lib;
4
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
5
or, if you install libf2c.a in a standard place, with -lf2c -lm
6
-- in that order, at the end of the command line, as in
8
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
10
http://www.netlib.org/f2c/libf2c.zip
14
#include "arpack_internal.h"
17
/* Subroutine */ int igraphdlartg_(doublereal *f, doublereal *g, doublereal *cs,
18
doublereal *sn, doublereal *r__)
20
/* Initialized data */
22
static logical first = TRUE_;
24
/* System generated locals */
26
doublereal d__1, d__2;
28
/* Builtin functions */
29
double log(doublereal), igraphpow_di(doublereal *, integer *), sqrt(doublereal);
33
static doublereal f1, g1, eps, scale;
35
static doublereal safmn2, safmx2;
36
extern doublereal igraphdlamch_(char *);
37
static doublereal safmin;
40
/* -- LAPACK auxiliary routine (version 3.0) -- */
41
/* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
42
/* Courant Institute, Argonne National Lab, and Rice University */
43
/* September 30, 1994 */
45
/* .. Scalar Arguments .. */
51
/* DLARTG generate a plane rotation so that */
53
/* [ CS SN ] . [ F ] = [ R ] where CS**2 + SN**2 = 1. */
54
/* [ -SN CS ] [ G ] [ 0 ] */
56
/* This is a slower, more accurate version of the BLAS1 routine DROTG, */
57
/* with the following other differences: */
58
/* F and G are unchanged on return. */
59
/* If G=0, then CS=1 and SN=0. */
60
/* If F=0 and (G .ne. 0), then CS=0 and SN=1 without doing any */
61
/* floating point operations (saves work in DBDSQR when */
62
/* there are zeros on the diagonal). */
64
/* If F exceeds G in magnitude, CS will be positive. */
69
/* F (input) DOUBLE PRECISION */
70
/* The first component of vector to be rotated. */
72
/* G (input) DOUBLE PRECISION */
73
/* The second component of vector to be rotated. */
75
/* CS (output) DOUBLE PRECISION */
76
/* The cosine of the rotation. */
78
/* SN (output) DOUBLE PRECISION */
79
/* The sine of the rotation. */
81
/* R (output) DOUBLE PRECISION */
82
/* The nonzero component of the rotated vector. */
84
/* ===================================================================== */
86
/* .. Parameters .. */
88
/* .. Local Scalars .. */
90
/* .. External Functions .. */
92
/* .. Intrinsic Functions .. */
94
/* .. Save statement .. */
96
/* .. Data statements .. */
98
/* .. Executable Statements .. */
102
safmin = igraphdlamch_("S");
103
eps = igraphdlamch_("E");
104
d__1 = igraphdlamch_("B");
105
i__1 = (integer) (log(safmin / eps) / log(igraphdlamch_("B")) /
107
safmn2 = igraphpow_di(&d__1, &i__1);
108
safmx2 = 1. / safmn2;
114
} else if (*f == 0.) {
122
d__1 = abs(f1), d__2 = abs(g1);
123
scale = max(d__1,d__2);
124
if (scale >= safmx2) {
131
d__1 = abs(f1), d__2 = abs(g1);
132
scale = max(d__1,d__2);
133
if (scale >= safmx2) {
136
/* Computing 2nd power */
138
/* Computing 2nd power */
140
*r__ = sqrt(d__1 * d__1 + d__2 * d__2);
144
for (i__ = 1; i__ <= i__1; ++i__) {
148
} else if (scale <= safmn2) {
155
d__1 = abs(f1), d__2 = abs(g1);
156
scale = max(d__1,d__2);
157
if (scale <= safmn2) {
160
/* Computing 2nd power */
162
/* Computing 2nd power */
164
*r__ = sqrt(d__1 * d__1 + d__2 * d__2);
168
for (i__ = 1; i__ <= i__1; ++i__) {
173
/* Computing 2nd power */
175
/* Computing 2nd power */
177
*r__ = sqrt(d__1 * d__1 + d__2 * d__2);
181
if (abs(*f) > abs(*g) && *cs < 0.) {
191
} /* igraphdlartg_ */