LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zlaqp2rk.f
Go to the documentation of this file.
1*> \brief \b ZLAQP2RK computes truncated QR factorization with column pivoting of a complex matrix block using Level 2 BLAS and overwrites a complex m-by-nrhs matrix B with Q**H * B.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZLAQP2RK + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlaqp2rk.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlaqp2rk.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlaqp2rk.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZLAQP2RK( M, N, NRHS, IOFFSET, KMAX, ABSTOL, RELTOL,
20* $ KP1, MAXC2NRM, A, LDA, K, MAXC2NRMK,
21* $ RELMAXC2NRMK, JPIV, TAU, VN1, VN2, WORK,
22* $ INFO )
23* IMPLICIT NONE
24*
25* .. Scalar Arguments ..
26* INTEGER INFO, IOFFSET, KP1, K, KMAX, LDA, M, N, NRHS
27* DOUBLE PRECISION ABSTOL, MAXC2NRM, MAXC2NRMK, RELMAXC2NRMK,
28* $ RELTOL
29* ..
30* .. Array Arguments ..
31* INTEGER JPIV( * )
32* DOUBLE PRECISION VN1( * ), VN2( * )
33* COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * )
34* $
35* ..
36*
37*
38*> \par Purpose:
39* =============
40*>
41*> \verbatim
42*>
43*> ZLAQP2RK computes a truncated (rank K) or full rank Householder QR
44*> factorization with column pivoting of the complex matrix
45*> block A(IOFFSET+1:M,1:N) as
46*>
47*> A * P(K) = Q(K) * R(K).
48*>
49*> The routine uses Level 2 BLAS. The block A(1:IOFFSET,1:N)
50*> is accordingly pivoted, but not factorized.
51*>
52*> The routine also overwrites the right-hand-sides matrix block B
53*> stored in A(IOFFSET+1:M,N+1:N+NRHS) with Q(K)**H * B.
54*> \endverbatim
55*
56* Arguments:
57* ==========
58*
59*> \param[in] M
60*> \verbatim
61*> M is INTEGER
62*> The number of rows of the matrix A. M >= 0.
63*> \endverbatim
64*>
65*> \param[in] N
66*> \verbatim
67*> N is INTEGER
68*> The number of columns of the matrix A. N >= 0.
69*> \endverbatim
70*>
71*> \param[in] NRHS
72*> \verbatim
73*> NRHS is INTEGER
74*> The number of right hand sides, i.e., the number of
75*> columns of the matrix B. NRHS >= 0.
76*> \endverbatim
77*>
78*> \param[in] IOFFSET
79*> \verbatim
80*> IOFFSET is INTEGER
81*> The number of rows of the matrix A that must be pivoted
82*> but not factorized. IOFFSET >= 0.
83*>
84*> IOFFSET also represents the number of columns of the whole
85*> original matrix A_orig that have been factorized
86*> in the previous steps.
87*> \endverbatim
88*>
89*> \param[in] KMAX
90*> \verbatim
91*> KMAX is INTEGER
92*>
93*> The first factorization stopping criterion. KMAX >= 0.
94*>
95*> The maximum number of columns of the matrix A to factorize,
96*> i.e. the maximum factorization rank.
97*>
98*> a) If KMAX >= min(M-IOFFSET,N), then this stopping
99*> criterion is not used, factorize columns
100*> depending on ABSTOL and RELTOL.
101*>
102*> b) If KMAX = 0, then this stopping criterion is
103*> satisfied on input and the routine exits immediately.
104*> This means that the factorization is not performed,
105*> the matrices A and B and the arrays TAU, IPIV
106*> are not modified.
107*> \endverbatim
108*>
109*> \param[in] ABSTOL
110*> \verbatim
111*> ABSTOL is DOUBLE PRECISION, cannot be NaN.
112*>
113*> The second factorization stopping criterion.
114*>
115*> The absolute tolerance (stopping threshold) for
116*> maximum column 2-norm of the residual matrix.
117*> The algorithm converges (stops the factorization) when
118*> the maximum column 2-norm of the residual matrix
119*> is less than or equal to ABSTOL.
120*>
121*> a) If ABSTOL < 0.0, then this stopping criterion is not
122*> used, the routine factorizes columns depending
123*> on KMAX and RELTOL.
124*> This includes the case ABSTOL = -Inf.
125*>
126*> b) If 0.0 <= ABSTOL then the input value
127*> of ABSTOL is used.
128*> \endverbatim
129*>
130*> \param[in] RELTOL
131*> \verbatim
132*> RELTOL is DOUBLE PRECISION, cannot be NaN.
133*>
134*> The third factorization stopping criterion.
135*>
136*> The tolerance (stopping threshold) for the ratio of the
137*> maximum column 2-norm of the residual matrix to the maximum
138*> column 2-norm of the original matrix A_orig. The algorithm
139*> converges (stops the factorization), when this ratio is
140*> less than or equal to RELTOL.
141*>
142*> a) If RELTOL < 0.0, then this stopping criterion is not
143*> used, the routine factorizes columns depending
144*> on KMAX and ABSTOL.
145*> This includes the case RELTOL = -Inf.
146*>
147*> d) If 0.0 <= RELTOL then the input value of RELTOL
148*> is used.
149*> \endverbatim
150*>
151*> \param[in] KP1
152*> \verbatim
153*> KP1 is INTEGER
154*> The index of the column with the maximum 2-norm in
155*> the whole original matrix A_orig determined in the
156*> main routine ZGEQP3RK. 1 <= KP1 <= N_orig_mat.
157*> \endverbatim
158*>
159*> \param[in] MAXC2NRM
160*> \verbatim
161*> MAXC2NRM is DOUBLE PRECISION
162*> The maximum column 2-norm of the whole original
163*> matrix A_orig computed in the main routine ZGEQP3RK.
164*> MAXC2NRM >= 0.
165*> \endverbatim
166*>
167*> \param[in,out] A
168*> \verbatim
169*> A is COMPLEX*16 array, dimension (LDA,N+NRHS)
170*> On entry:
171*> the M-by-N matrix A and M-by-NRHS matrix B, as in
172*>
173*> N NRHS
174*> array_A = M [ mat_A, mat_B ]
175*>
176*> On exit:
177*> 1. The elements in block A(IOFFSET+1:M,1:K) below
178*> the diagonal together with the array TAU represent
179*> the unitary matrix Q(K) as a product of elementary
180*> reflectors.
181*> 2. The upper triangular block of the matrix A stored
182*> in A(IOFFSET+1:M,1:K) is the triangular factor obtained.
183*> 3. The block of the matrix A stored in A(1:IOFFSET,1:N)
184*> has been accordingly pivoted, but not factorized.
185*> 4. The rest of the array A, block A(IOFFSET+1:M,K+1:N+NRHS).
186*> The left part A(IOFFSET+1:M,K+1:N) of this block
187*> contains the residual of the matrix A, and,
188*> if NRHS > 0, the right part of the block
189*> A(IOFFSET+1:M,N+1:N+NRHS) contains the block of
190*> the right-hand-side matrix B. Both these blocks have been
191*> updated by multiplication from the left by Q(K)**H.
192*> \endverbatim
193*>
194*> \param[in] LDA
195*> \verbatim
196*> LDA is INTEGER
197*> The leading dimension of the array A. LDA >= max(1,M).
198*> \endverbatim
199*>
200*> \param[out] K
201*> \verbatim
202*> K is INTEGER
203*> Factorization rank of the matrix A, i.e. the rank of
204*> the factor R, which is the same as the number of non-zero
205*> rows of the factor R. 0 <= K <= min(M-IOFFSET,KMAX,N).
206*>
207*> K also represents the number of non-zero Householder
208*> vectors.
209*> \endverbatim
210*>
211*> \param[out] MAXC2NRMK
212*> \verbatim
213*> MAXC2NRMK is DOUBLE PRECISION
214*> The maximum column 2-norm of the residual matrix,
215*> when the factorization stopped at rank K. MAXC2NRMK >= 0.
216*> \endverbatim
217*>
218*> \param[out] RELMAXC2NRMK
219*> \verbatim
220*> RELMAXC2NRMK is DOUBLE PRECISION
221*> The ratio MAXC2NRMK / MAXC2NRM of the maximum column
222*> 2-norm of the residual matrix (when the factorization
223*> stopped at rank K) to the maximum column 2-norm of the
224*> whole original matrix A. RELMAXC2NRMK >= 0.
225*> \endverbatim
226*>
227*> \param[out] JPIV
228*> \verbatim
229*> JPIV is INTEGER array, dimension (N)
230*> Column pivot indices, for 1 <= j <= N, column j
231*> of the matrix A was interchanged with column JPIV(j).
232*> \endverbatim
233*>
234*> \param[out] TAU
235*> \verbatim
236*> TAU is COMPLEX*16 array, dimension (min(M-IOFFSET,N))
237*> The scalar factors of the elementary reflectors.
238*> \endverbatim
239*>
240*> \param[in,out] VN1
241*> \verbatim
242*> VN1 is DOUBLE PRECISION array, dimension (N)
243*> The vector with the partial column norms.
244*> \endverbatim
245*>
246*> \param[in,out] VN2
247*> \verbatim
248*> VN2 is DOUBLE PRECISION array, dimension (N)
249*> The vector with the exact column norms.
250*> \endverbatim
251*>
252*> \param[out] WORK
253*> \verbatim
254*> WORK is COMPLEX*16 array, dimension (N-1)
255*> Used in ZLARF1F subroutine to apply an elementary
256*> reflector from the left.
257*> \endverbatim
258*>
259*> \param[out] INFO
260*> \verbatim
261*> INFO is INTEGER
262*> 1) INFO = 0: successful exit.
263*> 2) If INFO = j_1, where 1 <= j_1 <= N, then NaN was
264*> detected and the routine stops the computation.
265*> The j_1-th column of the matrix A or the j_1-th
266*> element of array TAU contains the first occurrence
267*> of NaN in the factorization step K+1 ( when K columns
268*> have been factorized ).
269*>
270*> On exit:
271*> K is set to the number of
272*> factorized columns without
273*> exception.
274*> MAXC2NRMK is set to NaN.
275*> RELMAXC2NRMK is set to NaN.
276*> TAU(K+1:min(M,N)) is not set and contains undefined
277*> elements. If j_1=K+1, TAU(K+1)
278*> may contain NaN.
279*> 3) If INFO = j_2, where N+1 <= j_2 <= 2*N, then no NaN
280*> was detected, but +Inf (or -Inf) was detected and
281*> the routine continues the computation until completion.
282*> The (j_2-N)-th column of the matrix A contains the first
283*> occurrence of +Inf (or -Inf) in the factorization
284*> step K+1 ( when K columns have been factorized ).
285*> \endverbatim
286*
287* Authors:
288* ========
289*
290*> \author Univ. of Tennessee
291*> \author Univ. of California Berkeley
292*> \author Univ. of Colorado Denver
293*> \author NAG Ltd.
294*
295*> \ingroup laqp2rk
296*
297*> \par References:
298* ================
299*> [1] A Level 3 BLAS QR factorization algorithm with column pivoting developed in 1996.
300*> G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain.
301*> X. Sun, Computer Science Dept., Duke University, USA.
302*> C. H. Bischof, Math. and Comp. Sci. Div., Argonne National Lab, USA.
303*> A BLAS-3 version of the QR factorization with column pivoting.
304*> LAPACK Working Note 114
305*> <a href="https://www.netlib.org/lapack/lawnspdf/lawn114.pdf">https://www.netlib.org/lapack/lawnspdf/lawn114.pdf</a>
306*> and in
307*> SIAM J. Sci. Comput., 19(5):1486-1494, Sept. 1998.
308*> <a href="https://doi.org/10.1137/S1064827595296732">https://doi.org/10.1137/S1064827595296732</a>
309*>
310*> [2] A partial column norm updating strategy developed in 2006.
311*> Z. Drmac and Z. Bujanovic, Dept. of Math., University of Zagreb, Croatia.
312*> On the failure of rank revealing QR factorization software – a case study.
313*> LAPACK Working Note 176.
314*> <a href="http://www.netlib.org/lapack/lawnspdf/lawn176.pdf">http://www.netlib.org/lapack/lawnspdf/lawn176.pdf</a>
315*> and in
316*> ACM Trans. Math. Softw. 35, 2, Article 12 (July 2008), 28 pages.
317*> <a href="https://doi.org/10.1145/1377612.1377616">https://doi.org/10.1145/1377612.1377616</a>
318*
319*> \par Contributors:
320* ==================
321*>
322*> \verbatim
323*>
324*> November 2023, Igor Kozachenko, James Demmel,
325*> EECS Department,
326*> University of California, Berkeley, USA.
327*>
328*> \endverbatim
329*
330* =====================================================================
331 SUBROUTINE zlaqp2rk( M, N, NRHS, IOFFSET, KMAX, ABSTOL, RELTOL,
332 $ KP1, MAXC2NRM, A, LDA, K, MAXC2NRMK,
333 $ RELMAXC2NRMK, JPIV, TAU, VN1, VN2, WORK,
334 $ INFO )
335 IMPLICIT NONE
336*
337* -- LAPACK auxiliary routine --
338* -- LAPACK is a software package provided by Univ. of Tennessee, --
339* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
340*
341* .. Scalar Arguments ..
342 INTEGER INFO, IOFFSET, KP1, K, KMAX, LDA, M, N, NRHS
343 DOUBLE PRECISION ABSTOL, MAXC2NRM, MAXC2NRMK, RELMAXC2NRMK,
344 $ RELTOL
345* ..
346* .. Array Arguments ..
347 INTEGER JPIV( * )
348 DOUBLE PRECISION VN1( * ), VN2( * )
349 COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * )
350* ..
351*
352* =====================================================================
353*
354* .. Parameters ..
355 DOUBLE PRECISION ZERO, ONE
356 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
357 COMPLEX*16 CZERO, CONE
358 parameter( czero = ( 0.0d+0, 0.0d+0 ),
359 $ cone = ( 1.0d+0, 0.0d+0 ) )
360* ..
361* .. Local Scalars ..
362 INTEGER I, ITEMP, J, JMAXC2NRM, KK, KP, MINMNFACT,
363 $ MINMNUPDT
364 DOUBLE PRECISION HUGEVAL, TAUNAN, TEMP, TEMP2, TOL3Z
365* ..
366* .. External Subroutines ..
367 EXTERNAL zlarf1f, zlarfg, zswap
368* ..
369* .. Intrinsic Functions ..
370 INTRINSIC abs, dble, dconjg, dimag, max, min, sqrt
371* ..
372* .. External Functions ..
373 LOGICAL DISNAN
374 INTEGER IDAMAX
375 DOUBLE PRECISION DLAMCH, DZNRM2
376 EXTERNAL disnan, dlamch, idamax, dznrm2
377* ..
378* .. Executable Statements ..
379*
380* Initialize INFO
381*
382 info = 0
383*
384* MINMNFACT in the smallest dimension of the submatrix
385* A(IOFFSET+1:M,1:N) to be factorized.
386*
387* MINMNUPDT is the smallest dimension
388* of the subarray A(IOFFSET+1:M,1:N+NRHS) to be udated, which
389* contains the submatrices A(IOFFSET+1:M,1:N) and
390* B(IOFFSET+1:M,1:NRHS) as column blocks.
391*
392 minmnfact = min( m-ioffset, n )
393 minmnupdt = min( m-ioffset, n+nrhs )
394 kmax = min( kmax, minmnfact )
395 tol3z = sqrt( dlamch( 'Epsilon' ) )
396 hugeval = dlamch( 'Overflow' )
397*
398* Compute the factorization, KK is the lomn loop index.
399*
400 DO kk = 1, kmax
401*
402 i = ioffset + kk
403*
404 IF( i.EQ.1 ) THEN
405*
406* ============================================================
407*
408* We are at the first column of the original whole matrix A,
409* therefore we use the computed KP1 and MAXC2NRM from the
410* main routine.
411*
412 kp = kp1
413*
414* ============================================================
415*
416 ELSE
417*
418* ============================================================
419*
420* Determine the pivot column in KK-th step, i.e. the index
421* of the column with the maximum 2-norm in the
422* submatrix A(I:M,K:N).
423*
424 kp = ( kk-1 ) + idamax( n-kk+1, vn1( kk ), 1 )
425*
426* Determine the maximum column 2-norm and the relative maximum
427* column 2-norm of the submatrix A(I:M,KK:N) in step KK.
428* RELMAXC2NRMK will be computed later, after somecondition
429* checks on MAXC2NRMK.
430*
431 maxc2nrmk = vn1( kp )
432*
433* ============================================================
434*
435* Check if the submatrix A(I:M,KK:N) contains NaN, and set
436* INFO parameter to the column number, where the first NaN
437* is found and return from the routine.
438* We need to check the condition only if the
439* column index (same as row index) of the original whole
440* matrix is larger than 1, since the condition for whole
441* original matrix is checked in the main routine.
442*
443 IF( disnan( maxc2nrmk ) ) THEN
444*
445* Set K, the number of factorized columns.
446* that are not zero.
447*
448 k = kk - 1
449 info = k + kp
450*
451* Set RELMAXC2NRMK to NaN.
452*
453 relmaxc2nrmk = maxc2nrmk
454*
455* Array TAU(K+1:MINMNFACT) is not set and contains
456* undefined elements.
457*
458 RETURN
459 END IF
460*
461* ============================================================
462*
463* Quick return, if the submatrix A(I:M,KK:N) is
464* a zero matrix.
465* We need to check the condition only if the
466* column index (same as row index) of the original whole
467* matrix is larger than 1, since the condition for whole
468* original matrix is checked in the main routine.
469*
470 IF( maxc2nrmk.EQ.zero ) THEN
471*
472* Set K, the number of factorized columns.
473* that are not zero.
474*
475 k = kk - 1
476 relmaxc2nrmk = zero
477*
478* Set TAUs corresponding to the columns that were not
479* factorized to ZERO, i.e. set TAU(KK:MINMNFACT) to CZERO.
480*
481 DO j = kk, minmnfact
482 tau( j ) = czero
483 END DO
484*
485* Return from the routine.
486*
487 RETURN
488*
489 END IF
490*
491* ============================================================
492*
493* Check if the submatrix A(I:M,KK:N) contains Inf,
494* set INFO parameter to the column number, where
495* the first Inf is found plus N, and continue
496* the computation.
497* We need to check the condition only if the
498* column index (same as row index) of the original whole
499* matrix is larger than 1, since the condition for whole
500* original matrix is checked in the main routine.
501*
502 IF( info.EQ.0 .AND. maxc2nrmk.GT.hugeval ) THEN
503 info = n + kk - 1 + kp
504 END IF
505*
506* ============================================================
507*
508* Test for the second and third stopping criteria.
509* NOTE: There is no need to test for ABSTOL >= ZERO, since
510* MAXC2NRMK is non-negative. Similarly, there is no need
511* to test for RELTOL >= ZERO, since RELMAXC2NRMK is
512* non-negative.
513* We need to check the condition only if the
514* column index (same as row index) of the original whole
515* matrix is larger than 1, since the condition for whole
516* original matrix is checked in the main routine.
517
518 relmaxc2nrmk = maxc2nrmk / maxc2nrm
519*
520 IF( maxc2nrmk.LE.abstol .OR. relmaxc2nrmk.LE.reltol ) THEN
521*
522* Set K, the number of factorized columns.
523*
524 k = kk - 1
525*
526* Set TAUs corresponding to the columns that were not
527* factorized to ZERO, i.e. set TAU(KK:MINMNFACT) to CZERO.
528*
529 DO j = kk, minmnfact
530 tau( j ) = czero
531 END DO
532*
533* Return from the routine.
534*
535 RETURN
536*
537 END IF
538*
539* ============================================================
540*
541* End ELSE of IF(I.EQ.1)
542*
543 END IF
544*
545* ===============================================================
546*
547* If the pivot column is not the first column of the
548* subblock A(1:M,KK:N):
549* 1) swap the KK-th column and the KP-th pivot column
550* in A(1:M,1:N);
551* 2) copy the KK-th element into the KP-th element of the partial
552* and exact 2-norm vectors VN1 and VN2. ( Swap is not needed
553* for VN1 and VN2 since we use the element with the index
554* larger than KK in the next loop step.)
555* 3) Save the pivot interchange with the indices relative to the
556* the original matrix A, not the block A(1:M,1:N).
557*
558 IF( kp.NE.kk ) THEN
559 CALL zswap( m, a( 1, kp ), 1, a( 1, kk ), 1 )
560 vn1( kp ) = vn1( kk )
561 vn2( kp ) = vn2( kk )
562 itemp = jpiv( kp )
563 jpiv( kp ) = jpiv( kk )
564 jpiv( kk ) = itemp
565 END IF
566*
567* Generate elementary reflector H(KK) using the column A(I:M,KK),
568* if the column has more than one element, otherwise
569* the elementary reflector would be an identity matrix,
570* and TAU(KK) = CZERO.
571*
572 IF( i.LT.m ) THEN
573 CALL zlarfg( m-i+1, a( i, kk ), a( i+1, kk ), 1,
574 $ tau( kk ) )
575 ELSE
576 tau( kk ) = czero
577 END IF
578*
579* Check if TAU(KK) contains NaN, set INFO parameter
580* to the column number where NaN is found and return from
581* the routine.
582* NOTE: There is no need to check TAU(KK) for Inf,
583* since ZLARFG cannot produce TAU(KK) or Householder vector
584* below the diagonal containing Inf. Only BETA on the diagonal,
585* returned by ZLARFG can contain Inf, which requires
586* TAU(KK) to contain NaN. Therefore, this case of generating Inf
587* by ZLARFG is covered by checking TAU(KK) for NaN.
588*
589 IF( disnan( dble( tau(kk) ) ) ) THEN
590 taunan = dble( tau(kk) )
591 ELSE IF( disnan( dimag( tau(kk) ) ) ) THEN
592 taunan = dimag( tau(kk) )
593 ELSE
594 taunan = zero
595 END IF
596*
597 IF( disnan( taunan ) ) THEN
598 k = kk - 1
599 info = kk
600*
601* Set MAXC2NRMK and RELMAXC2NRMK to NaN.
602*
603 maxc2nrmk = taunan
604 relmaxc2nrmk = taunan
605*
606* Array TAU(KK:MINMNFACT) is not set and contains
607* undefined elements, except the first element TAU(KK) = NaN.
608*
609 RETURN
610 END IF
611*
612* Apply H(KK)**H to A(I:M,KK+1:N+NRHS) from the left.
613* ( If M >= N, then at KK = N there is no residual matrix,
614* i.e. no columns of A to update, only columns of B.
615* If M < N, then at KK = M-IOFFSET, I = M and we have a
616* one-row residual matrix in A and the elementary
617* reflector is a unit matrix, TAU(KK) = CZERO, i.e. no update
618* is needed for the residual matrix in A and the
619* right-hand-side-matrix in B.
620* Therefore, we update only if
621* KK < MINMNUPDT = min(M-IOFFSET, N+NRHS)
622* condition is satisfied, not only KK < N+NRHS )
623*
624 IF( kk.LT.minmnupdt ) THEN
625 CALL zlarf1f( 'Left', m-i+1, n+nrhs-kk, a( i, kk ), 1,
626 $ conjg( tau( kk ) ), a( i, kk+1 ), lda,
627 $ work( 1 ) )
628 END IF
629*
630 IF( kk.LT.minmnfact ) THEN
631*
632* Update the partial column 2-norms for the residual matrix,
633* only if the residual matrix A(I+1:M,KK+1:N) exists, i.e.
634* when KK < min(M-IOFFSET, N).
635*
636 DO j = kk + 1, n
637 IF( vn1( j ).NE.zero ) THEN
638*
639* NOTE: The following lines follow from the analysis in
640* Lapack Working Note 176.
641*
642 temp = one - ( abs( a( i, j ) ) / vn1( j ) )**2
643 temp = max( temp, zero )
644 temp2 = temp*( vn1( j ) / vn2( j ) )**2
645 IF( temp2 .LE. tol3z ) THEN
646*
647* Compute the column 2-norm for the partial
648* column A(I+1:M,J) by explicitly computing it,
649* and store it in both partial 2-norm vector VN1
650* and exact column 2-norm vector VN2.
651*
652 vn1( j ) = dznrm2( m-i, a( i+1, j ), 1 )
653 vn2( j ) = vn1( j )
654*
655 ELSE
656*
657* Update the column 2-norm for the partial
658* column A(I+1:M,J) by removing one
659* element A(I,J) and store it in partial
660* 2-norm vector VN1.
661*
662 vn1( j ) = vn1( j )*sqrt( temp )
663*
664 END IF
665 END IF
666 END DO
667*
668 END IF
669*
670* End factorization loop
671*
672 END DO
673*
674* If we reached this point, all colunms have been factorized,
675* i.e. no condition was triggered to exit the routine.
676* Set the number of factorized columns.
677*
678 k = kmax
679*
680* We reached the end of the loop, i.e. all KMAX columns were
681* factorized, we need to set MAXC2NRMK and RELMAXC2NRMK before
682* we return.
683*
684 IF( k.LT.minmnfact ) THEN
685*
686 jmaxc2nrm = k + idamax( n-k, vn1( k+1 ), 1 )
687 maxc2nrmk = vn1( jmaxc2nrm )
688*
689 IF( k.EQ.0 ) THEN
690 relmaxc2nrmk = one
691 ELSE
692 relmaxc2nrmk = maxc2nrmk / maxc2nrm
693 END IF
694*
695 ELSE
696 maxc2nrmk = zero
697 relmaxc2nrmk = zero
698 END IF
699*
700* We reached the end of the loop, i.e. all KMAX columns were
701* factorized, set TAUs corresponding to the columns that were
702* not factorized to ZERO, i.e. TAU(K+1:MINMNFACT) set to CZERO.
703*
704 DO j = k + 1, minmnfact
705 tau( j ) = czero
706 END DO
707*
708 RETURN
709*
710* End of ZLAQP2RK
711*
712 END
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
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
Definition zswap.f:81
subroutine zlaqp2rk(m, n, nrhs, ioffset, kmax, abstol, reltol, kp1, maxc2nrm, a, lda, k, maxc2nrmk, relmaxc2nrmk, jpiv, tau, vn1, vn2, work, info)
ZLAQP2RK computes truncated QR factorization with column pivoting of a complex matrix block using Lev...
Definition zlaqp2rk.f:335