LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dtzrzf.f
Go to the documentation of this file.
1*> \brief \b DTZRZF
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DTZRZF + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dtzrzf.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dtzrzf.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dtzrzf.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DTZRZF( M, N, A, LDA, TAU, WORK, LWORK, INFO )
20*
21* .. Scalar Arguments ..
22* INTEGER INFO, LDA, LWORK, M, N
23* ..
24* .. Array Arguments ..
25* DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * )
26* ..
27*
28*
29*> \par Purpose:
30* =============
31*>
32*> \verbatim
33*>
34*> DTZRZF reduces the M-by-N ( M<=N ) real upper trapezoidal matrix A
35*> to upper triangular form by means of orthogonal transformations.
36*>
37*> The upper trapezoidal matrix A is factored as
38*>
39*> A = ( R 0 ) * Z,
40*>
41*> where Z is an N-by-N orthogonal matrix and R is an M-by-M upper
42*> triangular matrix.
43*> \endverbatim
44*
45* Arguments:
46* ==========
47*
48*> \param[in] M
49*> \verbatim
50*> M is INTEGER
51*> The number of rows of the matrix A. M >= 0.
52*> \endverbatim
53*>
54*> \param[in] N
55*> \verbatim
56*> N is INTEGER
57*> The number of columns of the matrix A. N >= M.
58*> \endverbatim
59*>
60*> \param[in,out] A
61*> \verbatim
62*> A is DOUBLE PRECISION array, dimension (LDA,N)
63*> On entry, the leading M-by-N upper trapezoidal part of the
64*> array A must contain the matrix to be factorized.
65*> On exit, the leading M-by-M upper triangular part of A
66*> contains the upper triangular matrix R, and elements M+1 to
67*> N of the first M rows of A, with the array TAU, represent the
68*> orthogonal matrix Z as a product of M elementary reflectors.
69*> \endverbatim
70*>
71*> \param[in] LDA
72*> \verbatim
73*> LDA is INTEGER
74*> The leading dimension of the array A. LDA >= max(1,M).
75*> \endverbatim
76*>
77*> \param[out] TAU
78*> \verbatim
79*> TAU is DOUBLE PRECISION array, dimension (M)
80*> The scalar factors of the elementary reflectors.
81*> \endverbatim
82*>
83*> \param[out] WORK
84*> \verbatim
85*> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK))
86*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
87*> \endverbatim
88*>
89*> \param[in] LWORK
90*> \verbatim
91*> LWORK is INTEGER
92*> The dimension of the array WORK. LWORK >= max(1,M).
93*> For optimum performance LWORK >= M*NB, where NB is
94*> the optimal blocksize.
95*>
96*> If LWORK = -1, then a workspace query is assumed; the routine
97*> only calculates the optimal size of the WORK array, returns
98*> this value as the first entry of the WORK array, and no error
99*> message related to LWORK is issued by XERBLA.
100*> \endverbatim
101*>
102*> \param[out] INFO
103*> \verbatim
104*> INFO is INTEGER
105*> = 0: successful exit
106*> < 0: if INFO = -i, the i-th argument had an illegal value
107*> \endverbatim
108*
109* Authors:
110* ========
111*
112*> \author Univ. of Tennessee
113*> \author Univ. of California Berkeley
114*> \author Univ. of Colorado Denver
115*> \author NAG Ltd.
116*
117*> \ingroup tzrzf
118*
119*> \par Contributors:
120* ==================
121*>
122*> A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
123*
124*> \par Further Details:
125* =====================
126*>
127*> \verbatim
128*>
129*> The N-by-N matrix Z can be computed by
130*>
131*> Z = Z(1)*Z(2)* ... *Z(M)
132*>
133*> where each N-by-N Z(k) is given by
134*>
135*> Z(k) = I - tau(k)*v(k)*v(k)**T
136*>
137*> with v(k) is the kth row vector of the M-by-N matrix
138*>
139*> V = ( I A(:,M+1:N) )
140*>
141*> I is the M-by-M identity matrix, A(:,M+1:N)
142*> is the output stored in A on exit from DTZRZF,
143*> and tau(k) is the kth element of the array TAU.
144*>
145*> \endverbatim
146*>
147* =====================================================================
148 SUBROUTINE dtzrzf( M, N, A, LDA, TAU, WORK, LWORK, INFO )
149*
150* -- LAPACK computational routine --
151* -- LAPACK is a software package provided by Univ. of Tennessee, --
152* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
153*
154* .. Scalar Arguments ..
155 INTEGER INFO, LDA, LWORK, M, N
156* ..
157* .. Array Arguments ..
158 DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * )
159* ..
160*
161* =====================================================================
162*
163* .. Parameters ..
164 DOUBLE PRECISION ZERO
165 parameter( zero = 0.0d+0 )
166* ..
167* .. Local Scalars ..
168 LOGICAL LQUERY
169 INTEGER I, IB, IWS, KI, KK, LDWORK, LWKMIN, LWKOPT,
170 $ M1, MU, NB, NBMIN, NX
171* ..
172* .. External Subroutines ..
173 EXTERNAL xerbla, dlarzb, dlarzt, dlatrz
174* ..
175* .. Intrinsic Functions ..
176 INTRINSIC max, min
177* ..
178* .. External Functions ..
179 INTEGER ILAENV
180 EXTERNAL ilaenv
181* ..
182* .. Executable Statements ..
183*
184* Test the input arguments
185*
186 info = 0
187 lquery = ( lwork.EQ.-1 )
188 IF( m.LT.0 ) THEN
189 info = -1
190 ELSE IF( n.LT.m ) THEN
191 info = -2
192 ELSE IF( lda.LT.max( 1, m ) ) THEN
193 info = -4
194 END IF
195*
196 IF( info.EQ.0 ) THEN
197 IF( m.EQ.0 .OR. m.EQ.n ) THEN
198 lwkopt = 1
199 lwkmin = 1
200 ELSE
201*
202* Determine the block size.
203*
204 nb = ilaenv( 1, 'DGERQF', ' ', m, n, -1, -1 )
205 lwkopt = m*nb
206 lwkmin = max( 1, m )
207 END IF
208 work( 1 ) = lwkopt
209*
210 IF( lwork.LT.lwkmin .AND. .NOT.lquery ) THEN
211 info = -7
212 END IF
213 END IF
214*
215 IF( info.NE.0 ) THEN
216 CALL xerbla( 'DTZRZF', -info )
217 RETURN
218 ELSE IF( lquery ) THEN
219 RETURN
220 END IF
221*
222* Quick return if possible
223*
224 IF( m.EQ.0 ) THEN
225 RETURN
226 ELSE IF( m.EQ.n ) THEN
227 DO 10 i = 1, n
228 tau( i ) = zero
229 10 CONTINUE
230 RETURN
231 END IF
232*
233 nbmin = 2
234 nx = 1
235 iws = m
236 IF( nb.GT.1 .AND. nb.LT.m ) THEN
237*
238* Determine when to cross over from blocked to unblocked code.
239*
240 nx = max( 0, ilaenv( 3, 'DGERQF', ' ', m, n, -1, -1 ) )
241 IF( nx.LT.m ) THEN
242*
243* Determine if workspace is large enough for blocked code.
244*
245 ldwork = m
246 iws = ldwork*nb
247 IF( lwork.LT.iws ) THEN
248*
249* Not enough workspace to use optimal NB: reduce NB and
250* determine the minimum value of NB.
251*
252 nb = lwork / ldwork
253 nbmin = max( 2, ilaenv( 2, 'DGERQF', ' ', m, n, -1,
254 $ -1 ) )
255 END IF
256 END IF
257 END IF
258*
259 IF( nb.GE.nbmin .AND. nb.LT.m .AND. nx.LT.m ) THEN
260*
261* Use blocked code initially.
262* The last kk rows are handled by the block method.
263*
264 m1 = min( m+1, n )
265 ki = ( ( m-nx-1 ) / nb )*nb
266 kk = min( m, ki+nb )
267*
268 DO 20 i = m - kk + ki + 1, m - kk + 1, -nb
269 ib = min( m-i+1, nb )
270*
271* Compute the TZ factorization of the current block
272* A(i:i+ib-1,i:n)
273*
274 CALL dlatrz( ib, n-i+1, n-m, a( i, i ), lda, tau( i ),
275 $ work )
276 IF( i.GT.1 ) THEN
277*
278* Form the triangular factor of the block reflector
279* H = H(i+ib-1) . . . H(i+1) H(i)
280*
281 CALL dlarzt( 'Backward', 'Rowwise', n-m, ib, a( i,
282 $ m1 ),
283 $ lda, tau( i ), work, ldwork )
284*
285* Apply H to A(1:i-1,i:n) from the right
286*
287 CALL dlarzb( 'Right', 'No transpose', 'Backward',
288 $ 'Rowwise', i-1, n-i+1, ib, n-m, a( i, m1 ),
289 $ lda, work, ldwork, a( 1, i ), lda,
290 $ work( ib+1 ), ldwork )
291 END IF
292 20 CONTINUE
293 mu = i + nb - 1
294 ELSE
295 mu = m
296 END IF
297*
298* Use unblocked code to factor the last or only block
299*
300 IF( mu.GT.0 )
301 $ CALL dlatrz( mu, n, n-m, a, lda, tau, work )
302*
303 work( 1 ) = lwkopt
304*
305 RETURN
306*
307* End of DTZRZF
308*
309 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dlarzb(side, trans, direct, storev, m, n, k, l, v, ldv, t, ldt, c, ldc, work, ldwork)
DLARZB applies a block reflector or its transpose to a general matrix.
Definition dlarzb.f:181
subroutine dlarzt(direct, storev, n, k, v, ldv, tau, t, ldt)
DLARZT forms the triangular factor T of a block reflector H = I - vtvH.
Definition dlarzt.f:183
subroutine dlatrz(m, n, l, a, lda, tau, work)
DLATRZ factors an upper trapezoidal matrix by means of orthogonal transformations.
Definition dlatrz.f:138
subroutine dtzrzf(m, n, a, lda, tau, work, lwork, info)
DTZRZF
Definition dtzrzf.f:149