Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int crotg_(complex *ca, complex *cb, real *c__, complex *s)
00017 {
00018
00019 real r__1, r__2;
00020 complex q__1, q__2, q__3;
00021
00022
00023 double c_abs(complex *), sqrt(doublereal);
00024 void r_cnjg(complex *, complex *);
00025
00026
00027 real norm;
00028 complex alpha;
00029 real scale;
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 if (c_abs(ca) != 0.f) {
00044 goto L10;
00045 }
00046 *c__ = 0.f;
00047 s->r = 1.f, s->i = 0.f;
00048 ca->r = cb->r, ca->i = cb->i;
00049 goto L20;
00050 L10:
00051 scale = c_abs(ca) + c_abs(cb);
00052 q__1.r = ca->r / scale, q__1.i = ca->i / scale;
00053
00054 r__1 = c_abs(&q__1);
00055 q__2.r = cb->r / scale, q__2.i = cb->i / scale;
00056
00057 r__2 = c_abs(&q__2);
00058 norm = scale * sqrt(r__1 * r__1 + r__2 * r__2);
00059 r__1 = c_abs(ca);
00060 q__1.r = ca->r / r__1, q__1.i = ca->i / r__1;
00061 alpha.r = q__1.r, alpha.i = q__1.i;
00062 *c__ = c_abs(ca) / norm;
00063 r_cnjg(&q__3, cb);
00064 q__2.r = alpha.r * q__3.r - alpha.i * q__3.i, q__2.i = alpha.r * q__3.i +
00065 alpha.i * q__3.r;
00066 q__1.r = q__2.r / norm, q__1.i = q__2.i / norm;
00067 s->r = q__1.r, s->i = q__1.i;
00068 q__1.r = norm * alpha.r, q__1.i = norm * alpha.i;
00069 ca->r = q__1.r, ca->i = q__1.i;
00070 L20:
00071 return 0;
00072 }