claev2.c
Go to the documentation of this file.
00001 /* claev2.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 claev2_(complex *a, complex *b, complex *c__, real *rt1, 
00017         real *rt2, real *cs1, complex *sn1)
00018 {
00019     /* System generated locals */
00020     real r__1, r__2, r__3;
00021     complex q__1, q__2;
00022 
00023     /* Builtin functions */
00024     double c_abs(complex *);
00025     void r_cnjg(complex *, complex *);
00026 
00027     /* Local variables */
00028     real t;
00029     complex w;
00030     extern /* Subroutine */ int slaev2_(real *, real *, real *, real *, real *
00031 , real *, real *);
00032 
00033 
00034 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00035 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00036 /*     November 2006 */
00037 
00038 /*     .. Scalar Arguments .. */
00039 /*     .. */
00040 
00041 /*  Purpose */
00042 /*  ======= */
00043 
00044 /*  CLAEV2 computes the eigendecomposition of a 2-by-2 Hermitian matrix */
00045 /*     [  A         B  ] */
00046 /*     [  CONJG(B)  C  ]. */
00047 /*  On return, RT1 is the eigenvalue of larger absolute value, RT2 is the */
00048 /*  eigenvalue of smaller absolute value, and (CS1,SN1) is the unit right */
00049 /*  eigenvector for RT1, giving the decomposition */
00050 
00051 /*  [ CS1  CONJG(SN1) ] [    A     B ] [ CS1 -CONJG(SN1) ] = [ RT1  0  ] */
00052 /*  [-SN1     CS1     ] [ CONJG(B) C ] [ SN1     CS1     ]   [  0  RT2 ]. */
00053 
00054 /*  Arguments */
00055 /*  ========= */
00056 
00057 /*  A      (input) COMPLEX */
00058 /*         The (1,1) element of the 2-by-2 matrix. */
00059 
00060 /*  B      (input) COMPLEX */
00061 /*         The (1,2) element and the conjugate of the (2,1) element of */
00062 /*         the 2-by-2 matrix. */
00063 
00064 /*  C      (input) COMPLEX */
00065 /*         The (2,2) element of the 2-by-2 matrix. */
00066 
00067 /*  RT1    (output) REAL */
00068 /*         The eigenvalue of larger absolute value. */
00069 
00070 /*  RT2    (output) REAL */
00071 /*         The eigenvalue of smaller absolute value. */
00072 
00073 /*  CS1    (output) REAL */
00074 /*  SN1    (output) COMPLEX */
00075 /*         The vector (CS1, SN1) is a unit right eigenvector for RT1. */
00076 
00077 /*  Further Details */
00078 /*  =============== */
00079 
00080 /*  RT1 is accurate to a few ulps barring over/underflow. */
00081 
00082 /*  RT2 may be inaccurate if there is massive cancellation in the */
00083 /*  determinant A*C-B*B; higher precision or correctly rounded or */
00084 /*  correctly truncated arithmetic would be needed to compute RT2 */
00085 /*  accurately in all cases. */
00086 
00087 /*  CS1 and SN1 are accurate to a few ulps barring over/underflow. */
00088 
00089 /*  Overflow is possible only if RT1 is within a factor of 5 of overflow. */
00090 /*  Underflow is harmless if the input data is 0 or exceeds */
00091 /*     underflow_threshold / macheps. */
00092 
00093 /* ===================================================================== */
00094 
00095 /*     .. Parameters .. */
00096 /*     .. */
00097 /*     .. Local Scalars .. */
00098 /*     .. */
00099 /*     .. External Subroutines .. */
00100 /*     .. */
00101 /*     .. Intrinsic Functions .. */
00102 /*     .. */
00103 /*     .. Executable Statements .. */
00104 
00105     if (c_abs(b) == 0.f) {
00106         w.r = 1.f, w.i = 0.f;
00107     } else {
00108         r_cnjg(&q__2, b);
00109         r__1 = c_abs(b);
00110         q__1.r = q__2.r / r__1, q__1.i = q__2.i / r__1;
00111         w.r = q__1.r, w.i = q__1.i;
00112     }
00113     r__1 = a->r;
00114     r__2 = c_abs(b);
00115     r__3 = c__->r;
00116     slaev2_(&r__1, &r__2, &r__3, rt1, rt2, cs1, &t);
00117     q__1.r = t * w.r, q__1.i = t * w.i;
00118     sn1->r = q__1.r, sn1->i = q__1.i;
00119     return 0;
00120 
00121 /*     End of CLAEV2 */
00122 
00123 } /* claev2_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:30