zlaqr1.c
Go to the documentation of this file.
00001 /* zlaqr1.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 zlaqr1_(integer *n, doublecomplex *h__, integer *ldh, 
00017         doublecomplex *s1, doublecomplex *s2, doublecomplex *v)
00018 {
00019     /* System generated locals */
00020     integer h_dim1, h_offset, i__1, i__2, i__3, i__4;
00021     doublereal d__1, d__2, d__3, d__4, d__5, d__6;
00022     doublecomplex z__1, z__2, z__3, z__4, z__5, z__6, z__7, z__8;
00023 
00024     /* Builtin functions */
00025     double d_imag(doublecomplex *);
00026 
00027     /* Local variables */
00028     doublereal s;
00029     doublecomplex 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, ZLAQR1 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*16 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*16 */
00063 /*       S2     S1 and S2 are the shifts defining K in (*) above. */
00064 
00065 /*       V      (output) COMPLEX*16 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         z__2.r = h__[i__1].r - s2->r, z__2.i = h__[i__1].i - s2->i;
00097         z__1.r = z__2.r, z__1.i = z__2.i;
00098         i__2 = h_dim1 + 2;
00099         s = (d__1 = z__1.r, abs(d__1)) + (d__2 = d_imag(&z__1), abs(d__2)) + (
00100                 (d__3 = h__[i__2].r, abs(d__3)) + (d__4 = d_imag(&h__[h_dim1 
00101                 + 2]), abs(d__4)));
00102         if (s == 0.) {
00103             v[1].r = 0., v[1].i = 0.;
00104             v[2].r = 0., v[2].i = 0.;
00105         } else {
00106             i__1 = h_dim1 + 2;
00107             z__1.r = h__[i__1].r / s, z__1.i = h__[i__1].i / s;
00108             h21s.r = z__1.r, h21s.i = z__1.i;
00109             i__1 = (h_dim1 << 1) + 1;
00110             z__2.r = h21s.r * h__[i__1].r - h21s.i * h__[i__1].i, z__2.i = 
00111                     h21s.r * h__[i__1].i + h21s.i * h__[i__1].r;
00112             i__2 = h_dim1 + 1;
00113             z__4.r = h__[i__2].r - s1->r, z__4.i = h__[i__2].i - s1->i;
00114             i__3 = h_dim1 + 1;
00115             z__6.r = h__[i__3].r - s2->r, z__6.i = h__[i__3].i - s2->i;
00116             z__5.r = z__6.r / s, z__5.i = z__6.i / s;
00117             z__3.r = z__4.r * z__5.r - z__4.i * z__5.i, z__3.i = z__4.r * 
00118                     z__5.i + z__4.i * z__5.r;
00119             z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
00120             v[1].r = z__1.r, v[1].i = z__1.i;
00121             i__1 = h_dim1 + 1;
00122             i__2 = (h_dim1 << 1) + 2;
00123             z__4.r = h__[i__1].r + h__[i__2].r, z__4.i = h__[i__1].i + h__[
00124                     i__2].i;
00125             z__3.r = z__4.r - s1->r, z__3.i = z__4.i - s1->i;
00126             z__2.r = z__3.r - s2->r, z__2.i = z__3.i - s2->i;
00127             z__1.r = h21s.r * z__2.r - h21s.i * z__2.i, z__1.i = h21s.r * 
00128                     z__2.i + h21s.i * z__2.r;
00129             v[2].r = z__1.r, v[2].i = z__1.i;
00130         }
00131     } else {
00132         i__1 = h_dim1 + 1;
00133         z__2.r = h__[i__1].r - s2->r, z__2.i = h__[i__1].i - s2->i;
00134         z__1.r = z__2.r, z__1.i = z__2.i;
00135         i__2 = h_dim1 + 2;
00136         i__3 = h_dim1 + 3;
00137         s = (d__1 = z__1.r, abs(d__1)) + (d__2 = d_imag(&z__1), abs(d__2)) + (
00138                 (d__3 = h__[i__2].r, abs(d__3)) + (d__4 = d_imag(&h__[h_dim1 
00139                 + 2]), abs(d__4))) + ((d__5 = h__[i__3].r, abs(d__5)) + (d__6 
00140                 = d_imag(&h__[h_dim1 + 3]), abs(d__6)));
00141         if (s == 0.) {
00142             v[1].r = 0., v[1].i = 0.;
00143             v[2].r = 0., v[2].i = 0.;
00144             v[3].r = 0., v[3].i = 0.;
00145         } else {
00146             i__1 = h_dim1 + 2;
00147             z__1.r = h__[i__1].r / s, z__1.i = h__[i__1].i / s;
00148             h21s.r = z__1.r, h21s.i = z__1.i;
00149             i__1 = h_dim1 + 3;
00150             z__1.r = h__[i__1].r / s, z__1.i = h__[i__1].i / s;
00151             h31s.r = z__1.r, h31s.i = z__1.i;
00152             i__1 = h_dim1 + 1;
00153             z__4.r = h__[i__1].r - s1->r, z__4.i = h__[i__1].i - s1->i;
00154             i__2 = h_dim1 + 1;
00155             z__6.r = h__[i__2].r - s2->r, z__6.i = h__[i__2].i - s2->i;
00156             z__5.r = z__6.r / s, z__5.i = z__6.i / s;
00157             z__3.r = z__4.r * z__5.r - z__4.i * z__5.i, z__3.i = z__4.r * 
00158                     z__5.i + z__4.i * z__5.r;
00159             i__3 = (h_dim1 << 1) + 1;
00160             z__7.r = h__[i__3].r * h21s.r - h__[i__3].i * h21s.i, z__7.i = 
00161                     h__[i__3].r * h21s.i + h__[i__3].i * h21s.r;
00162             z__2.r = z__3.r + z__7.r, z__2.i = z__3.i + z__7.i;
00163             i__4 = h_dim1 * 3 + 1;
00164             z__8.r = h__[i__4].r * h31s.r - h__[i__4].i * h31s.i, z__8.i = 
00165                     h__[i__4].r * h31s.i + h__[i__4].i * h31s.r;
00166             z__1.r = z__2.r + z__8.r, z__1.i = z__2.i + z__8.i;
00167             v[1].r = z__1.r, v[1].i = z__1.i;
00168             i__1 = h_dim1 + 1;
00169             i__2 = (h_dim1 << 1) + 2;
00170             z__5.r = h__[i__1].r + h__[i__2].r, z__5.i = h__[i__1].i + h__[
00171                     i__2].i;
00172             z__4.r = z__5.r - s1->r, z__4.i = z__5.i - s1->i;
00173             z__3.r = z__4.r - s2->r, z__3.i = z__4.i - s2->i;
00174             z__2.r = h21s.r * z__3.r - h21s.i * z__3.i, z__2.i = h21s.r * 
00175                     z__3.i + h21s.i * z__3.r;
00176             i__3 = h_dim1 * 3 + 2;
00177             z__6.r = h__[i__3].r * h31s.r - h__[i__3].i * h31s.i, z__6.i = 
00178                     h__[i__3].r * h31s.i + h__[i__3].i * h31s.r;
00179             z__1.r = z__2.r + z__6.r, z__1.i = z__2.i + z__6.i;
00180             v[2].r = z__1.r, v[2].i = z__1.i;
00181             i__1 = h_dim1 + 1;
00182             i__2 = h_dim1 * 3 + 3;
00183             z__5.r = h__[i__1].r + h__[i__2].r, z__5.i = h__[i__1].i + h__[
00184                     i__2].i;
00185             z__4.r = z__5.r - s1->r, z__4.i = z__5.i - s1->i;
00186             z__3.r = z__4.r - s2->r, z__3.i = z__4.i - s2->i;
00187             z__2.r = h31s.r * z__3.r - h31s.i * z__3.i, z__2.i = h31s.r * 
00188                     z__3.i + h31s.i * z__3.r;
00189             i__3 = (h_dim1 << 1) + 3;
00190             z__6.r = h21s.r * h__[i__3].r - h21s.i * h__[i__3].i, z__6.i = 
00191                     h21s.r * h__[i__3].i + h21s.i * h__[i__3].r;
00192             z__1.r = z__2.r + z__6.r, z__1.i = z__2.i + z__6.i;
00193             v[3].r = z__1.r, v[3].i = z__1.i;
00194         }
00195     }
00196     return 0;
00197 } /* zlaqr1_ */


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