LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
 subroutine dlaqp2 ( integer M, integer N, integer OFFSET, double precision, dimension( lda, * ) A, integer LDA, integer, dimension( * ) JPVT, double precision, dimension( * ) TAU, double precision, dimension( * ) VN1, double precision, dimension( * ) VN2, double precision, dimension( * ) WORK )

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

Purpose:
``` DLAQP2 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 DOUBLE PRECISION array, dimension (N)`
Date
November 2013
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 151 of file dlaqp2.f.

151 *
152 * -- LAPACK auxiliary routine (version 3.5.0) --
153 * -- LAPACK is a software package provided by Univ. of Tennessee, --
154 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
155 * November 2013
156 *
157 * .. Scalar Arguments ..
158  INTEGER lda, m, n, offset
159 * ..
160 * .. Array Arguments ..
161  INTEGER jpvt( * )
162  DOUBLE PRECISION a( lda, * ), tau( * ), vn1( * ), vn2( * ),
163  \$ work( * )
164 * ..
165 *
166 * =====================================================================
167 *
168 * .. Parameters ..
169  DOUBLE PRECISION zero, one
170  parameter ( zero = 0.0d+0, one = 1.0d+0 )
171 * ..
172 * .. Local Scalars ..
173  INTEGER i, itemp, j, mn, offpi, pvt
174  DOUBLE PRECISION aii, temp, temp2, tol3z
175 * ..
176 * .. External Subroutines ..
177  EXTERNAL dlarf, dlarfg, dswap
178 * ..
179 * .. Intrinsic Functions ..
180  INTRINSIC abs, max, min, sqrt
181 * ..
182 * .. External Functions ..
183  INTEGER idamax
184  DOUBLE PRECISION dlamch, dnrm2
185  EXTERNAL idamax, dlamch, dnrm2
186 * ..
187 * .. Executable Statements ..
188 *
189  mn = min( m-offset, n )
190  tol3z = sqrt(dlamch('Epsilon'))
191 *
192 * Compute factorization.
193 *
194  DO 20 i = 1, mn
195 *
196  offpi = offset + i
197 *
198 * Determine ith pivot column and swap if necessary.
199 *
200  pvt = ( i-1 ) + idamax( n-i+1, vn1( i ), 1 )
201 *
202  IF( pvt.NE.i ) THEN
203  CALL dswap( m, a( 1, pvt ), 1, a( 1, i ), 1 )
204  itemp = jpvt( pvt )
205  jpvt( pvt ) = jpvt( i )
206  jpvt( i ) = itemp
207  vn1( pvt ) = vn1( i )
208  vn2( pvt ) = vn2( i )
209  END IF
210 *
211 * Generate elementary reflector H(i).
212 *
213  IF( offpi.LT.m ) THEN
214  CALL dlarfg( m-offpi+1, a( offpi, i ), a( offpi+1, i ), 1,
215  \$ tau( i ) )
216  ELSE
217  CALL dlarfg( 1, a( m, i ), a( m, i ), 1, tau( i ) )
218  END IF
219 *
220  IF( i.LT.n ) THEN
221 *
222 * Apply H(i)**T to A(offset+i:m,i+1:n) from the left.
223 *
224  aii = a( offpi, i )
225  a( offpi, i ) = one
226  CALL dlarf( 'Left', m-offpi+1, n-i, a( offpi, i ), 1,
227  \$ tau( i ), a( offpi, i+1 ), lda, work( 1 ) )
228  a( offpi, i ) = aii
229  END IF
230 *
231 * Update partial column norms.
232 *
233  DO 10 j = i + 1, n
234  IF( vn1( j ).NE.zero ) THEN
235 *
236 * NOTE: The following 4 lines follow from the analysis in
237 * Lapack Working Note 176.
238 *
239  temp = one - ( abs( a( offpi, j ) ) / vn1( j ) )**2
240  temp = max( temp, zero )
241  temp2 = temp*( vn1( j ) / vn2( j ) )**2
242  IF( temp2 .LE. tol3z ) THEN
243  IF( offpi.LT.m ) THEN
244  vn1( j ) = dnrm2( m-offpi, a( offpi+1, j ), 1 )
245  vn2( j ) = vn1( j )
246  ELSE
247  vn1( j ) = zero
248  vn2( j ) = zero
249  END IF
250  ELSE
251  vn1( j ) = vn1( j )*sqrt( temp )
252  END IF
253  END IF
254  10 CONTINUE
255 *
256  20 CONTINUE
257 *
258  RETURN
259 *
260 * End of DLAQP2
261 *
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:53
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine dlarf(SIDE, M, N, V, INCV, TAU, C, LDC, WORK)
DLARF applies an elementary reflector to a general rectangular matrix.
Definition: dlarf.f:126
subroutine dswap(N, DX, INCX, DY, INCY)
DSWAP
Definition: dswap.f:53
double precision function dnrm2(N, X, INCX)
DNRM2
Definition: dnrm2.f:56
subroutine dlarfg(N, ALPHA, X, INCX, TAU)
DLARFG generates an elementary reflector (Householder matrix).
Definition: dlarfg.f:108

Here is the call graph for this function:

Here is the caller graph for this function: