3 /* Table of constant values */
5 static integer c__1 = 1;
7 /* Subroutine */ int dgeqr2_(integer *m, integer *n, doublereal *a, integer *
8 lda, doublereal *tau, doublereal *work, integer *info)
10 /* System generated locals */
11 integer a_dim1, a_offset, i__1, i__2, i__3;
16 extern /* Subroutine */ int dlarf_(char *, integer *, integer *,
17 doublereal *, integer *, doublereal *, doublereal *, integer *,
18 doublereal *), dlarfg_(integer *, doublereal *,
19 doublereal *, integer *, doublereal *), xerbla_(char *, integer *);
22 /* -- LAPACK routine (version 3.1) -- */
23 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
26 /* .. Scalar Arguments .. */
28 /* .. Array Arguments .. */
34 /* DGEQR2 computes a QR factorization of a real m by n matrix A: */
40 /* M (input) INTEGER */
41 /* The number of rows of the matrix A. M >= 0. */
43 /* N (input) INTEGER */
44 /* The number of columns of the matrix A. N >= 0. */
46 /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
47 /* On entry, the m by n matrix A. */
48 /* On exit, the elements on and above the diagonal of the array */
49 /* contain the min(m,n) by n upper trapezoidal matrix R (R is */
50 /* upper triangular if m >= n); the elements below the diagonal, */
51 /* with the array TAU, represent the orthogonal matrix Q as a */
52 /* product of elementary reflectors (see Further Details). */
54 /* LDA (input) INTEGER */
55 /* The leading dimension of the array A. LDA >= max(1,M). */
57 /* TAU (output) DOUBLE PRECISION array, dimension (min(M,N)) */
58 /* The scalar factors of the elementary reflectors (see Further */
61 /* WORK (workspace) DOUBLE PRECISION array, dimension (N) */
63 /* INFO (output) INTEGER */
64 /* = 0: successful exit */
65 /* < 0: if INFO = -i, the i-th argument had an illegal value */
70 /* The matrix Q is represented as a product of elementary reflectors */
72 /* Q = H(1) H(2) . . . H(k), where k = min(m,n). */
74 /* Each H(i) has the form */
76 /* H(i) = I - tau * v * v' */
78 /* where tau is a real scalar, and v is a real vector with */
79 /* v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), */
80 /* and tau in TAU(i). */
82 /* ===================================================================== */
84 /* .. Parameters .. */
86 /* .. Local Scalars .. */
88 /* .. External Subroutines .. */
90 /* .. Intrinsic Functions .. */
92 /* .. Executable Statements .. */
94 /* Test the input arguments */
96 /* Parameter adjustments */
98 a_offset = 1 + a_dim1;
109 } else if (*lda < max(1,*m)) {
114 xerbla_("DGEQR2", &i__1);
121 for (i__ = 1; i__ <= i__1; ++i__) {
123 /* Generate elementary reflector H(i) to annihilate A(i+1:m,i) */
128 dlarfg_(&i__2, &a[i__ + i__ * a_dim1], &a[min(i__3, *m)+ i__ * a_dim1]
132 /* Apply H(i) to A(i:m,i+1:n) from the left */
134 aii = a[i__ + i__ * a_dim1];
135 a[i__ + i__ * a_dim1] = 1.;
138 dlarf_("Left", &i__2, &i__3, &a[i__ + i__ * a_dim1], &c__1, &tau[
139 i__], &a[i__ + (i__ + 1) * a_dim1], lda, &work[1]);
140 a[i__ + i__ * a_dim1] = aii;