LAPACK  3.10.1 LAPACK: Linear Algebra PACKage
claqr1.f
Go to the documentation of this file.
1 *> \brief \b CLAQR1 sets a scalar multiple of the first column of the product of 2-by-2 or 3-by-3 matrix H and specified shifts.
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/claqr1.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/claqr1.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/claqr1.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE CLAQR1( N, H, LDH, S1, S2, V )
22 *
23 * .. Scalar Arguments ..
24 * COMPLEX S1, S2
25 * INTEGER LDH, N
26 * ..
27 * .. Array Arguments ..
28 * COMPLEX H( LDH, * ), V( * )
29 * ..
30 *
31 *
32 *> \par Purpose:
33 * =============
34 *>
35 *> \verbatim
36 *>
37 *> Given a 2-by-2 or 3-by-3 matrix H, CLAQR1 sets v to a
38 *> scalar multiple of the first column of the product
39 *>
40 *> (*) K = (H - s1*I)*(H - s2*I)
41 *>
42 *> scaling to avoid overflows and most underflows.
43 *>
44 *> This is useful for starting double implicit shift bulges
45 *> in the QR algorithm.
46 *> \endverbatim
47 *
48 * Arguments:
49 * ==========
50 *
51 *> \param[in] N
52 *> \verbatim
53 *> N is INTEGER
54 *> Order of the matrix H. N must be either 2 or 3.
55 *> \endverbatim
56 *>
57 *> \param[in] H
58 *> \verbatim
59 *> H is COMPLEX array, dimension (LDH,N)
60 *> The 2-by-2 or 3-by-3 matrix H in (*).
61 *> \endverbatim
62 *>
63 *> \param[in] LDH
64 *> \verbatim
65 *> LDH is INTEGER
66 *> The leading dimension of H as declared in
67 *> the calling procedure. LDH >= N
68 *> \endverbatim
69 *>
70 *> \param[in] S1
71 *> \verbatim
72 *> S1 is COMPLEX
73 *> \endverbatim
74 *>
75 *> \param[in] S2
76 *> \verbatim
77 *> S2 is COMPLEX
78 *>
79 *> S1 and S2 are the shifts defining K in (*) above.
80 *> \endverbatim
81 *>
82 *> \param[out] V
83 *> \verbatim
84 *> V is COMPLEX array, dimension (N)
85 *> A scalar multiple of the first column of the
86 *> matrix K in (*).
87 *> \endverbatim
88 *
89 * Authors:
90 * ========
91 *
92 *> \author Univ. of Tennessee
93 *> \author Univ. of California Berkeley
94 *> \author Univ. of Colorado Denver
95 *> \author NAG Ltd.
96 *
97 *> \ingroup complexOTHERauxiliary
98 *
99 *> \par Contributors:
100 * ==================
101 *>
102 *> Karen Braman and Ralph Byers, Department of Mathematics,
103 *> University of Kansas, USA
104 *>
105 * =====================================================================
106  SUBROUTINE claqr1( N, H, LDH, S1, S2, V )
107 *
108 * -- LAPACK auxiliary routine --
109 * -- LAPACK is a software package provided by Univ. of Tennessee, --
110 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
111 *
112 * .. Scalar Arguments ..
113  COMPLEX S1, S2
114  INTEGER LDH, N
115 * ..
116 * .. Array Arguments ..
117  COMPLEX H( LDH, * ), V( * )
118 * ..
119 *
120 * ================================================================
121 *
122 * .. Parameters ..
123  COMPLEX ZERO
124  parameter( zero = ( 0.0e0, 0.0e0 ) )
125  REAL RZERO
126  parameter( rzero = 0.0e0 )
127 * ..
128 * .. Local Scalars ..
129  COMPLEX CDUM, H21S, H31S
130  REAL S
131 * ..
132 * .. Intrinsic Functions ..
133  INTRINSIC abs, aimag, real
134 * ..
135 * .. Statement Functions ..
136  REAL CABS1
137 * ..
138 * .. Statement Function definitions ..
139  cabs1( cdum ) = abs( real( cdum ) ) + abs( aimag( cdum ) )
140 * ..
141 * .. Executable Statements ..
142 *
143 * Quick return if possible
144 *
145  IF( n.NE.2 .AND. n.NE.3 ) THEN
146  RETURN
147  END IF
148 *
149  IF( n.EQ.2 ) THEN
150  s = cabs1( h( 1, 1 )-s2 ) + cabs1( h( 2, 1 ) )
151  IF( s.EQ.rzero ) THEN
152  v( 1 ) = zero
153  v( 2 ) = zero
154  ELSE
155  h21s = h( 2, 1 ) / s
156  v( 1 ) = h21s*h( 1, 2 ) + ( h( 1, 1 )-s1 )*
157  \$ ( ( h( 1, 1 )-s2 ) / s )
158  v( 2 ) = h21s*( h( 1, 1 )+h( 2, 2 )-s1-s2 )
159  END IF
160  ELSE
161  s = cabs1( h( 1, 1 )-s2 ) + cabs1( h( 2, 1 ) ) +
162  \$ cabs1( h( 3, 1 ) )
163  IF( s.EQ.zero ) THEN
164  v( 1 ) = zero
165  v( 2 ) = zero
166  v( 3 ) = zero
167  ELSE
168  h21s = h( 2, 1 ) / s
169  h31s = h( 3, 1 ) / s
170  v( 1 ) = ( h( 1, 1 )-s1 )*( ( h( 1, 1 )-s2 ) / s ) +
171  \$ h( 1, 2 )*h21s + h( 1, 3 )*h31s
172  v( 2 ) = h21s*( h( 1, 1 )+h( 2, 2 )-s1-s2 ) + h( 2, 3 )*h31s
173  v( 3 ) = h31s*( h( 1, 1 )+h( 3, 3 )-s1-s2 ) + h21s*h( 3, 2 )
174  END IF
175  END IF
176  END
subroutine claqr1(N, H, LDH, S1, S2, V)
CLAQR1 sets a scalar multiple of the first column of the product of 2-by-2 or 3-by-3 matrix H and spe...
Definition: claqr1.f:107