LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ sgelqs()

subroutine sgelqs ( 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 
)

SGELQS

Purpose:
 Compute a minimum-norm solution
     min || A*X - B ||
 using the LQ factorization
     A = L*Q
 computed by SGELQF.
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.  N >= M >= 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 LQ factorization of the original matrix A as
          returned by SGELQF.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= M.
[in]TAU
          TAU is REAL array, dimension (M)
          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.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B. LDB >= N.
[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
December 2016

Definition at line 123 of file sgelqs.f.

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