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 igraphdlaev2_(doublereal *a, doublereal *b, doublereal *c__,
18
doublereal *rt1, doublereal *rt2, doublereal *cs1, doublereal *sn1)
20
/* System generated locals */
23
/* Builtin functions */
24
double sqrt(doublereal);
27
static doublereal ab, df, cs, ct, tb, sm, tn, rt, adf, acs;
28
static integer sgn1, sgn2;
29
static doublereal acmn, acmx;
32
/* -- LAPACK auxiliary routine (version 3.0) -- */
33
/* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
34
/* Courant Institute, Argonne National Lab, and Rice University */
35
/* October 31, 1992 */
37
/* .. Scalar Arguments .. */
43
/* DLAEV2 computes the eigendecomposition of a 2-by-2 symmetric matrix */
46
/* On return, RT1 is the eigenvalue of larger absolute value, RT2 is the */
47
/* eigenvalue of smaller absolute value, and (CS1,SN1) is the unit right */
48
/* eigenvector for RT1, giving the decomposition */
50
/* [ CS1 SN1 ] [ A B ] [ CS1 -SN1 ] = [ RT1 0 ] */
51
/* [-SN1 CS1 ] [ B C ] [ SN1 CS1 ] [ 0 RT2 ]. */
56
/* A (input) DOUBLE PRECISION */
57
/* The (1,1) element of the 2-by-2 matrix. */
59
/* B (input) DOUBLE PRECISION */
60
/* The (1,2) element and the conjugate of the (2,1) element of */
61
/* the 2-by-2 matrix. */
63
/* C (input) DOUBLE PRECISION */
64
/* The (2,2) element of the 2-by-2 matrix. */
66
/* RT1 (output) DOUBLE PRECISION */
67
/* The eigenvalue of larger absolute value. */
69
/* RT2 (output) DOUBLE PRECISION */
70
/* The eigenvalue of smaller absolute value. */
72
/* CS1 (output) DOUBLE PRECISION */
73
/* SN1 (output) DOUBLE PRECISION */
74
/* The vector (CS1, SN1) is a unit right eigenvector for RT1. */
79
/* RT1 is accurate to a few ulps barring over/underflow. */
81
/* RT2 may be inaccurate if there is massive cancellation in the */
82
/* determinant A*C-B*B; higher precision or correctly rounded or */
83
/* correctly truncated arithmetic would be needed to compute RT2 */
84
/* accurately in all cases. */
86
/* CS1 and SN1 are accurate to a few ulps barring over/underflow. */
88
/* Overflow is possible only if RT1 is within a factor of 5 of overflow. */
89
/* Underflow is harmless if the input data is 0 or exceeds */
90
/* underflow_threshold / macheps. */
92
/* ===================================================================== */
94
/* .. Parameters .. */
96
/* .. Local Scalars .. */
98
/* .. Intrinsic Functions .. */
100
/* .. Executable Statements .. */
102
/* Compute the eigenvalues */
109
if (abs(*a) > abs(*c__)) {
117
/* Computing 2nd power */
119
rt = adf * sqrt(d__1 * d__1 + 1.);
120
} else if (adf < ab) {
121
/* Computing 2nd power */
123
rt = ab * sqrt(d__1 * d__1 + 1.);
126
/* Includes case AB=ADF=0 */
131
*rt1 = (sm - rt) * .5;
134
/* Order of execution important. */
135
/* To get fully accurate smaller eigenvalue, */
136
/* next line needs to be executed in higher precision. */
138
*rt2 = acmx / *rt1 * acmn - *b / *rt1 * *b;
139
} else if (sm > 0.) {
140
*rt1 = (sm + rt) * .5;
143
/* Order of execution important. */
144
/* To get fully accurate smaller eigenvalue, */
145
/* next line needs to be executed in higher precision. */
147
*rt2 = acmx / *rt1 * acmn - *b / *rt1 * *b;
150
/* Includes case RT1 = RT2 = 0 */
157
/* Compute the eigenvector */
169
*sn1 = 1. / sqrt(ct * ct + 1.);
177
*cs1 = 1. / sqrt(tn * tn + 1.);
190
} /* igraphdlaev2_ */