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 zrotg_(doublecomplex *ca, doublecomplex *cb, doublereal *
00017 c__, doublecomplex *s)
00018 {
00019
00020 doublereal d__1, d__2;
00021 doublecomplex z__1, z__2, z__3, z__4;
00022
00023
00024 double z_abs(doublecomplex *);
00025 void z_div(doublecomplex *, doublecomplex *, doublecomplex *);
00026 double sqrt(doublereal);
00027 void d_cnjg(doublecomplex *, doublecomplex *);
00028
00029
00030 doublereal norm;
00031 doublecomplex alpha;
00032 doublereal scale;
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 if (z_abs(ca) != 0.) {
00047 goto L10;
00048 }
00049 *c__ = 0.;
00050 s->r = 1., s->i = 0.;
00051 ca->r = cb->r, ca->i = cb->i;
00052 goto L20;
00053 L10:
00054 scale = z_abs(ca) + z_abs(cb);
00055 z__2.r = scale, z__2.i = 0.;
00056 z_div(&z__1, ca, &z__2);
00057
00058 d__1 = z_abs(&z__1);
00059 z__4.r = scale, z__4.i = 0.;
00060 z_div(&z__3, cb, &z__4);
00061
00062 d__2 = z_abs(&z__3);
00063 norm = scale * sqrt(d__1 * d__1 + d__2 * d__2);
00064 d__1 = z_abs(ca);
00065 z__1.r = ca->r / d__1, z__1.i = ca->i / d__1;
00066 alpha.r = z__1.r, alpha.i = z__1.i;
00067 *c__ = z_abs(ca) / norm;
00068 d_cnjg(&z__3, cb);
00069 z__2.r = alpha.r * z__3.r - alpha.i * z__3.i, z__2.i = alpha.r * z__3.i +
00070 alpha.i * z__3.r;
00071 z__1.r = z__2.r / norm, z__1.i = z__2.i / norm;
00072 s->r = z__1.r, s->i = z__1.i;
00073 z__1.r = norm * alpha.r, z__1.i = norm * alpha.i;
00074 ca->r = z__1.r, ca->i = z__1.i;
00075 L20:
00076 return 0;
00077 }