| 1 |
/* ./src_f77/srotg.f -- translated by f2c (version 20030320). |
| 2 |
You must link the resulting object file with the libraries: |
| 3 |
-lf2c -lm (in that order) |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <punc/vf2c.h> |
| 7 |
|
| 8 |
/* Table of constant values */ |
| 9 |
|
| 10 |
static real c_b4 = 1.f; |
| 11 |
|
| 12 |
/* Subroutine */ int srotg_(real *sa, real *sb, real *c__, real *s) |
| 13 |
{ |
| 14 |
/* System generated locals */ |
| 15 |
real r__1, r__2; |
| 16 |
|
| 17 |
/* Builtin functions */ |
| 18 |
double sqrt(doublereal), r_sign(real *, real *); |
| 19 |
|
| 20 |
/* Local variables */ |
| 21 |
static real r__, z__, roe, scale; |
| 22 |
|
| 23 |
|
| 24 |
/* construct givens plane rotation. */ |
| 25 |
/* jack dongarra, linpack, 3/11/78. */ |
| 26 |
|
| 27 |
|
| 28 |
roe = *sb; |
| 29 |
if (dabs(*sa) > dabs(*sb)) { |
| 30 |
roe = *sa; |
| 31 |
} |
| 32 |
scale = dabs(*sa) + dabs(*sb); |
| 33 |
if (scale != 0.f) { |
| 34 |
goto L10; |
| 35 |
} |
| 36 |
*c__ = 1.f; |
| 37 |
*s = 0.f; |
| 38 |
r__ = 0.f; |
| 39 |
z__ = 0.f; |
| 40 |
goto L20; |
| 41 |
L10: |
| 42 |
/* Computing 2nd power */ |
| 43 |
r__1 = *sa / scale; |
| 44 |
/* Computing 2nd power */ |
| 45 |
r__2 = *sb / scale; |
| 46 |
r__ = scale * sqrt(r__1 * r__1 + r__2 * r__2); |
| 47 |
r__ = r_sign(&c_b4, &roe) * r__; |
| 48 |
*c__ = *sa / r__; |
| 49 |
*s = *sb / r__; |
| 50 |
z__ = 1.f; |
| 51 |
if (dabs(*sa) > dabs(*sb)) { |
| 52 |
z__ = *s; |
| 53 |
} |
| 54 |
if (dabs(*sb) >= dabs(*sa) && *c__ != 0.f) { |
| 55 |
z__ = 1.f / *c__; |
| 56 |
} |
| 57 |
L20: |
| 58 |
*sa = r__; |
| 59 |
*sb = z__; |
| 60 |
return 0; |
| 61 |
} /* srotg_ */ |
| 62 |
|