LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
claqp2.f
Go to the documentation of this file.
1*> \brief \b CLAQP2 computes a QR factorization with column pivoting of the matrix block.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CLAQP2 + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/claqp2.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/claqp2.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/claqp2.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CLAQP2( M, N, OFFSET, A, LDA, JPVT, TAU, VN1, VN2,
20* WORK )
21*
22* .. Scalar Arguments ..
23* INTEGER LDA, M, N, OFFSET
24* ..
25* .. Array Arguments ..
26* INTEGER JPVT( * )
27* REAL VN1( * ), VN2( * )
28* COMPLEX A( LDA, * ), TAU( * ), WORK( * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> CLAQP2 computes a QR factorization with column pivoting of
38*> the block A(OFFSET+1:M,1:N).
39*> The block A(1:OFFSET,1:N) is accordingly pivoted, but not factorized.
40*> \endverbatim
41*
42* Arguments:
43* ==========
44*
45*> \param[in] M
46*> \verbatim
47*> M is INTEGER
48*> The number of rows of the matrix A. M >= 0.
49*> \endverbatim
50*>
51*> \param[in] N
52*> \verbatim
53*> N is INTEGER
54*> The number of columns of the matrix A. N >= 0.
55*> \endverbatim
56*>
57*> \param[in] OFFSET
58*> \verbatim
59*> OFFSET is INTEGER
60*> The number of rows of the matrix A that must be pivoted
61*> but no factorized. OFFSET >= 0.
62*> \endverbatim
63*>
64*> \param[in,out] A
65*> \verbatim
66*> A is COMPLEX array, dimension (LDA,N)
67*> On entry, the M-by-N matrix A.
68*> On exit, the upper triangle of block A(OFFSET+1:M,1:N) is
69*> the triangular factor obtained; the elements in block
70*> A(OFFSET+1:M,1:N) below the diagonal, together with the
71*> array TAU, represent the orthogonal matrix Q as a product of
72*> elementary reflectors. Block A(1:OFFSET,1:N) has been
73*> accordingly pivoted, but no factorized.
74*> \endverbatim
75*>
76*> \param[in] LDA
77*> \verbatim
78*> LDA is INTEGER
79*> The leading dimension of the array A. LDA >= max(1,M).
80*> \endverbatim
81*>
82*> \param[in,out] JPVT
83*> \verbatim
84*> JPVT is INTEGER array, dimension (N)
85*> On entry, if JPVT(i) .ne. 0, the i-th column of A is permuted
86*> to the front of A*P (a leading column); if JPVT(i) = 0,
87*> the i-th column of A is a free column.
88*> On exit, if JPVT(i) = k, then the i-th column of A*P
89*> was the k-th column of A.
90*> \endverbatim
91*>
92*> \param[out] TAU
93*> \verbatim
94*> TAU is COMPLEX array, dimension (min(M,N))
95*> The scalar factors of the elementary reflectors.
96*> \endverbatim
97*>
98*> \param[in,out] VN1
99*> \verbatim
100*> VN1 is REAL array, dimension (N)
101*> The vector with the partial column norms.
102*> \endverbatim
103*>
104*> \param[in,out] VN2
105*> \verbatim
106*> VN2 is REAL array, dimension (N)
107*> The vector with the exact column norms.
108*> \endverbatim
109*>
110*> \param[out] WORK
111*> \verbatim
112*> WORK is COMPLEX array, dimension (N)
113*> \endverbatim
114*
115* Authors:
116* ========
117*
118*> \author Univ. of Tennessee
119*> \author Univ. of California Berkeley
120*> \author Univ. of Colorado Denver
121*> \author NAG Ltd.
122*
123*> \ingroup laqp2
124*
125*> \par Contributors:
126* ==================
127*>
128*> G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
129*> X. Sun, Computer Science Dept., Duke University, USA
130*> \n
131*> Partial column norm updating strategy modified on April 2011
132*> Z. Drmac and Z. Bujanovic, Dept. of Mathematics,
133*> University of Zagreb, Croatia.
134*
135*> \par References:
136* ================
137*>
138*> LAPACK Working Note 176
139*
140*> <a href="http://www.netlib.org/lapack/lawnspdf/lawn176.pdf">[PDF]</a>
141*
142* =====================================================================
143 SUBROUTINE claqp2( M, N, OFFSET, A, LDA, JPVT, TAU, VN1, VN2,
144 $ WORK )
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 REAL VN1( * ), VN2( * )
156 COMPLEX A( LDA, * ), TAU( * ), WORK( * )
157* ..
158*
159* =====================================================================
160*
161* .. Parameters ..
162 REAL ZERO, ONE
163 parameter( zero = 0.0e+0, one = 1.0e+0 )
164* ..
165* .. Local Scalars ..
166 INTEGER I, ITEMP, J, MN, OFFPI, PVT
167 REAL TEMP, TEMP2, TOL3Z
168* ..
169* .. External Subroutines ..
170 EXTERNAL clarf1f, clarfg, cswap
171* ..
172* .. Intrinsic Functions ..
173 INTRINSIC abs, conjg, max, min, sqrt
174* ..
175* .. External Functions ..
176 INTEGER ISAMAX
177 REAL SCNRM2, SLAMCH
178 EXTERNAL isamax, scnrm2, slamch
179* ..
180* .. Executable Statements ..
181*
182 mn = min( m-offset, n )
183 tol3z = sqrt(slamch('Epsilon'))
184*
185* Compute factorization.
186*
187 DO 20 i = 1, mn
188*
189 offpi = offset + i
190*
191* Determine ith pivot column and swap if necessary.
192*
193 pvt = ( i-1 ) + isamax( n-i+1, vn1( i ), 1 )
194*
195 IF( pvt.NE.i ) THEN
196 CALL cswap( m, a( 1, pvt ), 1, a( 1, i ), 1 )
197 itemp = jpvt( pvt )
198 jpvt( pvt ) = jpvt( i )
199 jpvt( i ) = itemp
200 vn1( pvt ) = vn1( i )
201 vn2( pvt ) = vn2( i )
202 END IF
203*
204* Generate elementary reflector H(i).
205*
206 IF( offpi.LT.m ) THEN
207 CALL clarfg( m-offpi+1, a( offpi, i ), a( offpi+1, i ),
208 $ 1,
209 $ tau( i ) )
210 ELSE
211 CALL clarfg( 1, a( m, i ), a( m, i ), 1, tau( i ) )
212 END IF
213*
214 IF( i.LT.n ) THEN
215*
216* Apply H(i)**H to A(offset+i:m,i+1:n) from the left.
217*
218 CALL clarf1f( 'Left', m-offpi+1, n-i, a( offpi, i ), 1,
219 $ conjg( tau( i ) ), a( offpi, i+1 ), lda,
220 $ work( 1 ) )
221 END IF
222*
223* Update partial column norms.
224*
225 DO 10 j = i + 1, n
226 IF( vn1( j ).NE.zero ) THEN
227*
228* NOTE: The following 4 lines follow from the analysis in
229* Lapack Working Note 176.
230*
231 temp = one - ( abs( a( offpi, j ) ) / vn1( j ) )**2
232 temp = max( temp, zero )
233 temp2 = temp*( vn1( j ) / vn2( j ) )**2
234 IF( temp2 .LE. tol3z ) THEN
235 IF( offpi.LT.m ) THEN
236 vn1( j ) = scnrm2( m-offpi, a( offpi+1, j ), 1 )
237 vn2( j ) = vn1( j )
238 ELSE
239 vn1( j ) = zero
240 vn2( j ) = zero
241 END IF
242 ELSE
243 vn1( j ) = vn1( j )*sqrt( temp )
244 END IF
245 END IF
246 10 CONTINUE
247*
248 20 CONTINUE
249*
250 RETURN
251*
252* End of CLAQP2
253*
254 END
subroutine clarf1f(side, m, n, v, incv, tau, c, ldc, work)
CLARF1F applies an elementary reflector to a general rectangular
Definition clarf1f.f:126
subroutine claqp2(m, n, offset, a, lda, jpvt, tau, vn1, vn2, work)
CLAQP2 computes a QR factorization with column pivoting of the matrix block.
Definition claqp2.f:145
subroutine clarfg(n, alpha, x, incx, tau)
CLARFG generates an elementary reflector (Householder matrix).
Definition clarfg.f:104
subroutine cswap(n, cx, incx, cy, incy)
CSWAP
Definition cswap.f:81