1 /* dorm2l.f -- translated by f2c (version 20061008).
2 You must link the resulting object file with libf2c:
3 on Microsoft Windows system, link with libf2c.lib;
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm
5 or, if you install libf2c.a in a standard place, with -lf2c -lm
6 -- in that order, at the end of the command line, as in
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
10 http://www.netlib.org/f2c/libf2c.zip
16 /* Table of constant values */
18 static integer c__1 = 1;
20 /* Subroutine */ int dorm2l_(char *side, char *trans, integer *m, integer *n,
21 integer *k, doublereal *a, integer *lda, doublereal *tau, doublereal *
22 c__, integer *ldc, doublereal *work, integer *info)
24 /* System generated locals */
25 integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2;
28 integer i__, i1, i2, i3, mi, ni, nq;
31 extern /* Subroutine */ int dlarf_(char *, integer *, integer *,
32 doublereal *, integer *, doublereal *, doublereal *, integer *,
34 extern logical lsame_(char *, char *);
35 extern /* Subroutine */ int xerbla_(char *, integer *);
39 /* -- LAPACK routine (version 3.2) -- */
40 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
43 /* .. Scalar Arguments .. */
45 /* .. Array Arguments .. */
51 /* DORM2L overwrites the general real m by n matrix C with */
53 /* Q * C if SIDE = 'L' and TRANS = 'N', or */
55 /* Q'* C if SIDE = 'L' and TRANS = 'T', or */
57 /* C * Q if SIDE = 'R' and TRANS = 'N', or */
59 /* C * Q' if SIDE = 'R' and TRANS = 'T', */
61 /* where Q is a real orthogonal matrix defined as the product of k */
62 /* elementary reflectors */
64 /* Q = H(k) . . . H(2) H(1) */
66 /* as returned by DGEQLF. Q is of order m if SIDE = 'L' and of order n */
72 /* SIDE (input) CHARACTER*1 */
73 /* = 'L': apply Q or Q' from the Left */
74 /* = 'R': apply Q or Q' from the Right */
76 /* TRANS (input) CHARACTER*1 */
77 /* = 'N': apply Q (No transpose) */
78 /* = 'T': apply Q' (Transpose) */
80 /* M (input) INTEGER */
81 /* The number of rows of the matrix C. M >= 0. */
83 /* N (input) INTEGER */
84 /* The number of columns of the matrix C. N >= 0. */
86 /* K (input) INTEGER */
87 /* The number of elementary reflectors whose product defines */
89 /* If SIDE = 'L', M >= K >= 0; */
90 /* if SIDE = 'R', N >= K >= 0. */
92 /* A (input) DOUBLE PRECISION array, dimension (LDA,K) */
93 /* The i-th column must contain the vector which defines the */
94 /* elementary reflector H(i), for i = 1,2,...,k, as returned by */
95 /* DGEQLF in the last k columns of its array argument A. */
96 /* A is modified by the routine but restored on exit. */
98 /* LDA (input) INTEGER */
99 /* The leading dimension of the array A. */
100 /* If SIDE = 'L', LDA >= max(1,M); */
101 /* if SIDE = 'R', LDA >= max(1,N). */
103 /* TAU (input) DOUBLE PRECISION array, dimension (K) */
104 /* TAU(i) must contain the scalar factor of the elementary */
105 /* reflector H(i), as returned by DGEQLF. */
107 /* C (input/output) DOUBLE PRECISION array, dimension (LDC,N) */
108 /* On entry, the m by n matrix C. */
109 /* On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q. */
111 /* LDC (input) INTEGER */
112 /* The leading dimension of the array C. LDC >= max(1,M). */
114 /* WORK (workspace) DOUBLE PRECISION array, dimension */
115 /* (N) if SIDE = 'L', */
116 /* (M) if SIDE = 'R' */
118 /* INFO (output) INTEGER */
119 /* = 0: successful exit */
120 /* < 0: if INFO = -i, the i-th argument had an illegal value */
122 /* ===================================================================== */
124 /* .. Parameters .. */
126 /* .. Local Scalars .. */
128 /* .. External Functions .. */
130 /* .. External Subroutines .. */
132 /* .. Intrinsic Functions .. */
134 /* .. Executable Statements .. */
136 /* Test the input arguments */
138 /* Parameter adjustments */
140 a_offset = 1 + a_dim1;
144 c_offset = 1 + c_dim1;
150 left = lsame_(side, "L");
151 notran = lsame_(trans, "N");
153 /* NQ is the order of Q */
160 if (! left && ! lsame_(side, "R")) {
162 } else if (! notran && ! lsame_(trans, "T")) {
168 } else if (*k < 0 || *k > nq) {
170 } else if (*lda < max(1,nq)) {
172 } else if (*ldc < max(1,*m)) {
177 xerbla_("DORM2L", &i__1);
181 /* Quick return if possible */
183 if (*m == 0 || *n == 0 || *k == 0) {
187 if (left && notran || ! left && ! notran) {
205 for (i__ = i1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
208 /* H(i) is applied to C(1:m-k+i,1:n) */
213 /* H(i) is applied to C(1:m,1:n-k+i) */
220 aii = a[nq - *k + i__ + i__ * a_dim1];
221 a[nq - *k + i__ + i__ * a_dim1] = 1.;
222 dlarf_(side, &mi, &ni, &a[i__ * a_dim1 + 1], &c__1, &tau[i__], &c__[
223 c_offset], ldc, &work[1]);
224 a[nq - *k + i__ + i__ * a_dim1] = aii;