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

◆ zlaqp2()

subroutine zlaqp2 ( integer m,
integer n,
integer offset,
complex*16, dimension( lda, * ) a,
integer lda,
integer, dimension( * ) jpvt,
complex*16, dimension( * ) tau,
double precision, dimension( * ) vn1,
double precision, dimension( * ) vn2,
complex*16, dimension( * ) work )

ZLAQP2 computes a QR factorization with column pivoting of the matrix block.

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

Purpose:
!>
!> ZLAQP2 computes a QR factorization with column pivoting of
!> the block A(OFFSET+1:M,1:N).
!> The block A(1:OFFSET,1:N) is accordingly pivoted, but not factorized.
!> 
Parameters
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix A. M >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrix A. N >= 0.
!> 
[in]OFFSET
!>          OFFSET is INTEGER
!>          The number of rows of the matrix A that must be pivoted
!>          but no factorized. OFFSET >= 0.
!> 
[in,out]A
!>          A is COMPLEX*16 array, dimension (LDA,N)
!>          On entry, the M-by-N matrix A.
!>          On exit, the upper triangle of block A(OFFSET+1:M,1:N) is
!>          the triangular factor obtained; the elements in block
!>          A(OFFSET+1:M,1:N) below the diagonal, together with the
!>          array TAU, represent the orthogonal matrix Q as a product of
!>          elementary reflectors. Block A(1:OFFSET,1:N) has been
!>          accordingly pivoted, but no factorized.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A. LDA >= max(1,M).
!> 
[in,out]JPVT
!>          JPVT is INTEGER array, dimension (N)
!>          On entry, if JPVT(i) .ne. 0, the i-th column of A is permuted
!>          to the front of A*P (a leading column); if JPVT(i) = 0,
!>          the i-th column of A is a free column.
!>          On exit, if JPVT(i) = k, then the i-th column of A*P
!>          was the k-th column of A.
!> 
[out]TAU
!>          TAU is COMPLEX*16 array, dimension (min(M,N))
!>          The scalar factors of the elementary reflectors.
!> 
[in,out]VN1
!>          VN1 is DOUBLE PRECISION array, dimension (N)
!>          The vector with the partial column norms.
!> 
[in,out]VN2
!>          VN2 is DOUBLE PRECISION array, dimension (N)
!>          The vector with the exact column norms.
!> 
[out]WORK
!>          WORK is COMPLEX*16 array, dimension (N)
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain X. Sun, Computer Science Dept., Duke University, USA
Partial column norm updating strategy modified on April 2011 Z. Drmac and Z. Bujanovic, Dept. of Mathematics, University of Zagreb, Croatia.
References:
LAPACK Working Note 176 [PDF]

Definition at line 143 of file zlaqp2.f.

145*
146* -- LAPACK auxiliary routine --
147* -- LAPACK is a software package provided by Univ. of Tennessee, --
148* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
149*
150* .. Scalar Arguments ..
151 INTEGER LDA, M, N, OFFSET
152* ..
153* .. Array Arguments ..
154 INTEGER JPVT( * )
155 DOUBLE PRECISION VN1( * ), VN2( * )
156 COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * )
157* ..
158*
159* =====================================================================
160*
161* .. Parameters ..
162 DOUBLE PRECISION ZERO, ONE
163 COMPLEX*16 CONE
164 parameter( zero = 0.0d+0, one = 1.0d+0,
165 $ cone = ( 1.0d+0, 0.0d+0 ) )
166* ..
167* .. Local Scalars ..
168 INTEGER I, ITEMP, J, MN, OFFPI, PVT
169 DOUBLE PRECISION TEMP, TEMP2, TOL3Z
170* ..
171* .. External Subroutines ..
172 EXTERNAL zlarf1f, zlarfg, zswap
173* ..
174* .. Intrinsic Functions ..
175 INTRINSIC abs, dconjg, max, min, sqrt
176* ..
177* .. External Functions ..
178 INTEGER IDAMAX
179 DOUBLE PRECISION DLAMCH, DZNRM2
180 EXTERNAL idamax, dlamch, dznrm2
181* ..
182* .. Executable Statements ..
183*
184 mn = min( m-offset, n )
185 tol3z = sqrt(dlamch('Epsilon'))
186*
187* Compute factorization.
188*
189 DO 20 i = 1, mn
190*
191 offpi = offset + i
192*
193* Determine ith pivot column and swap if necessary.
194*
195 pvt = ( i-1 ) + idamax( n-i+1, vn1( i ), 1 )
196*
197 IF( pvt.NE.i ) THEN
198 CALL zswap( m, a( 1, pvt ), 1, a( 1, i ), 1 )
199 itemp = jpvt( pvt )
200 jpvt( pvt ) = jpvt( i )
201 jpvt( i ) = itemp
202 vn1( pvt ) = vn1( i )
203 vn2( pvt ) = vn2( i )
204 END IF
205*
206* Generate elementary reflector H(i).
207*
208 IF( offpi.LT.m ) THEN
209 CALL zlarfg( m-offpi+1, a( offpi, i ), a( offpi+1, i ),
210 $ 1,
211 $ tau( i ) )
212 ELSE
213 CALL zlarfg( 1, a( m, i ), a( m, i ), 1, tau( i ) )
214 END IF
215*
216 IF( i.LT.n ) THEN
217*
218* Apply H(i)**H to A(offset+i:m,i+1:n) from the left.
219*
220 CALL zlarf1f( 'Left', m-offpi+1, n-i, a( offpi, i ), 1,
221 $ conjg( tau( i ) ), a( offpi, i+1 ), lda,
222 $ work( 1 ) )
223 END IF
224*
225* Update partial column norms.
226*
227 DO 10 j = i + 1, n
228 IF( vn1( j ).NE.zero ) THEN
229*
230* NOTE: The following 4 lines follow from the analysis in
231* Lapack Working Note 176.
232*
233 temp = one - ( abs( a( offpi, j ) ) / vn1( j ) )**2
234 temp = max( temp, zero )
235 temp2 = temp*( vn1( j ) / vn2( j ) )**2
236 IF( temp2 .LE. tol3z ) THEN
237 IF( offpi.LT.m ) THEN
238 vn1( j ) = dznrm2( m-offpi, a( offpi+1, j ), 1 )
239 vn2( j ) = vn1( j )
240 ELSE
241 vn1( j ) = zero
242 vn2( j ) = zero
243 END IF
244 ELSE
245 vn1( j ) = vn1( j )*sqrt( temp )
246 END IF
247 END IF
248 10 CONTINUE
249*
250 20 CONTINUE
251*
252 RETURN
253*
254* End of ZLAQP2
255*
integer function idamax(n, dx, incx)
IDAMAX
Definition idamax.f:71
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
subroutine zlarf1f(side, m, n, v, incv, tau, c, ldc, work)
ZLARF1F applies an elementary reflector to a general rectangular
Definition zlarf1f.f:157
subroutine zlarfg(n, alpha, x, incx, tau)
ZLARFG generates an elementary reflector (Householder matrix).
Definition zlarfg.f:104
real(wp) function dznrm2(n, x, incx)
DZNRM2
Definition dznrm2.f90:90
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
Definition zswap.f:81
Here is the call graph for this function:
Here is the caller graph for this function: