Coverage Report

Created: 2023-09-25 06:05

/src/igraph/vendor/lapack/dlae2.c
Line
Count
Source (jump to first uncovered line)
1
/*  -- translated by f2c (version 20191129).
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
7
    cc *.o -lf2c -lm
8
  Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
9
10
    http://www.netlib.org/f2c/libf2c.zip
11
*/
12
13
#include "f2c.h"
14
15
/* > \brief \b DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix.   
16
17
    =========== DOCUMENTATION ===========   
18
19
   Online html documentation available at   
20
              http://www.netlib.org/lapack/explore-html/   
21
22
   > \htmlonly   
23
   > Download DLAE2 + dependencies   
24
   > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlae2.f
25
">   
26
   > [TGZ]</a>   
27
   > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlae2.f
28
">   
29
   > [ZIP]</a>   
30
   > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlae2.f
31
">   
32
   > [TXT]</a>   
33
   > \endhtmlonly   
34
35
    Definition:   
36
    ===========   
37
38
         SUBROUTINE DLAE2( A, B, C, RT1, RT2 )   
39
40
         DOUBLE PRECISION   A, B, C, RT1, RT2   
41
42
43
   > \par Purpose:   
44
    =============   
45
   >   
46
   > \verbatim   
47
   >   
48
   > DLAE2  computes the eigenvalues of a 2-by-2 symmetric matrix   
49
   >    [  A   B  ]   
50
   >    [  B   C  ].   
51
   > On return, RT1 is the eigenvalue of larger absolute value, and RT2   
52
   > is the eigenvalue of smaller absolute value.   
53
   > \endverbatim   
54
55
    Arguments:   
56
    ==========   
57
58
   > \param[in] A   
59
   > \verbatim   
60
   >          A is DOUBLE PRECISION   
61
   >          The (1,1) element of the 2-by-2 matrix.   
62
   > \endverbatim   
63
   >   
64
   > \param[in] B   
65
   > \verbatim   
66
   >          B is DOUBLE PRECISION   
67
   >          The (1,2) and (2,1) elements of the 2-by-2 matrix.   
68
   > \endverbatim   
69
   >   
70
   > \param[in] C   
71
   > \verbatim   
72
   >          C is DOUBLE PRECISION   
73
   >          The (2,2) element of the 2-by-2 matrix.   
74
   > \endverbatim   
75
   >   
76
   > \param[out] RT1   
77
   > \verbatim   
78
   >          RT1 is DOUBLE PRECISION   
79
   >          The eigenvalue of larger absolute value.   
80
   > \endverbatim   
81
   >   
82
   > \param[out] RT2   
83
   > \verbatim   
84
   >          RT2 is DOUBLE PRECISION   
85
   >          The eigenvalue of smaller absolute value.   
86
   > \endverbatim   
87
88
    Authors:   
89
    ========   
90
91
   > \author Univ. of Tennessee   
92
   > \author Univ. of California Berkeley   
93
   > \author Univ. of Colorado Denver   
94
   > \author NAG Ltd.   
95
96
   > \date September 2012   
97
98
   > \ingroup auxOTHERauxiliary   
99
100
   > \par Further Details:   
101
    =====================   
102
   >   
103
   > \verbatim   
104
   >   
105
   >  RT1 is accurate to a few ulps barring over/underflow.   
106
   >   
107
   >  RT2 may be inaccurate if there is massive cancellation in the   
108
   >  determinant A*C-B*B; higher precision or correctly rounded or   
109
   >  correctly truncated arithmetic would be needed to compute RT2   
110
   >  accurately in all cases.   
111
   >   
112
   >  Overflow is possible only if RT1 is within a factor of 5 of overflow.   
113
   >  Underflow is harmless if the input data is 0 or exceeds   
114
   >     underflow_threshold / macheps.   
115
   > \endverbatim   
116
   >   
117
    =====================================================================   
118
   Subroutine */ int igraphdlae2_(doublereal *a, doublereal *b, doublereal *c__, 
119
  doublereal *rt1, doublereal *rt2)
120
0
{
121
    /* System generated locals */
122
0
    doublereal d__1;
123
124
    /* Builtin functions */
125
0
    double sqrt(doublereal);
126
127
    /* Local variables */
128
0
    doublereal ab, df, tb, sm, rt, adf, acmn, acmx;
129
130
131
/*  -- LAPACK auxiliary routine (version 3.4.2) --   
132
    -- LAPACK is a software package provided by Univ. of Tennessee,    --   
133
    -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--   
134
       September 2012   
135
136
137
   =====================================================================   
138
139
140
       Compute the eigenvalues */
141
142
0
    sm = *a + *c__;
143
0
    df = *a - *c__;
144
0
    adf = abs(df);
145
0
    tb = *b + *b;
146
0
    ab = abs(tb);
147
0
    if (abs(*a) > abs(*c__)) {
148
0
  acmx = *a;
149
0
  acmn = *c__;
150
0
    } else {
151
0
  acmx = *c__;
152
0
  acmn = *a;
153
0
    }
154
0
    if (adf > ab) {
155
/* Computing 2nd power */
156
0
  d__1 = ab / adf;
157
0
  rt = adf * sqrt(d__1 * d__1 + 1.);
158
0
    } else if (adf < ab) {
159
/* Computing 2nd power */
160
0
  d__1 = adf / ab;
161
0
  rt = ab * sqrt(d__1 * d__1 + 1.);
162
0
    } else {
163
164
/*        Includes case AB=ADF=0 */
165
166
0
  rt = ab * sqrt(2.);
167
0
    }
168
0
    if (sm < 0.) {
169
0
  *rt1 = (sm - rt) * .5;
170
171
/*        Order of execution important.   
172
          To get fully accurate smaller eigenvalue,   
173
          next line needs to be executed in higher precision. */
174
175
0
  *rt2 = acmx / *rt1 * acmn - *b / *rt1 * *b;
176
0
    } else if (sm > 0.) {
177
0
  *rt1 = (sm + rt) * .5;
178
179
/*        Order of execution important.   
180
          To get fully accurate smaller eigenvalue,   
181
          next line needs to be executed in higher precision. */
182
183
0
  *rt2 = acmx / *rt1 * acmn - *b / *rt1 * *b;
184
0
    } else {
185
186
/*        Includes case RT1 = RT2 = 0 */
187
188
0
  *rt1 = rt * .5;
189
0
  *rt2 = rt * -.5;
190
0
    }
191
0
    return 0;
192
193
/*     End of DLAE2 */
194
195
0
} /* igraphdlae2_ */
196