 LAPACK  3.10.1 LAPACK: Linear Algebra PACKage

## ◆ dgeqrs()

 subroutine dgeqrs ( integer M, integer N, integer NRHS, double precision, dimension( lda, * ) A, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( ldb, * ) B, integer LDB, double precision, dimension( lwork ) WORK, integer LWORK, integer INFO )

DGEQRS

Purpose:
``` Solve the least squares problem
min || A*X - B ||
using the QR factorization
A = Q*R
computed by DGEQRF.```
Parameters
 [in] M ``` M is INTEGER The number of rows of the matrix A. M >= 0.``` [in] N ``` N is INTEGER The number of columns of the matrix A. M >= N >= 0.``` [in] NRHS ``` NRHS is INTEGER The number of columns of B. NRHS >= 0.``` [in] A ``` A is DOUBLE PRECISION array, dimension (LDA,N) Details of the QR factorization of the original matrix A as returned by DGEQRF.``` [in] LDA ``` LDA is INTEGER The leading dimension of the array A. LDA >= M.``` [in] TAU ``` TAU is DOUBLE PRECISION array, dimension (N) Details of the orthogonal matrix Q.``` [in,out] B ``` B is DOUBLE PRECISION array, dimension (LDB,NRHS) On entry, the m-by-nrhs right hand side matrix B. On exit, the n-by-nrhs solution matrix X.``` [in] LDB ``` LDB is INTEGER The leading dimension of the array B. LDB >= M.``` [out] WORK ` WORK is DOUBLE PRECISION array, dimension (LWORK)` [in] LWORK ``` LWORK is INTEGER The length of the array WORK. LWORK must be at least NRHS, and should be at least NRHS*NB, where NB is the block size for this environment.``` [out] INFO ``` INFO is INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value```

Definition at line 119 of file dgeqrs.f.

121 *
122 * -- LAPACK test routine --
123 * -- LAPACK is a software package provided by Univ. of Tennessee, --
124 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
125 *
126 * .. Scalar Arguments ..
127  INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS
128 * ..
129 * .. Array Arguments ..
130  DOUBLE PRECISION A( LDA, * ), B( LDB, * ), TAU( * ),
131  \$ WORK( LWORK )
132 * ..
133 *
134 * =====================================================================
135 *
136 * .. Parameters ..
137  DOUBLE PRECISION ONE
138  parameter( one = 1.0d+0 )
139 * ..
140 * .. External Subroutines ..
141  EXTERNAL dormqr, dtrsm, xerbla
142 * ..
143 * .. Intrinsic Functions ..
144  INTRINSIC max
145 * ..
146 * .. Executable Statements ..
147 *
148 * Test the input arguments.
149 *
150  info = 0
151  IF( m.LT.0 ) THEN
152  info = -1
153  ELSE IF( n.LT.0 .OR. n.GT.m ) THEN
154  info = -2
155  ELSE IF( nrhs.LT.0 ) THEN
156  info = -3
157  ELSE IF( lda.LT.max( 1, m ) ) THEN
158  info = -5
159  ELSE IF( ldb.LT.max( 1, m ) ) THEN
160  info = -8
161  ELSE IF( lwork.LT.1 .OR. lwork.LT.nrhs .AND. m.GT.0 .AND. n.GT.0 )
162  \$ THEN
163  info = -10
164  END IF
165  IF( info.NE.0 ) THEN
166  CALL xerbla( 'DGEQRS', -info )
167  RETURN
168  END IF
169 *
170 * Quick return if possible
171 *
172  IF( n.EQ.0 .OR. nrhs.EQ.0 .OR. m.EQ.0 )
173  \$ RETURN
174 *
175 * B := Q' * B
176 *
177  CALL dormqr( 'Left', 'Transpose', m, nrhs, n, a, lda, tau, b, ldb,
178  \$ work, lwork, info )
179 *
180 * Solve R*X = B(1:n,:)
181 *
182  CALL dtrsm( 'Left', 'Upper', 'No transpose', 'Non-unit', n, nrhs,
183  \$ one, a, lda, b, ldb )
184 *
185  RETURN
186 *
187 * End of DGEQRS
188 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
subroutine dtrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
DTRSM
Definition: dtrsm.f:181
subroutine dormqr(SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK, LWORK, INFO)
DORMQR
Definition: dormqr.f:167
Here is the call graph for this function:
Here is the caller graph for this function: