zlaev2.c
Go to the documentation of this file.
00001 /* zlaev2.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Subroutine */ int zlaev2_(doublecomplex *a, doublecomplex *b, 
00017         doublecomplex *c__, doublereal *rt1, doublereal *rt2, doublereal *cs1, 
00018          doublecomplex *sn1)
00019 {
00020     /* System generated locals */
00021     doublereal d__1, d__2, d__3;
00022     doublecomplex z__1, z__2;
00023 
00024     /* Builtin functions */
00025     double z_abs(doublecomplex *);
00026     void d_cnjg(doublecomplex *, doublecomplex *);
00027 
00028     /* Local variables */
00029     doublereal t;
00030     doublecomplex w;
00031     extern /* Subroutine */ int dlaev2_(doublereal *, doublereal *, 
00032             doublereal *, doublereal *, doublereal *, doublereal *, 
00033             doublereal *);
00034 
00035 
00036 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00037 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00038 /*     November 2006 */
00039 
00040 /*     .. Scalar Arguments .. */
00041 /*     .. */
00042 
00043 /*  Purpose */
00044 /*  ======= */
00045 
00046 /*  ZLAEV2 computes the eigendecomposition of a 2-by-2 Hermitian matrix */
00047 /*     [  A         B  ] */
00048 /*     [  CONJG(B)  C  ]. */
00049 /*  On return, RT1 is the eigenvalue of larger absolute value, RT2 is the */
00050 /*  eigenvalue of smaller absolute value, and (CS1,SN1) is the unit right */
00051 /*  eigenvector for RT1, giving the decomposition */
00052 
00053 /*  [ CS1  CONJG(SN1) ] [    A     B ] [ CS1 -CONJG(SN1) ] = [ RT1  0  ] */
00054 /*  [-SN1     CS1     ] [ CONJG(B) C ] [ SN1     CS1     ]   [  0  RT2 ]. */
00055 
00056 /*  Arguments */
00057 /*  ========= */
00058 
00059 /*  A      (input) COMPLEX*16 */
00060 /*         The (1,1) element of the 2-by-2 matrix. */
00061 
00062 /*  B      (input) COMPLEX*16 */
00063 /*         The (1,2) element and the conjugate of the (2,1) element of */
00064 /*         the 2-by-2 matrix. */
00065 
00066 /*  C      (input) COMPLEX*16 */
00067 /*         The (2,2) element of the 2-by-2 matrix. */
00068 
00069 /*  RT1    (output) DOUBLE PRECISION */
00070 /*         The eigenvalue of larger absolute value. */
00071 
00072 /*  RT2    (output) DOUBLE PRECISION */
00073 /*         The eigenvalue of smaller absolute value. */
00074 
00075 /*  CS1    (output) DOUBLE PRECISION */
00076 /*  SN1    (output) COMPLEX*16 */
00077 /*         The vector (CS1, SN1) is a unit right eigenvector for RT1. */
00078 
00079 /*  Further Details */
00080 /*  =============== */
00081 
00082 /*  RT1 is accurate to a few ulps barring over/underflow. */
00083 
00084 /*  RT2 may be inaccurate if there is massive cancellation in the */
00085 /*  determinant A*C-B*B; higher precision or correctly rounded or */
00086 /*  correctly truncated arithmetic would be needed to compute RT2 */
00087 /*  accurately in all cases. */
00088 
00089 /*  CS1 and SN1 are accurate to a few ulps barring over/underflow. */
00090 
00091 /*  Overflow is possible only if RT1 is within a factor of 5 of overflow. */
00092 /*  Underflow is harmless if the input data is 0 or exceeds */
00093 /*     underflow_threshold / macheps. */
00094 
00095 /* ===================================================================== */
00096 
00097 /*     .. Parameters .. */
00098 /*     .. */
00099 /*     .. Local Scalars .. */
00100 /*     .. */
00101 /*     .. External Subroutines .. */
00102 /*     .. */
00103 /*     .. Intrinsic Functions .. */
00104 /*     .. */
00105 /*     .. Executable Statements .. */
00106 
00107     if (z_abs(b) == 0.) {
00108         w.r = 1., w.i = 0.;
00109     } else {
00110         d_cnjg(&z__2, b);
00111         d__1 = z_abs(b);
00112         z__1.r = z__2.r / d__1, z__1.i = z__2.i / d__1;
00113         w.r = z__1.r, w.i = z__1.i;
00114     }
00115     d__1 = a->r;
00116     d__2 = z_abs(b);
00117     d__3 = c__->r;
00118     dlaev2_(&d__1, &d__2, &d__3, rt1, rt2, cs1, &t);
00119     z__1.r = t * w.r, z__1.i = t * w.i;
00120     sn1->r = z__1.r, sn1->i = z__1.i;
00121     return 0;
00122 
00123 /*     End of ZLAEV2 */
00124 
00125 } /* zlaev2_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:40