LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine sgeqls ( integer  M,
integer  N,
integer  NRHS,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  TAU,
real, dimension( ldb, * )  B,
integer  LDB,
real, dimension( lwork )  WORK,
integer  LWORK,
integer  INFO 
)

SGEQLS

Purpose:
 Solve the least squares problem
     min || A*X - B ||
 using the QL factorization
     A = Q*L
 computed by SGEQLF.
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 REAL array, dimension (LDA,N)
          Details of the QL factorization of the original matrix A as
          returned by SGEQLF.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= M.
[in]TAU
          TAU is REAL array, dimension (N)
          Details of the orthogonal matrix Q.
[in,out]B
          B is REAL array, dimension (LDB,NRHS)
          On entry, the m-by-nrhs right hand side matrix B.
          On exit, the n-by-nrhs solution matrix X, stored in rows
          m-n+1:m.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B. LDB >= M.
[out]WORK
          WORK is REAL 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
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 124 of file sgeqls.f.

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

Here is the call graph for this function:

Here is the caller graph for this function: