LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dorgtsqr_row.f
Go to the documentation of this file.
1*> \brief \b DORGTSQR_ROW
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DORGTSQR_ROW + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dorgtsqr_row.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dorgtsqr_row.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dorgtsqr_row.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DORGTSQR_ROW( M, N, MB, NB, A, LDA, T, LDT, WORK,
20* $ LWORK, INFO )
21* IMPLICIT NONE
22*
23* .. Scalar Arguments ..
24* INTEGER INFO, LDA, LDT, LWORK, M, N, MB, NB
25* ..
26* .. Array Arguments ..
27* DOUBLE PRECISION A( LDA, * ), T( LDT, * ), WORK( * )
28* ..
29*
30*> \par Purpose:
31* =============
32*>
33*> \verbatim
34*>
35*> DORGTSQR_ROW generates an M-by-N real matrix Q_out with
36*> orthonormal columns from the output of DLATSQR. These N orthonormal
37*> columns are the first N columns of a product of complex unitary
38*> matrices Q(k)_in of order M, which are returned by DLATSQR in
39*> a special format.
40*>
41*> Q_out = first_N_columns_of( Q(1)_in * Q(2)_in * ... * Q(k)_in ).
42*>
43*> The input matrices Q(k)_in are stored in row and column blocks in A.
44*> See the documentation of DLATSQR for more details on the format of
45*> Q(k)_in, where each Q(k)_in is represented by block Householder
46*> transformations. This routine calls an auxiliary routine DLARFB_GETT,
47*> where the computation is performed on each individual block. The
48*> algorithm first sweeps NB-sized column blocks from the right to left
49*> starting in the bottom row block and continues to the top row block
50*> (hence _ROW in the routine name). This sweep is in reverse order of
51*> the order in which DLATSQR generates the output blocks.
52*> \endverbatim
53*
54* Arguments:
55* ==========
56*
57*> \param[in] M
58*> \verbatim
59*> M is INTEGER
60*> The number of rows of the matrix A. M >= 0.
61*> \endverbatim
62*>
63*> \param[in] N
64*> \verbatim
65*> N is INTEGER
66*> The number of columns of the matrix A. M >= N >= 0.
67*> \endverbatim
68*>
69*> \param[in] MB
70*> \verbatim
71*> MB is INTEGER
72*> The row block size used by DLATSQR to return
73*> arrays A and T. MB > N.
74*> (Note that if MB > M, then M is used instead of MB
75*> as the row block size).
76*> \endverbatim
77*>
78*> \param[in] NB
79*> \verbatim
80*> NB is INTEGER
81*> The column block size used by DLATSQR to return
82*> arrays A and T. NB >= 1.
83*> (Note that if NB > N, then N is used instead of NB
84*> as the column block size).
85*> \endverbatim
86*>
87*> \param[in,out] A
88*> \verbatim
89*> A is DOUBLE PRECISION array, dimension (LDA,N)
90*>
91*> On entry:
92*>
93*> The elements on and above the diagonal are not used as
94*> input. The elements below the diagonal represent the unit
95*> lower-trapezoidal blocked matrix V computed by DLATSQR
96*> that defines the input matrices Q_in(k) (ones on the
97*> diagonal are not stored). See DLATSQR for more details.
98*>
99*> On exit:
100*>
101*> The array A contains an M-by-N orthonormal matrix Q_out,
102*> i.e the columns of A are orthogonal unit vectors.
103*> \endverbatim
104*>
105*> \param[in] LDA
106*> \verbatim
107*> LDA is INTEGER
108*> The leading dimension of the array A. LDA >= max(1,M).
109*> \endverbatim
110*>
111*> \param[in] T
112*> \verbatim
113*> T is DOUBLE PRECISION array,
114*> dimension (LDT, N * NIRB)
115*> where NIRB = Number_of_input_row_blocks
116*> = MAX( 1, CEIL((M-N)/(MB-N)) )
117*> Let NICB = Number_of_input_col_blocks
118*> = CEIL(N/NB)
119*>
120*> The upper-triangular block reflectors used to define the
121*> input matrices Q_in(k), k=(1:NIRB*NICB). The block
122*> reflectors are stored in compact form in NIRB block
123*> reflector sequences. Each of the NIRB block reflector
124*> sequences is stored in a larger NB-by-N column block of T
125*> and consists of NICB smaller NB-by-NB upper-triangular
126*> column blocks. See DLATSQR for more details on the format
127*> of T.
128*> \endverbatim
129*>
130*> \param[in] LDT
131*> \verbatim
132*> LDT is INTEGER
133*> The leading dimension of the array T.
134*> LDT >= max(1,min(NB,N)).
135*> \endverbatim
136*>
137*> \param[out] WORK
138*> \verbatim
139*> (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
140*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
141*> \endverbatim
142*>
143*> \param[in] LWORK
144*> \verbatim
145*> LWORK is INTEGER
146*> The dimension of the array WORK.
147*> LWORK >= NBLOCAL * MAX(NBLOCAL,(N-NBLOCAL)),
148*> where NBLOCAL=MIN(NB,N).
149*> If LWORK = -1, then a workspace query is assumed.
150*> The routine only calculates the optimal size of the WORK
151*> array, returns this value as the first entry of the WORK
152*> array, and no error message related to LWORK is issued
153*> by XERBLA.
154*> \endverbatim
155*>
156*> \param[out] INFO
157*> \verbatim
158*> INFO is INTEGER
159*> = 0: successful exit
160*> < 0: if INFO = -i, the i-th argument had an illegal value
161*> \endverbatim
162*>
163* Authors:
164* ========
165*
166*> \author Univ. of Tennessee
167*> \author Univ. of California Berkeley
168*> \author Univ. of Colorado Denver
169*> \author NAG Ltd.
170*
171*> \ingroup ungtsqr_row
172*
173*> \par Contributors:
174* ==================
175*>
176*> \verbatim
177*>
178*> November 2020, Igor Kozachenko,
179*> Computer Science Division,
180*> University of California, Berkeley
181*>
182*> \endverbatim
183*>
184* =====================================================================
185 SUBROUTINE dorgtsqr_row( M, N, MB, NB, A, LDA, T, LDT, WORK,
186 $ LWORK, INFO )
187 IMPLICIT NONE
188*
189* -- LAPACK computational routine --
190* -- LAPACK is a software package provided by Univ. of Tennessee, --
191* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
192*
193* .. Scalar Arguments ..
194 INTEGER INFO, LDA, LDT, LWORK, M, N, MB, NB
195* ..
196* .. Array Arguments ..
197 DOUBLE PRECISION A( LDA, * ), T( LDT, * ), WORK( * )
198* ..
199*
200* =====================================================================
201*
202* .. Parameters ..
203 DOUBLE PRECISION ONE, ZERO
204 parameter( one = 1.0d+0, zero = 0.0d+0 )
205* ..
206* .. Local Scalars ..
207 LOGICAL LQUERY
208 INTEGER NBLOCAL, MB2, M_PLUS_ONE, ITMP, IB_BOTTOM,
209 $ lworkopt, num_all_row_blocks, jb_t, ib, imb,
210 $ kb, kb_last, knb, mb1
211* ..
212* .. Local Arrays ..
213 DOUBLE PRECISION DUMMY( 1, 1 )
214* ..
215* .. External Subroutines ..
216 EXTERNAL dlarfb_gett, dlaset, xerbla
217* ..
218* .. Intrinsic Functions ..
219 INTRINSIC dble, max, min
220* ..
221* .. Executable Statements ..
222*
223* Test the input parameters
224*
225 info = 0
226 lquery = lwork.EQ.-1
227 IF( m.LT.0 ) THEN
228 info = -1
229 ELSE IF( n.LT.0 .OR. m.LT.n ) THEN
230 info = -2
231 ELSE IF( mb.LE.n ) THEN
232 info = -3
233 ELSE IF( nb.LT.1 ) THEN
234 info = -4
235 ELSE IF( lda.LT.max( 1, m ) ) THEN
236 info = -6
237 ELSE IF( ldt.LT.max( 1, min( nb, n ) ) ) THEN
238 info = -8
239 ELSE IF( lwork.LT.1 .AND. .NOT.lquery ) THEN
240 info = -10
241 END IF
242*
243 nblocal = min( nb, n )
244*
245* Determine the workspace size.
246*
247 IF( info.EQ.0 ) THEN
248 lworkopt = nblocal * max( nblocal, ( n - nblocal ) )
249 END IF
250*
251* Handle error in the input parameters and handle the workspace query.
252*
253 IF( info.NE.0 ) THEN
254 CALL xerbla( 'DORGTSQR_ROW', -info )
255 RETURN
256 ELSE IF ( lquery ) THEN
257 work( 1 ) = dble( lworkopt )
258 RETURN
259 END IF
260*
261* Quick return if possible
262*
263 IF( min( m, n ).EQ.0 ) THEN
264 work( 1 ) = dble( lworkopt )
265 RETURN
266 END IF
267*
268* (0) Set the upper-triangular part of the matrix A to zero and
269* its diagonal elements to one.
270*
271 CALL dlaset('U', m, n, zero, one, a, lda )
272*
273* KB_LAST is the column index of the last column block reflector
274* in the matrices T and V.
275*
276 kb_last = ( ( n-1 ) / nblocal ) * nblocal + 1
277*
278*
279* (1) Bottom-up loop over row blocks of A, except the top row block.
280* NOTE: If MB>=M, then the loop is never executed.
281*
282 IF ( mb.LT.m ) THEN
283*
284* MB2 is the row blocking size for the row blocks before the
285* first top row block in the matrix A. IB is the row index for
286* the row blocks in the matrix A before the first top row block.
287* IB_BOTTOM is the row index for the last bottom row block
288* in the matrix A. JB_T is the column index of the corresponding
289* column block in the matrix T.
290*
291* Initialize variables.
292*
293* NUM_ALL_ROW_BLOCKS is the number of row blocks in the matrix A
294* including the first row block.
295*
296 mb2 = mb - n
297 m_plus_one = m + 1
298 itmp = ( m - mb - 1 ) / mb2
299 ib_bottom = itmp * mb2 + mb + 1
300 num_all_row_blocks = itmp + 2
301 jb_t = num_all_row_blocks * n + 1
302*
303 DO ib = ib_bottom, mb+1, -mb2
304*
305* Determine the block size IMB for the current row block
306* in the matrix A.
307*
308 imb = min( m_plus_one - ib, mb2 )
309*
310* Determine the column index JB_T for the current column block
311* in the matrix T.
312*
313 jb_t = jb_t - n
314*
315* Apply column blocks of H in the row block from right to left.
316*
317* KB is the column index of the current column block reflector
318* in the matrices T and V.
319*
320 DO kb = kb_last, 1, -nblocal
321*
322* Determine the size of the current column block KNB in
323* the matrices T and V.
324*
325 knb = min( nblocal, n - kb + 1 )
326*
327 CALL dlarfb_gett( 'I', imb, n-kb+1, knb,
328 $ t( 1, jb_t+kb-1 ), ldt, a( kb, kb ), lda,
329 $ a( ib, kb ), lda, work, knb )
330*
331 END DO
332*
333 END DO
334*
335 END IF
336*
337* (2) Top row block of A.
338* NOTE: If MB>=M, then we have only one row block of A of size M
339* and we work on the entire matrix A.
340*
341 mb1 = min( mb, m )
342*
343* Apply column blocks of H in the top row block from right to left.
344*
345* KB is the column index of the current block reflector in
346* the matrices T and V.
347*
348 DO kb = kb_last, 1, -nblocal
349*
350* Determine the size of the current column block KNB in
351* the matrices T and V.
352*
353 knb = min( nblocal, n - kb + 1 )
354*
355 IF( mb1-kb-knb+1.EQ.0 ) THEN
356*
357* In SLARFB_GETT parameters, when M=0, then the matrix B
358* does not exist, hence we need to pass a dummy array
359* reference DUMMY(1,1) to B with LDDUMMY=1.
360*
361 CALL dlarfb_gett( 'N', 0, n-kb+1, knb,
362 $ t( 1, kb ), ldt, a( kb, kb ), lda,
363 $ dummy( 1, 1 ), 1, work, knb )
364 ELSE
365 CALL dlarfb_gett( 'N', mb1-kb-knb+1, n-kb+1, knb,
366 $ t( 1, kb ), ldt, a( kb, kb ), lda,
367 $ a( kb+knb, kb), lda, work, knb )
368
369 END IF
370*
371 END DO
372*
373 work( 1 ) = dble( lworkopt )
374 RETURN
375*
376* End of DORGTSQR_ROW
377*
378 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dlarfb_gett(ident, m, n, k, t, ldt, a, lda, b, ldb, work, ldwork)
DLARFB_GETT
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition dlaset.f:108
subroutine dorgtsqr_row(m, n, mb, nb, a, lda, t, ldt, work, lwork, info)
DORGTSQR_ROW