LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cunbdb5()

subroutine cunbdb5 ( integer m1,
integer m2,
integer n,
complex, dimension(*) x1,
integer incx1,
complex, dimension(*) x2,
integer incx2,
complex, dimension(ldq1,*) q1,
integer ldq1,
complex, dimension(ldq2,*) q2,
integer ldq2,
complex, dimension(*) work,
integer lwork,
integer info )

CUNBDB5

Download CUNBDB5 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> CUNBDB5 orthogonalizes the column vector
!>      X = [ X1 ]
!>          [ X2 ]
!> with respect to the columns of
!>      Q = [ Q1 ] .
!>          [ Q2 ]
!> The columns of Q must be orthonormal.
!>
!> If the projection is zero according to Kahan's 
!> criterion, then some other vector from the orthogonal complement
!> is returned. This vector is chosen in an arbitrary but deterministic
!> way.
!>
!>
Parameters
[in]M1
!>          M1 is INTEGER
!>           The dimension of X1 and the number of rows in Q1. 0 <= M1.
!> 
[in]M2
!>          M2 is INTEGER
!>           The dimension of X2 and the number of rows in Q2. 0 <= M2.
!> 
[in]N
!>          N is INTEGER
!>           The number of columns in Q1 and Q2. 0 <= N.
!> 
[in,out]X1
!>          X1 is COMPLEX array, dimension (M1)
!>           On entry, the top part of the vector to be orthogonalized.
!>           On exit, the top part of the projected vector.
!> 
[in]INCX1
!>          INCX1 is INTEGER
!>           Increment for entries of X1.
!> 
[in,out]X2
!>          X2 is COMPLEX array, dimension (M2)
!>           On entry, the bottom part of the vector to be
!>           orthogonalized. On exit, the bottom part of the projected
!>           vector.
!> 
[in]INCX2
!>          INCX2 is INTEGER
!>           Increment for entries of X2.
!> 
[in]Q1
!>          Q1 is COMPLEX array, dimension (LDQ1, N)
!>           The top part of the orthonormal basis matrix.
!> 
[in]LDQ1
!>          LDQ1 is INTEGER
!>           The leading dimension of Q1. LDQ1 >= M1.
!> 
[in]Q2
!>          Q2 is COMPLEX array, dimension (LDQ2, N)
!>           The bottom part of the orthonormal basis matrix.
!> 
[in]LDQ2
!>          LDQ2 is INTEGER
!>           The leading dimension of Q2. LDQ2 >= M2.
!> 
[out]WORK
!>          WORK is COMPLEX array, dimension (LWORK)
!> 
[in]LWORK
!>          LWORK is INTEGER
!>           The dimension of the array WORK. LWORK >= N.
!> 
[out]INFO
!>          INFO is INTEGER
!>           = 0:  successful exit.
!>           < 0:  if INFO = -i, the i-th argument had an illegal value.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 152 of file cunbdb5.f.

155*
156* -- LAPACK computational routine --
157* -- LAPACK is a software package provided by Univ. of Tennessee, --
158* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
159*
160* .. Scalar Arguments ..
161 INTEGER INCX1, INCX2, INFO, LDQ1, LDQ2, LWORK, M1, M2,
162 $ N
163* ..
164* .. Array Arguments ..
165 COMPLEX Q1(LDQ1,*), Q2(LDQ2,*), WORK(*), X1(*), X2(*)
166* ..
167*
168* =====================================================================
169*
170* .. Parameters ..
171 REAL REALZERO
172 parameter( realzero = 0.0e0 )
173 COMPLEX ONE, ZERO
174 parameter( one = (1.0e0,0.0e0), zero = (0.0e0,0.0e0) )
175* ..
176* .. Local Scalars ..
177 INTEGER CHILDINFO, I, J
178 REAL EPS, NORM, SCL, SSQ
179* ..
180* .. External Subroutines ..
181 EXTERNAL classq, cunbdb6, cscal, xerbla
182* ..
183* .. External Functions ..
184 REAL SLAMCH, SCNRM2
185 EXTERNAL slamch, scnrm2
186* ..
187* .. Intrinsic Function ..
188 INTRINSIC max
189* ..
190* .. Executable Statements ..
191*
192* Test input arguments
193*
194 info = 0
195 IF( m1 .LT. 0 ) THEN
196 info = -1
197 ELSE IF( m2 .LT. 0 ) THEN
198 info = -2
199 ELSE IF( n .LT. 0 ) THEN
200 info = -3
201 ELSE IF( incx1 .LT. 1 ) THEN
202 info = -5
203 ELSE IF( incx2 .LT. 1 ) THEN
204 info = -7
205 ELSE IF( ldq1 .LT. max( 1, m1 ) ) THEN
206 info = -9
207 ELSE IF( ldq2 .LT. max( 1, m2 ) ) THEN
208 info = -11
209 ELSE IF( lwork .LT. n ) THEN
210 info = -13
211 END IF
212*
213 IF( info .NE. 0 ) THEN
214 CALL xerbla( 'CUNBDB5', -info )
215 RETURN
216 END IF
217*
218 eps = slamch( 'Precision' )
219*
220* Project X onto the orthogonal complement of Q if X is nonzero
221*
222 scl = realzero
223 ssq = realzero
224 CALL classq( m1, x1, incx1, scl, ssq )
225 CALL classq( m2, x2, incx2, scl, ssq )
226 norm = scl * sqrt( ssq )
227*
228 IF( norm .GT. real( n ) * eps ) THEN
229* Scale vector to unit norm to avoid problems in the caller code.
230* Computing the reciprocal is undesirable but
231* * xLASCL cannot be used because of the vector increments and
232* * the round-off error has a negligible impact on
233* orthogonalization.
234 CALL cscal( m1, one / norm, x1, incx1 )
235 CALL cscal( m2, one / norm, x2, incx2 )
236 CALL cunbdb6( m1, m2, n, x1, incx1, x2, incx2, q1, ldq1, q2,
237 $ ldq2, work, lwork, childinfo )
238*
239* If the projection is nonzero, then return
240*
241 IF( scnrm2(m1,x1,incx1) .NE. realzero
242 $ .OR. scnrm2(m2,x2,incx2) .NE. realzero ) THEN
243 RETURN
244 END IF
245 END IF
246*
247* Project each standard basis vector e_1,...,e_M1 in turn, stopping
248* when a nonzero projection is found
249*
250 DO i = 1, m1
251 DO j = 1, m1
252 x1(j) = zero
253 END DO
254 x1(i) = one
255 DO j = 1, m2
256 x2(j) = zero
257 END DO
258 CALL cunbdb6( m1, m2, n, x1, incx1, x2, incx2, q1, ldq1, q2,
259 $ ldq2, work, lwork, childinfo )
260 IF( scnrm2(m1,x1,incx1) .NE. realzero
261 $ .OR. scnrm2(m2,x2,incx2) .NE. realzero ) THEN
262 RETURN
263 END IF
264 END DO
265*
266* Project each standard basis vector e_(M1+1),...,e_(M1+M2) in turn,
267* stopping when a nonzero projection is found
268*
269 DO i = 1, m2
270 DO j = 1, m1
271 x1(j) = zero
272 END DO
273 DO j = 1, m2
274 x2(j) = zero
275 END DO
276 x2(i) = one
277 CALL cunbdb6( m1, m2, n, x1, incx1, x2, incx2, q1, ldq1, q2,
278 $ ldq2, work, lwork, childinfo )
279 IF( scnrm2(m1,x1,incx1) .NE. realzero
280 $ .OR. scnrm2(m2,x2,incx2) .NE. realzero ) THEN
281 RETURN
282 END IF
283 END DO
284*
285 RETURN
286*
287* End of CUNBDB5
288*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
subroutine classq(n, x, incx, scale, sumsq)
CLASSQ updates a sum of squares represented in scaled form.
Definition classq.f90:122
real(wp) function scnrm2(n, x, incx)
SCNRM2
Definition scnrm2.f90:90
subroutine cscal(n, ca, cx, incx)
CSCAL
Definition cscal.f:78
subroutine cunbdb6(m1, m2, n, x1, incx1, x2, incx2, q1, ldq1, q2, ldq2, work, lwork, info)
CUNBDB6
Definition cunbdb6.f:158
Here is the call graph for this function:
Here is the caller graph for this function: