1 /* ../netlib/ztpmqrt.f -- translated by f2c (version 20100827). You must link the resulting object file with libf2c: on Microsoft Windows system, link with libf2c.lib;
2  on Linux or Unix systems, link with .../path/to/libf2c.a -lm or, if you install libf2c.a in a standard place, with -lf2c -lm -- in that order, at the end of the command line, as in cc *.o -lf2c -lm Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., http://www.netlib.org/f2c/libf2c.zip */
3 #include "FLA_f2c.h" /* > \brief \b ZTPMQRT */
4 /* =========== DOCUMENTATION =========== */
5 /* Online html documentation available at */
6 /* http://www.netlib.org/lapack/explore-html/ */
7 /* > \htmlonly */
8 /* > Download ZTPMQRT + dependencies */
9 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztpmqrt .f"> */
10 /* > [TGZ]</a> */
11 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztpmqrt .f"> */
12 /* > [ZIP]</a> */
13 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztpmqrt .f"> */
14 /* > [TXT]</a> */
15 /* > \endhtmlonly */
16 /* Definition: */
17 /* =========== */
18 /* SUBROUTINE ZTPMQRT( SIDE, TRANS, M, N, K, L, NB, V, LDV, T, LDT, */
19 /* A, LDA, B, LDB, WORK, INFO ) */
20 /* .. Scalar Arguments .. */
21 /* CHARACTER SIDE, TRANS */
22 /* INTEGER INFO, K, LDV, LDA, LDB, M, N, L, NB, LDT */
23 /* .. */
24 /* .. Array Arguments .. */
25 /* COMPLEX*16 V( LDV, * ), A( LDA, * ), B( LDB, * ), T( LDT, * ), */
26 /* $ WORK( * ) */
27 /* .. */
28 /* > \par Purpose: */
29 /* ============= */
30 /* > */
31 /* > \verbatim */
32 /* > */
33 /* > ZTPMQRT applies a complex orthogonal matrix Q obtained from a */
34 /* > "triangular-pentagonal" complex block reflector H to a general */
35 /* > complex matrix C, which consists of two blocks A and B. */
36 /* > \endverbatim */
37 /* Arguments: */
38 /* ========== */
39 /* > \param[in] SIDE */
40 /* > \verbatim */
41 /* > SIDE is CHARACTER*1 */
42 /* > = 'L': apply Q or Q**H from the Left;
43 */
44 /* > = 'R': apply Q or Q**H from the Right. */
45 /* > \endverbatim */
46 /* > */
47 /* > \param[in] TRANS */
48 /* > \verbatim */
49 /* > TRANS is CHARACTER*1 */
50 /* > = 'N': No transpose, apply Q;
51 */
52 /* > = 'C': Transpose, apply Q**H. */
53 /* > \endverbatim */
54 /* > */
55 /* > \param[in] M */
56 /* > \verbatim */
57 /* > M is INTEGER */
58 /* > The number of rows of the matrix B. M >= 0. */
59 /* > \endverbatim */
60 /* > */
61 /* > \param[in] N */
62 /* > \verbatim */
63 /* > N is INTEGER */
64 /* > The number of columns of the matrix B. N >= 0. */
65 /* > \endverbatim */
66 /* > */
67 /* > \param[in] K */
68 /* > \verbatim */
69 /* > K is INTEGER */
70 /* > The number of elementary reflectors whose product defines */
71 /* > the matrix Q. */
72 /* > \endverbatim */
73 /* > */
74 /* > \param[in] L */
75 /* > \verbatim */
76 /* > L is INTEGER */
77 /* > The order of the trapezoidal part of V. */
78 /* > K >= L >= 0. See Further Details. */
79 /* > \endverbatim */
80 /* > */
81 /* > \param[in] NB */
82 /* > \verbatim */
83 /* > NB is INTEGER */
84 /* > The block size used for the storage of T. K >= NB >= 1. */
85 /* > This must be the same value of NB used to generate T */
86 /* > in CTPQRT. */
87 /* > \endverbatim */
88 /* > */
89 /* > \param[in] V */
90 /* > \verbatim */
91 /* > V is COMPLEX*16 array, dimension (LDA,K) */
92 /* > The i-th column must contain the vector which defines the */
93 /* > elementary reflector H(i), for i = 1,2,...,k, as returned by */
94 /* > CTPQRT in B. See Further Details. */
95 /* > \endverbatim */
96 /* > */
97 /* > \param[in] LDV */
98 /* > \verbatim */
99 /* > LDV is INTEGER */
100 /* > The leading dimension of the array V. */
101 /* > If SIDE = 'L', LDV >= max(1,M);
102 */
103 /* > if SIDE = 'R', LDV >= max(1,N). */
104 /* > \endverbatim */
105 /* > */
106 /* > \param[in] T */
107 /* > \verbatim */
108 /* > T is COMPLEX*16 array, dimension (LDT,K) */
109 /* > The upper triangular factors of the block reflectors */
110 /* > as returned by CTPQRT, stored as a NB-by-K matrix. */
111 /* > \endverbatim */
112 /* > */
113 /* > \param[in] LDT */
114 /* > \verbatim */
115 /* > LDT is INTEGER */
116 /* > The leading dimension of the array T. LDT >= NB. */
117 /* > \endverbatim */
118 /* > */
119 /* > \param[in,out] A */
120 /* > \verbatim */
121 /* > A is COMPLEX*16 array, dimension */
122 /* > (LDA,N) if SIDE = 'L' or */
123 /* > (LDA,K) if SIDE = 'R' */
124 /* > On entry, the K-by-N or M-by-K matrix A. */
125 /* > On exit, A is overwritten by the corresponding block of */
126 /* > Q*C or Q**H*C or C*Q or C*Q**H. See Further Details. */
127 /* > \endverbatim */
128 /* > */
129 /* > \param[in] LDA */
130 /* > \verbatim */
131 /* > LDA is INTEGER */
132 /* > The leading dimension of the array A. */
133 /* > If SIDE = 'L', LDC >= max(1,K);
134 */
135 /* > If SIDE = 'R', LDC >= max(1,M). */
136 /* > \endverbatim */
137 /* > */
138 /* > \param[in,out] B */
139 /* > \verbatim */
140 /* > B is COMPLEX*16 array, dimension (LDB,N) */
141 /* > On entry, the M-by-N matrix B. */
142 /* > On exit, B is overwritten by the corresponding block of */
143 /* > Q*C or Q**H*C or C*Q or C*Q**H. See Further Details. */
144 /* > \endverbatim */
145 /* > */
146 /* > \param[in] LDB */
147 /* > \verbatim */
148 /* > LDB is INTEGER */
149 /* > The leading dimension of the array B. */
150 /* > LDB >= max(1,M). */
151 /* > \endverbatim */
152 /* > */
153 /* > \param[out] WORK */
154 /* > \verbatim */
155 /* > WORK is COMPLEX*16 array. The dimension of WORK is */
156 /* > N*NB if SIDE = 'L', or M*NB if SIDE = 'R'. */
157 /* > \endverbatim */
158 /* > */
159 /* > \param[out] INFO */
160 /* > \verbatim */
161 /* > INFO is INTEGER */
162 /* > = 0: successful exit */
163 /* > < 0: if INFO = -i, the i-th argument had an illegal value */
164 /* > \endverbatim */
165 /* Authors: */
166 /* ======== */
167 /* > \author Univ. of Tennessee */
168 /* > \author Univ. of California Berkeley */
169 /* > \author Univ. of Colorado Denver */
170 /* > \author NAG Ltd. */
171 /* > \date November 2013 */
172 /* > \ingroup complex16OTHERcomputational */
173 /* > \par Further Details: */
174 /* ===================== */
175 /* > */
176 /* > \verbatim */
177 /* > */
178 /* > The columns of the pentagonal matrix V contain the elementary reflectors */
179 /* > H(1), H(2), ..., H(K);
180 V is composed of a rectangular block V1 and a */
181 /* > trapezoidal block V2: */
182 /* > */
183 /* > V = [V1] */
184 /* > [V2]. */
185 /* > */
186 /* > The size of the trapezoidal block V2 is determined by the parameter L, */
187 /* > where 0 <= L <= K;
188 V2 is upper trapezoidal, consisting of the first L */
189 /* > rows of a K-by-K upper triangular matrix. If L=K, V2 is upper triangular;
190 */
191 /* > if L=0, there is no trapezoidal block, hence V = V1 is rectangular. */
192 /* > */
193 /* > If SIDE = 'L': C = [A] where A is K-by-N, B is M-by-N and V is M-by-K. */
194 /* > [B] */
195 /* > */
196 /* > If SIDE = 'R': C = [A B] where A is M-by-K, B is M-by-N and V is N-by-K. */
197 /* > */
198 /* > The complex orthogonal matrix Q is formed from V and T. */
199 /* > */
200 /* > If TRANS='N' and SIDE='L', C is on exit replaced with Q * C. */
201 /* > */
202 /* > If TRANS='C' and SIDE='L', C is on exit replaced with Q**H * C. */
203 /* > */
204 /* > If TRANS='N' and SIDE='R', C is on exit replaced with C * Q. */
205 /* > */
206 /* > If TRANS='C' and SIDE='R', C is on exit replaced with C * Q**H. */
207 /* > \endverbatim */
208 /* > */
209 /* ===================================================================== */
210 /* Subroutine */
ztpmqrt_(char * side,char * trans,integer * m,integer * n,integer * k,integer * l,integer * nb,doublecomplex * v,integer * ldv,doublecomplex * t,integer * ldt,doublecomplex * a,integer * lda,doublecomplex * b,integer * ldb,doublecomplex * work,integer * info)211 int ztpmqrt_(char *side, char *trans, integer *m, integer *n, integer *k, integer *l, integer *nb, doublecomplex *v, integer *ldv, doublecomplex *t, integer *ldt, doublecomplex *a, integer *lda, doublecomplex *b, integer *ldb, doublecomplex *work, integer *info)
212 {
213     /* System generated locals */
214     integer v_dim1, v_offset, a_dim1, a_offset, b_dim1, b_offset, t_dim1, t_offset, i__1, i__2, i__3, i__4;
215     /* Local variables */
216     integer i__, ib, lb, mb, kf, ldaq;
217     logical left, tran;
218     integer ldvq;
219     extern logical lsame_(char *, char *);
220     logical right;
221     extern /* Subroutine */
222     int xerbla_(char *, integer *);
223     logical notran;
224     extern /* Subroutine */
225     int ztprfb_(char *, char *, char *, char *, integer *, integer *, integer *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *, doublecomplex *, integer *);
226     /* -- LAPACK computational routine (version 3.5.0) -- */
227     /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
228     /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
229     /* November 2013 */
230     /* .. Scalar Arguments .. */
231     /* .. */
232     /* .. Array Arguments .. */
233     /* .. */
234     /* ===================================================================== */
235     /* .. */
236     /* .. Local Scalars .. */
237     /* .. */
238     /* .. External Functions .. */
239     /* .. */
240     /* .. External Subroutines .. */
241     /* .. */
242     /* .. Intrinsic Functions .. */
243     /* .. */
244     /* .. Executable Statements .. */
245     /* .. Test the input arguments .. */
246     /* Parameter adjustments */
247     v_dim1 = *ldv;
248     v_offset = 1 + v_dim1;
249     v -= v_offset;
250     t_dim1 = *ldt;
251     t_offset = 1 + t_dim1;
252     t -= t_offset;
253     a_dim1 = *lda;
254     a_offset = 1 + a_dim1;
255     a -= a_offset;
256     b_dim1 = *ldb;
257     b_offset = 1 + b_dim1;
258     b -= b_offset;
259     --work;
260     /* Function Body */
261     *info = 0;
262     left = lsame_(side, "L");
263     right = lsame_(side, "R");
264     tran = lsame_(trans, "C");
265     notran = lsame_(trans, "N");
266     if (left)
267     {
268         ldvq = max(1,*m);
269         ldaq = max(1,*k);
270     }
271     else if (right)
272     {
273         ldvq = max(1,*n);
274         ldaq = max(1,*m);
275     }
276     if (! left && ! right)
277     {
278         *info = -1;
279     }
280     else if (! tran && ! notran)
281     {
282         *info = -2;
283     }
284     else if (*m < 0)
285     {
286         *info = -3;
287     }
288     else if (*n < 0)
289     {
290         *info = -4;
291     }
292     else if (*k < 0)
293     {
294         *info = -5;
295     }
296     else if (*l < 0 || *l > *k)
297     {
298         *info = -6;
299     }
300     else if (*nb < 1 || *nb > *k && *k > 0)
301     {
302         *info = -7;
303     }
304     else if (*ldv < ldvq)
305     {
306         *info = -9;
307     }
308     else if (*ldt < *nb)
309     {
310         *info = -11;
311     }
312     else if (*lda < ldaq)
313     {
314         *info = -13;
315     }
316     else if (*ldb < max(1,*m))
317     {
318         *info = -15;
319     }
320     if (*info != 0)
321     {
322         i__1 = -(*info);
323         xerbla_("ZTPMQRT", &i__1);
324         return 0;
325     }
326     /* .. Quick return if possible .. */
327     if (*m == 0 || *n == 0 || *k == 0)
328     {
329         return 0;
330     }
331     if (left && tran)
332     {
333         i__1 = *k;
334         i__2 = *nb;
335         for (i__ = 1;
336                 i__2 < 0 ? i__ >= i__1 : i__ <= i__1;
337                 i__ += i__2)
338         {
339             /* Computing MIN */
340             i__3 = *nb;
341             i__4 = *k - i__ + 1; // , expr subst
342             ib = min(i__3,i__4);
343             /* Computing MIN */
344             i__3 = *m - *l + i__ + ib - 1;
345             mb = min(i__3,*m);
346             if (i__ >= *l)
347             {
348                 lb = 0;
349             }
350             else
351             {
352                 lb = mb - *m + *l - i__ + 1;
353             }
354             ztprfb_("L", "C", "F", "C", &mb, n, &ib, &lb, &v[i__ * v_dim1 + 1] , ldv, &t[i__ * t_dim1 + 1], ldt, &a[i__ + a_dim1], lda, & b[b_offset], ldb, &work[1], &ib);
355         }
356     }
357     else if (right && notran)
358     {
359         i__2 = *k;
360         i__1 = *nb;
361         for (i__ = 1;
362                 i__1 < 0 ? i__ >= i__2 : i__ <= i__2;
363                 i__ += i__1)
364         {
365             /* Computing MIN */
366             i__3 = *nb;
367             i__4 = *k - i__ + 1; // , expr subst
368             ib = min(i__3,i__4);
369             /* Computing MIN */
370             i__3 = *n - *l + i__ + ib - 1;
371             mb = min(i__3,*n);
372             if (i__ >= *l)
373             {
374                 lb = 0;
375             }
376             else
377             {
378                 lb = mb - *n + *l - i__ + 1;
379             }
380             ztprfb_("R", "N", "F", "C", m, &mb, &ib, &lb, &v[i__ * v_dim1 + 1] , ldv, &t[i__ * t_dim1 + 1], ldt, &a[i__ * a_dim1 + 1], lda, &b[b_offset], ldb, &work[1], m);
381         }
382     }
383     else if (left && notran)
384     {
385         kf = (*k - 1) / *nb * *nb + 1;
386         i__1 = -(*nb);
387         for (i__ = kf;
388                 i__1 < 0 ? i__ >= 1 : i__ <= 1;
389                 i__ += i__1)
390         {
391             /* Computing MIN */
392             i__2 = *nb;
393             i__3 = *k - i__ + 1; // , expr subst
394             ib = min(i__2,i__3);
395             /* Computing MIN */
396             i__2 = *m - *l + i__ + ib - 1;
397             mb = min(i__2,*m);
398             if (i__ >= *l)
399             {
400                 lb = 0;
401             }
402             else
403             {
404                 lb = mb - *m + *l - i__ + 1;
405             }
406             ztprfb_("L", "N", "F", "C", &mb, n, &ib, &lb, &v[i__ * v_dim1 + 1] , ldv, &t[i__ * t_dim1 + 1], ldt, &a[i__ + a_dim1], lda, & b[b_offset], ldb, &work[1], &ib);
407         }
408     }
409     else if (right && tran)
410     {
411         kf = (*k - 1) / *nb * *nb + 1;
412         i__1 = -(*nb);
413         for (i__ = kf;
414                 i__1 < 0 ? i__ >= 1 : i__ <= 1;
415                 i__ += i__1)
416         {
417             /* Computing MIN */
418             i__2 = *nb;
419             i__3 = *k - i__ + 1; // , expr subst
420             ib = min(i__2,i__3);
421             /* Computing MIN */
422             i__2 = *n - *l + i__ + ib - 1;
423             mb = min(i__2,*n);
424             if (i__ >= *l)
425             {
426                 lb = 0;
427             }
428             else
429             {
430                 lb = mb - *n + *l - i__ + 1;
431             }
432             ztprfb_("R", "C", "F", "C", m, &mb, &ib, &lb, &v[i__ * v_dim1 + 1] , ldv, &t[i__ * t_dim1 + 1], ldt, &a[i__ * a_dim1 + 1], lda, &b[b_offset], ldb, &work[1], m);
433         }
434     }
435     return 0;
436     /* End of ZTPMQRT */
437 }
438 /* ztpmqrt_ */
439