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

◆ sorbdb6()

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

SORBDB6

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

Purpose:
!>
!> SORBDB6 orthogonalizes the column vector
!>      X = [ X1 ]
!>          [ X2 ]
!> with respect to the columns of
!>      Q = [ Q1 ] .
!>          [ Q2 ]
!> The columns of Q must be orthonormal. The orthogonalized vector will
!> be zero if and only if it lies entirely in the range of Q.
!>
!> The projection is computed with at most two iterations of the
!> classical Gram-Schmidt algorithm, see
!> * L. Giraud, J. Langou, M. Rozložník. 
!>   2002. CERFACS Technical Report No. TR/PA/02/33. URL:
!>   https://www.cerfacs.fr/algor/reports/2002/TR_PA_02_33.pdf
!>
!>
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 REAL 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 REAL 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 REAL 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 REAL 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 REAL 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 155 of file sorbdb6.f.

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 REAL Q1(LDQ1,*), Q2(LDQ2,*), WORK(*), X1(*), X2(*)
169* ..
170*
171* =====================================================================
172*
173* .. Parameters ..
174 REAL ALPHA, REALONE, REALZERO
175 parameter( alpha = 0.83e0, realone = 1.0e0,
176 $ realzero = 0.0e0 )
177 REAL NEGONE, ONE, ZERO
178 parameter( negone = -1.0e0, one = 1.0e0, zero = 0.0e0 )
179* ..
180* .. Local Scalars ..
181 INTEGER I, IX
182 REAL EPS, NORM, NORM_NEW, SCL, SSQ
183* ..
184* .. External Functions ..
185 REAL SLAMCH
186* ..
187* .. External Subroutines ..
188 EXTERNAL sgemv, slassq, xerbla
189* ..
190* .. Intrinsic Function ..
191 INTRINSIC max
192* ..
193* .. Executable Statements ..
194*
195* Test input arguments
196*
197 info = 0
198 IF( m1 .LT. 0 ) THEN
199 info = -1
200 ELSE IF( m2 .LT. 0 ) THEN
201 info = -2
202 ELSE IF( n .LT. 0 ) THEN
203 info = -3
204 ELSE IF( incx1 .LT. 1 ) THEN
205 info = -5
206 ELSE IF( incx2 .LT. 1 ) THEN
207 info = -7
208 ELSE IF( ldq1 .LT. max( 1, m1 ) ) THEN
209 info = -9
210 ELSE IF( ldq2 .LT. max( 1, m2 ) ) THEN
211 info = -11
212 ELSE IF( lwork .LT. n ) THEN
213 info = -13
214 END IF
215*
216 IF( info .NE. 0 ) THEN
217 CALL xerbla( 'SORBDB6', -info )
218 RETURN
219 END IF
220*
221 eps = slamch( 'Precision' )
222*
223* Compute the Euclidean norm of X
224*
225 scl = realzero
226 ssq = realzero
227 CALL slassq( m1, x1, incx1, scl, ssq )
228 CALL slassq( m2, x2, incx2, scl, ssq )
229 norm = scl * sqrt( ssq )
230*
231* First, project X onto the orthogonal complement of Q's column
232* space
233*
234 IF( m1 .EQ. 0 ) THEN
235 DO i = 1, n
236 work(i) = zero
237 END DO
238 ELSE
239 CALL sgemv( 'C', m1, n, one, q1, ldq1, x1, incx1, zero,
240 $ work,
241 $ 1 )
242 END IF
243*
244 CALL sgemv( 'C', m2, n, one, q2, ldq2, x2, incx2, one, work,
245 $ 1 )
246*
247 CALL sgemv( 'N', m1, n, negone, q1, ldq1, work, 1, one, x1,
248 $ incx1 )
249 CALL sgemv( 'N', m2, n, negone, q2, ldq2, work, 1, one, x2,
250 $ incx2 )
251*
252 scl = realzero
253 ssq = realzero
254 CALL slassq( m1, x1, incx1, scl, ssq )
255 CALL slassq( m2, x2, incx2, scl, ssq )
256 norm_new = scl * sqrt(ssq)
257*
258* If projection is sufficiently large in norm, then stop.
259* If projection is zero, then stop.
260* Otherwise, project again.
261*
262 IF( norm_new .GE. alpha * norm ) THEN
263 RETURN
264 END IF
265*
266 IF( norm_new .LE. real( n ) * eps * norm ) THEN
267 DO ix = 1, 1 + (m1-1)*incx1, incx1
268 x1( ix ) = zero
269 END DO
270 DO ix = 1, 1 + (m2-1)*incx2, incx2
271 x2( ix ) = zero
272 END DO
273 RETURN
274 END IF
275*
276 norm = norm_new
277*
278 DO i = 1, n
279 work(i) = zero
280 END DO
281*
282 IF( m1 .EQ. 0 ) THEN
283 DO i = 1, n
284 work(i) = zero
285 END DO
286 ELSE
287 CALL sgemv( 'C', m1, n, one, q1, ldq1, x1, incx1, zero,
288 $ work,
289 $ 1 )
290 END IF
291*
292 CALL sgemv( 'C', m2, n, one, q2, ldq2, x2, incx2, one, work,
293 $ 1 )
294*
295 CALL sgemv( 'N', m1, n, negone, q1, ldq1, work, 1, one, x1,
296 $ incx1 )
297 CALL sgemv( 'N', m2, n, negone, q2, ldq2, work, 1, one, x2,
298 $ incx2 )
299*
300 scl = realzero
301 ssq = realzero
302 CALL slassq( m1, x1, incx1, scl, ssq )
303 CALL slassq( m2, x2, incx2, scl, ssq )
304 norm_new = scl * sqrt(ssq)
305*
306* If second projection is sufficiently large in norm, then do
307* nothing more. Alternatively, if it shrunk significantly, then
308* truncate it to zero.
309*
310 IF( norm_new .LT. alpha * norm ) THEN
311 DO ix = 1, 1 + (m1-1)*incx1, incx1
312 x1(ix) = zero
313 END DO
314 DO ix = 1, 1 + (m2-1)*incx2, incx2
315 x2(ix) = zero
316 END DO
317 END IF
318*
319 RETURN
320*
321* End of SORBDB6
322*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
SGEMV
Definition sgemv.f:158
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
subroutine slassq(n, x, incx, scale, sumsq)
SLASSQ updates a sum of squares represented in scaled form.
Definition slassq.f90:122
Here is the call graph for this function:
Here is the caller graph for this function: