claqr1.c
Go to the documentation of this file.
00001 /* claqr1.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 claqr1_(integer *n, complex *h__, integer *ldh, complex *
00017         s1, complex *s2, complex *v)
00018 {
00019     /* System generated locals */
00020     integer h_dim1, h_offset, i__1, i__2, i__3, i__4;
00021     real r__1, r__2, r__3, r__4, r__5, r__6;
00022     complex q__1, q__2, q__3, q__4, q__5, q__6, q__7, q__8;
00023 
00024     /* Builtin functions */
00025     double r_imag(complex *);
00026 
00027     /* Local variables */
00028     real s;
00029     complex h21s, h31s;
00030 
00031 
00032 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00033 /*     Univ. of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd.. */
00034 /*     November 2006 */
00035 
00036 /*     .. Scalar Arguments .. */
00037 /*     .. */
00038 /*     .. Array Arguments .. */
00039 /*     .. */
00040 
00041 /*       Given a 2-by-2 or 3-by-3 matrix H, CLAQR1 sets v to a */
00042 /*       scalar multiple of the first column of the product */
00043 
00044 /*       (*)  K = (H - s1*I)*(H - s2*I) */
00045 
00046 /*       scaling to avoid overflows and most underflows. */
00047 
00048 /*       This is useful for starting double implicit shift bulges */
00049 /*       in the QR algorithm. */
00050 
00051 
00052 /*       N      (input) integer */
00053 /*              Order of the matrix H. N must be either 2 or 3. */
00054 
00055 /*       H      (input) COMPLEX array of dimension (LDH,N) */
00056 /*              The 2-by-2 or 3-by-3 matrix H in (*). */
00057 
00058 /*       LDH    (input) integer */
00059 /*              The leading dimension of H as declared in */
00060 /*              the calling procedure.  LDH.GE.N */
00061 
00062 /*       S1     (input) COMPLEX */
00063 /*       S2     S1 and S2 are the shifts defining K in (*) above. */
00064 
00065 /*       V      (output) COMPLEX array of dimension N */
00066 /*              A scalar multiple of the first column of the */
00067 /*              matrix K in (*). */
00068 
00069 /*     ================================================================ */
00070 /*     Based on contributions by */
00071 /*        Karen Braman and Ralph Byers, Department of Mathematics, */
00072 /*        University of Kansas, USA */
00073 
00074 /*     ================================================================ */
00075 
00076 /*     .. Parameters .. */
00077 /*     .. */
00078 /*     .. Local Scalars .. */
00079 /*     .. */
00080 /*     .. Intrinsic Functions .. */
00081 /*     .. */
00082 /*     .. Statement Functions .. */
00083 /*     .. */
00084 /*     .. Statement Function definitions .. */
00085 /*     .. */
00086 /*     .. Executable Statements .. */
00087     /* Parameter adjustments */
00088     h_dim1 = *ldh;
00089     h_offset = 1 + h_dim1;
00090     h__ -= h_offset;
00091     --v;
00092 
00093     /* Function Body */
00094     if (*n == 2) {
00095         i__1 = h_dim1 + 1;
00096         q__2.r = h__[i__1].r - s2->r, q__2.i = h__[i__1].i - s2->i;
00097         q__1.r = q__2.r, q__1.i = q__2.i;
00098         i__2 = h_dim1 + 2;
00099         s = (r__1 = q__1.r, dabs(r__1)) + (r__2 = r_imag(&q__1), dabs(r__2)) 
00100                 + ((r__3 = h__[i__2].r, dabs(r__3)) + (r__4 = r_imag(&h__[
00101                 h_dim1 + 2]), dabs(r__4)));
00102         if (s == 0.f) {
00103             v[1].r = 0.f, v[1].i = 0.f;
00104             v[2].r = 0.f, v[2].i = 0.f;
00105         } else {
00106             i__1 = h_dim1 + 2;
00107             q__1.r = h__[i__1].r / s, q__1.i = h__[i__1].i / s;
00108             h21s.r = q__1.r, h21s.i = q__1.i;
00109             i__1 = (h_dim1 << 1) + 1;
00110             q__2.r = h21s.r * h__[i__1].r - h21s.i * h__[i__1].i, q__2.i = 
00111                     h21s.r * h__[i__1].i + h21s.i * h__[i__1].r;
00112             i__2 = h_dim1 + 1;
00113             q__4.r = h__[i__2].r - s1->r, q__4.i = h__[i__2].i - s1->i;
00114             i__3 = h_dim1 + 1;
00115             q__6.r = h__[i__3].r - s2->r, q__6.i = h__[i__3].i - s2->i;
00116             q__5.r = q__6.r / s, q__5.i = q__6.i / s;
00117             q__3.r = q__4.r * q__5.r - q__4.i * q__5.i, q__3.i = q__4.r * 
00118                     q__5.i + q__4.i * q__5.r;
00119             q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
00120             v[1].r = q__1.r, v[1].i = q__1.i;
00121             i__1 = h_dim1 + 1;
00122             i__2 = (h_dim1 << 1) + 2;
00123             q__4.r = h__[i__1].r + h__[i__2].r, q__4.i = h__[i__1].i + h__[
00124                     i__2].i;
00125             q__3.r = q__4.r - s1->r, q__3.i = q__4.i - s1->i;
00126             q__2.r = q__3.r - s2->r, q__2.i = q__3.i - s2->i;
00127             q__1.r = h21s.r * q__2.r - h21s.i * q__2.i, q__1.i = h21s.r * 
00128                     q__2.i + h21s.i * q__2.r;
00129             v[2].r = q__1.r, v[2].i = q__1.i;
00130         }
00131     } else {
00132         i__1 = h_dim1 + 1;
00133         q__2.r = h__[i__1].r - s2->r, q__2.i = h__[i__1].i - s2->i;
00134         q__1.r = q__2.r, q__1.i = q__2.i;
00135         i__2 = h_dim1 + 2;
00136         i__3 = h_dim1 + 3;
00137         s = (r__1 = q__1.r, dabs(r__1)) + (r__2 = r_imag(&q__1), dabs(r__2)) 
00138                 + ((r__3 = h__[i__2].r, dabs(r__3)) + (r__4 = r_imag(&h__[
00139                 h_dim1 + 2]), dabs(r__4))) + ((r__5 = h__[i__3].r, dabs(r__5))
00140                  + (r__6 = r_imag(&h__[h_dim1 + 3]), dabs(r__6)));
00141         if (s == 0.f) {
00142             v[1].r = 0.f, v[1].i = 0.f;
00143             v[2].r = 0.f, v[2].i = 0.f;
00144             v[3].r = 0.f, v[3].i = 0.f;
00145         } else {
00146             i__1 = h_dim1 + 2;
00147             q__1.r = h__[i__1].r / s, q__1.i = h__[i__1].i / s;
00148             h21s.r = q__1.r, h21s.i = q__1.i;
00149             i__1 = h_dim1 + 3;
00150             q__1.r = h__[i__1].r / s, q__1.i = h__[i__1].i / s;
00151             h31s.r = q__1.r, h31s.i = q__1.i;
00152             i__1 = h_dim1 + 1;
00153             q__4.r = h__[i__1].r - s1->r, q__4.i = h__[i__1].i - s1->i;
00154             i__2 = h_dim1 + 1;
00155             q__6.r = h__[i__2].r - s2->r, q__6.i = h__[i__2].i - s2->i;
00156             q__5.r = q__6.r / s, q__5.i = q__6.i / s;
00157             q__3.r = q__4.r * q__5.r - q__4.i * q__5.i, q__3.i = q__4.r * 
00158                     q__5.i + q__4.i * q__5.r;
00159             i__3 = (h_dim1 << 1) + 1;
00160             q__7.r = h__[i__3].r * h21s.r - h__[i__3].i * h21s.i, q__7.i = 
00161                     h__[i__3].r * h21s.i + h__[i__3].i * h21s.r;
00162             q__2.r = q__3.r + q__7.r, q__2.i = q__3.i + q__7.i;
00163             i__4 = h_dim1 * 3 + 1;
00164             q__8.r = h__[i__4].r * h31s.r - h__[i__4].i * h31s.i, q__8.i = 
00165                     h__[i__4].r * h31s.i + h__[i__4].i * h31s.r;
00166             q__1.r = q__2.r + q__8.r, q__1.i = q__2.i + q__8.i;
00167             v[1].r = q__1.r, v[1].i = q__1.i;
00168             i__1 = h_dim1 + 1;
00169             i__2 = (h_dim1 << 1) + 2;
00170             q__5.r = h__[i__1].r + h__[i__2].r, q__5.i = h__[i__1].i + h__[
00171                     i__2].i;
00172             q__4.r = q__5.r - s1->r, q__4.i = q__5.i - s1->i;
00173             q__3.r = q__4.r - s2->r, q__3.i = q__4.i - s2->i;
00174             q__2.r = h21s.r * q__3.r - h21s.i * q__3.i, q__2.i = h21s.r * 
00175                     q__3.i + h21s.i * q__3.r;
00176             i__3 = h_dim1 * 3 + 2;
00177             q__6.r = h__[i__3].r * h31s.r - h__[i__3].i * h31s.i, q__6.i = 
00178                     h__[i__3].r * h31s.i + h__[i__3].i * h31s.r;
00179             q__1.r = q__2.r + q__6.r, q__1.i = q__2.i + q__6.i;
00180             v[2].r = q__1.r, v[2].i = q__1.i;
00181             i__1 = h_dim1 + 1;
00182             i__2 = h_dim1 * 3 + 3;
00183             q__5.r = h__[i__1].r + h__[i__2].r, q__5.i = h__[i__1].i + h__[
00184                     i__2].i;
00185             q__4.r = q__5.r - s1->r, q__4.i = q__5.i - s1->i;
00186             q__3.r = q__4.r - s2->r, q__3.i = q__4.i - s2->i;
00187             q__2.r = h31s.r * q__3.r - h31s.i * q__3.i, q__2.i = h31s.r * 
00188                     q__3.i + h31s.i * q__3.r;
00189             i__3 = (h_dim1 << 1) + 3;
00190             q__6.r = h21s.r * h__[i__3].r - h21s.i * h__[i__3].i, q__6.i = 
00191                     h21s.r * h__[i__3].i + h21s.i * h__[i__3].r;
00192             q__1.r = q__2.r + q__6.r, q__1.i = q__2.i + q__6.i;
00193             v[3].r = q__1.r, v[3].i = q__1.i;
00194         }
00195     }
00196     return 0;
00197 } /* claqr1_ */


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