LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zunbdb6.f
Go to the documentation of this file.
1*> \brief \b ZUNBDB6
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZUNBDB6 + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zunbdb6.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zunbdb6.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zunbdb6.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZUNBDB6( M1, M2, N, X1, INCX1, X2, INCX2, Q1, LDQ1, Q2,
20* LDQ2, WORK, LWORK, INFO )
21*
22* .. Scalar Arguments ..
23* INTEGER INCX1, INCX2, INFO, LDQ1, LDQ2, LWORK, M1, M2,
24* $ N
25* ..
26* .. Array Arguments ..
27* COMPLEX*16 Q1(LDQ1,*), Q2(LDQ2,*), WORK(*), X1(*), X2(*)
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*>\verbatim
35*>
36*> ZUNBDB6 orthogonalizes the column vector
37*> X = [ X1 ]
38*> [ X2 ]
39*> with respect to the columns of
40*> Q = [ Q1 ] .
41*> [ Q2 ]
42*> The columns of Q must be orthonormal. The orthogonalized vector will
43*> be zero if and only if it lies entirely in the range of Q.
44*>
45*> The projection is computed with at most two iterations of the
46*> classical Gram-Schmidt algorithm, see
47*> * L. Giraud, J. Langou, M. Rozložník. "On the round-off error
48*> analysis of the Gram-Schmidt algorithm with reorthogonalization."
49*> 2002. CERFACS Technical Report No. TR/PA/02/33. URL:
50*> https://www.cerfacs.fr/algor/reports/2002/TR_PA_02_33.pdf
51*>
52*>\endverbatim
53*
54* Arguments:
55* ==========
56*
57*> \param[in] M1
58*> \verbatim
59*> M1 is INTEGER
60*> The dimension of X1 and the number of rows in Q1. 0 <= M1.
61*> \endverbatim
62*>
63*> \param[in] M2
64*> \verbatim
65*> M2 is INTEGER
66*> The dimension of X2 and the number of rows in Q2. 0 <= M2.
67*> \endverbatim
68*>
69*> \param[in] N
70*> \verbatim
71*> N is INTEGER
72*> The number of columns in Q1 and Q2. 0 <= N.
73*> \endverbatim
74*>
75*> \param[in,out] X1
76*> \verbatim
77*> X1 is COMPLEX*16 array, dimension (M1)
78*> On entry, the top part of the vector to be orthogonalized.
79*> On exit, the top part of the projected vector.
80*> \endverbatim
81*>
82*> \param[in] INCX1
83*> \verbatim
84*> INCX1 is INTEGER
85*> Increment for entries of X1.
86*> \endverbatim
87*>
88*> \param[in,out] X2
89*> \verbatim
90*> X2 is COMPLEX*16 array, dimension (M2)
91*> On entry, the bottom part of the vector to be
92*> orthogonalized. On exit, the bottom part of the projected
93*> vector.
94*> \endverbatim
95*>
96*> \param[in] INCX2
97*> \verbatim
98*> INCX2 is INTEGER
99*> Increment for entries of X2.
100*> \endverbatim
101*>
102*> \param[in] Q1
103*> \verbatim
104*> Q1 is COMPLEX*16 array, dimension (LDQ1, N)
105*> The top part of the orthonormal basis matrix.
106*> \endverbatim
107*>
108*> \param[in] LDQ1
109*> \verbatim
110*> LDQ1 is INTEGER
111*> The leading dimension of Q1. LDQ1 >= M1.
112*> \endverbatim
113*>
114*> \param[in] Q2
115*> \verbatim
116*> Q2 is COMPLEX*16 array, dimension (LDQ2, N)
117*> The bottom part of the orthonormal basis matrix.
118*> \endverbatim
119*>
120*> \param[in] LDQ2
121*> \verbatim
122*> LDQ2 is INTEGER
123*> The leading dimension of Q2. LDQ2 >= M2.
124*> \endverbatim
125*>
126*> \param[out] WORK
127*> \verbatim
128*> WORK is COMPLEX*16 array, dimension (LWORK)
129*> \endverbatim
130*>
131*> \param[in] LWORK
132*> \verbatim
133*> LWORK is INTEGER
134*> The dimension of the array WORK. LWORK >= N.
135*> \endverbatim
136*>
137*> \param[out] INFO
138*> \verbatim
139*> INFO is INTEGER
140*> = 0: successful exit.
141*> < 0: if INFO = -i, the i-th argument had an illegal value.
142*> \endverbatim
143*
144* Authors:
145* ========
146*
147*> \author Univ. of Tennessee
148*> \author Univ. of California Berkeley
149*> \author Univ. of Colorado Denver
150*> \author NAG Ltd.
151*
152*> \ingroup unbdb6
153*
154* =====================================================================
155 SUBROUTINE zunbdb6( M1, M2, N, X1, INCX1, X2, INCX2, Q1, LDQ1,
156 $ Q2,
157 $ LDQ2, WORK, LWORK, INFO )
158*
159* -- LAPACK computational routine --
160* -- LAPACK is a software package provided by Univ. of Tennessee, --
161* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
162*
163* .. Scalar Arguments ..
164 INTEGER INCX1, INCX2, INFO, LDQ1, LDQ2, LWORK, M1, M2,
165 $ N
166* ..
167* .. Array Arguments ..
168 COMPLEX*16 Q1(LDQ1,*), Q2(LDQ2,*), WORK(*), X1(*), X2(*)
169* ..
170*
171* =====================================================================
172*
173* .. Parameters ..
174 DOUBLE PRECISION ALPHA, REALONE, REALZERO
175 PARAMETER ( ALPHA = 0.83d0, realone = 1.0d0,
176 $ realzero = 0.0d0 )
177 COMPLEX*16 NEGONE, ONE, ZERO
178 PARAMETER ( NEGONE = (-1.0d0,0.0d0), one = (1.0d0,0.0d0),
179 $ zero = (0.0d0,0.0d0) )
180* ..
181* .. Local Scalars ..
182 INTEGER I, IX
183 DOUBLE PRECISION EPS, NORM, NORM_NEW, SCL, SSQ
184* ..
185* .. External Functions ..
186 DOUBLE PRECISION DLAMCH
187* ..
188* .. External Subroutines ..
189 EXTERNAL zgemv, zlassq, xerbla
190* ..
191* .. Intrinsic Function ..
192 INTRINSIC max
193* ..
194* .. Executable Statements ..
195*
196* Test input arguments
197*
198 info = 0
199 IF( m1 .LT. 0 ) THEN
200 info = -1
201 ELSE IF( m2 .LT. 0 ) THEN
202 info = -2
203 ELSE IF( n .LT. 0 ) THEN
204 info = -3
205 ELSE IF( incx1 .LT. 1 ) THEN
206 info = -5
207 ELSE IF( incx2 .LT. 1 ) THEN
208 info = -7
209 ELSE IF( ldq1 .LT. max( 1, m1 ) ) THEN
210 info = -9
211 ELSE IF( ldq2 .LT. max( 1, m2 ) ) THEN
212 info = -11
213 ELSE IF( lwork .LT. n ) THEN
214 info = -13
215 END IF
216*
217 IF( info .NE. 0 ) THEN
218 CALL xerbla( 'ZUNBDB6', -info )
219 RETURN
220 END IF
221*
222 eps = dlamch( 'Precision' )
223*
224* Compute the Euclidean norm of X
225*
226 scl = realzero
227 ssq = realzero
228 CALL zlassq( m1, x1, incx1, scl, ssq )
229 CALL zlassq( m2, x2, incx2, scl, ssq )
230 norm = scl * sqrt( ssq )
231*
232* First, project X onto the orthogonal complement of Q's column
233* space
234*
235 IF( m1 .EQ. 0 ) THEN
236 DO i = 1, n
237 work(i) = zero
238 END DO
239 ELSE
240 CALL zgemv( 'C', m1, n, one, q1, ldq1, x1, incx1, zero,
241 $ work,
242 $ 1 )
243 END IF
244*
245 CALL zgemv( 'C', m2, n, one, q2, ldq2, x2, incx2, one, work,
246 $ 1 )
247*
248 CALL zgemv( 'N', m1, n, negone, q1, ldq1, work, 1, one, x1,
249 $ incx1 )
250 CALL zgemv( 'N', m2, n, negone, q2, ldq2, work, 1, one, x2,
251 $ incx2 )
252*
253 scl = realzero
254 ssq = realzero
255 CALL zlassq( m1, x1, incx1, scl, ssq )
256 CALL zlassq( m2, x2, incx2, scl, ssq )
257 norm_new = scl * sqrt(ssq)
258*
259* If projection is sufficiently large in norm, then stop.
260* If projection is zero, then stop.
261* Otherwise, project again.
262*
263 IF( norm_new .GE. alpha * norm ) THEN
264 RETURN
265 END IF
266*
267 IF( norm_new .LE. n * eps * norm ) THEN
268 DO ix = 1, 1 + (m1-1)*incx1, incx1
269 x1( ix ) = zero
270 END DO
271 DO ix = 1, 1 + (m2-1)*incx2, incx2
272 x2( ix ) = zero
273 END DO
274 RETURN
275 END IF
276*
277 norm = norm_new
278*
279 DO i = 1, n
280 work(i) = zero
281 END DO
282*
283 IF( m1 .EQ. 0 ) THEN
284 DO i = 1, n
285 work(i) = zero
286 END DO
287 ELSE
288 CALL zgemv( 'C', m1, n, one, q1, ldq1, x1, incx1, zero,
289 $ work,
290 $ 1 )
291 END IF
292*
293 CALL zgemv( 'C', m2, n, one, q2, ldq2, x2, incx2, one, work,
294 $ 1 )
295*
296 CALL zgemv( 'N', m1, n, negone, q1, ldq1, work, 1, one, x1,
297 $ incx1 )
298 CALL zgemv( 'N', m2, n, negone, q2, ldq2, work, 1, one, x2,
299 $ incx2 )
300*
301 scl = realzero
302 ssq = realzero
303 CALL zlassq( m1, x1, incx1, scl, ssq )
304 CALL zlassq( m2, x2, incx2, scl, ssq )
305 norm_new = scl * sqrt(ssq)
306*
307* If second projection is sufficiently large in norm, then do
308* nothing more. Alternatively, if it shrunk significantly, then
309* truncate it to zero.
310*
311 IF( norm_new .LT. alpha * norm ) THEN
312 DO ix = 1, 1 + (m1-1)*incx1, incx1
313 x1(ix) = zero
314 END DO
315 DO ix = 1, 1 + (m2-1)*incx2, incx2
316 x2(ix) = zero
317 END DO
318 END IF
319*
320 RETURN
321*
322* End of ZUNBDB6
323*
324 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
Definition zgemv.f:160
subroutine zlassq(n, x, incx, scale, sumsq)
ZLASSQ updates a sum of squares represented in scaled form.
Definition zlassq.f90:122
subroutine zunbdb6(m1, m2, n, x1, incx1, x2, incx2, q1, ldq1, q2, ldq2, work, lwork, info)
ZUNBDB6
Definition zunbdb6.f:158