slaqr1.c
Go to the documentation of this file.
00001 /* slaqr1.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 slaqr1_(integer *n, real *h__, integer *ldh, real *sr1, 
00017         real *si1, real *sr2, real *si2, real *v)
00018 {
00019     /* System generated locals */
00020     integer h_dim1, h_offset;
00021     real r__1, r__2, r__3;
00022 
00023     /* Local variables */
00024     real s, h21s, h31s;
00025 
00026 
00027 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00028 /*     Univ. of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd.. */
00029 /*     November 2006 */
00030 
00031 /*     .. Scalar Arguments .. */
00032 /*     .. */
00033 /*     .. Array Arguments .. */
00034 /*     .. */
00035 
00036 /*       Given a 2-by-2 or 3-by-3 matrix H, SLAQR1 sets v to a */
00037 /*       scalar multiple of the first column of the product */
00038 
00039 /*       (*)  K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I) */
00040 
00041 /*       scaling to avoid overflows and most underflows. It */
00042 /*       is assumed that either */
00043 
00044 /*               1) sr1 = sr2 and si1 = -si2 */
00045 /*           or */
00046 /*               2) si1 = si2 = 0. */
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) REAL 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 /*       SR1    (input) REAL */
00063 /*       SI1    The shifts in (*). */
00064 /*       SR2 */
00065 /*       SI2 */
00066 
00067 /*       V      (output) REAL array of dimension N */
00068 /*              A scalar multiple of the first column of the */
00069 /*              matrix K in (*). */
00070 
00071 /*     ================================================================ */
00072 /*     Based on contributions by */
00073 /*        Karen Braman and Ralph Byers, Department of Mathematics, */
00074 /*        University of Kansas, USA */
00075 
00076 /*     ================================================================ */
00077 
00078 /*     .. Parameters .. */
00079 /*     .. */
00080 /*     .. Local Scalars .. */
00081 /*     .. */
00082 /*     .. Intrinsic Functions .. */
00083 /*     .. */
00084 /*     .. Executable Statements .. */
00085     /* Parameter adjustments */
00086     h_dim1 = *ldh;
00087     h_offset = 1 + h_dim1;
00088     h__ -= h_offset;
00089     --v;
00090 
00091     /* Function Body */
00092     if (*n == 2) {
00093         s = (r__1 = h__[h_dim1 + 1] - *sr2, dabs(r__1)) + dabs(*si2) + (r__2 =
00094                  h__[h_dim1 + 2], dabs(r__2));
00095         if (s == 0.f) {
00096             v[1] = 0.f;
00097             v[2] = 0.f;
00098         } else {
00099             h21s = h__[h_dim1 + 2] / s;
00100             v[1] = h21s * h__[(h_dim1 << 1) + 1] + (h__[h_dim1 + 1] - *sr1) * 
00101                     ((h__[h_dim1 + 1] - *sr2) / s) - *si1 * (*si2 / s);
00102             v[2] = h21s * (h__[h_dim1 + 1] + h__[(h_dim1 << 1) + 2] - *sr1 - *
00103                     sr2);
00104         }
00105     } else {
00106         s = (r__1 = h__[h_dim1 + 1] - *sr2, dabs(r__1)) + dabs(*si2) + (r__2 =
00107                  h__[h_dim1 + 2], dabs(r__2)) + (r__3 = h__[h_dim1 + 3], dabs(
00108                 r__3));
00109         if (s == 0.f) {
00110             v[1] = 0.f;
00111             v[2] = 0.f;
00112             v[3] = 0.f;
00113         } else {
00114             h21s = h__[h_dim1 + 2] / s;
00115             h31s = h__[h_dim1 + 3] / s;
00116             v[1] = (h__[h_dim1 + 1] - *sr1) * ((h__[h_dim1 + 1] - *sr2) / s) 
00117                     - *si1 * (*si2 / s) + h__[(h_dim1 << 1) + 1] * h21s + h__[
00118                     h_dim1 * 3 + 1] * h31s;
00119             v[2] = h21s * (h__[h_dim1 + 1] + h__[(h_dim1 << 1) + 2] - *sr1 - *
00120                     sr2) + h__[h_dim1 * 3 + 2] * h31s;
00121             v[3] = h31s * (h__[h_dim1 + 1] + h__[h_dim1 * 3 + 3] - *sr1 - *
00122                     sr2) + h21s * h__[(h_dim1 << 1) + 3];
00123         }
00124     }
00125     return 0;
00126 } /* slaqr1_ */


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