LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ 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.

Definition at line 119 of file sgelqs.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 REAL A( LDA, * ), B( LDB, * ), TAU( * ),
131 $ WORK( LWORK )
132* ..
133*
134* =====================================================================
135*
136* .. Parameters ..
137 REAL ZERO, ONE
138 parameter( zero = 0.0e+0, one = 1.0e+0 )
139* ..
140* .. External Subroutines ..
141 EXTERNAL slaset, sormlq, strsm, xerbla
142* ..
143* .. Intrinsic Functions ..
144 INTRINSIC max
145* ..
146* .. Executable Statements ..
147*
148* Test the input parameters.
149*
150 info = 0
151 IF( m.LT.0 ) THEN
152 info = -1
153 ELSE IF( n.LT.0 .OR. m.GT.n ) 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, n ) ) 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( 'SGELQS', -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* Solve L*X = B(1:m,:)
176*
177 CALL strsm( 'Left', 'Lower', 'No transpose', 'Non-unit', m,
178 $ nrhs, one, a, lda, b, ldb )
179*
180* Set B(m+1:n,:) to zero
181*
182 IF( m.LT.n )
183 $ CALL slaset( 'Full', n-m, nrhs, zero, zero, b( m+1, 1 ),
184 $ ldb )
185*
186* B := Q' * B
187*
188 CALL sormlq( 'Left', 'Transpose', n, nrhs, m, a, lda, tau, b,
189 $ ldb, work, lwork, info )
190*
191 RETURN
192*
193* End of SGELQS
194*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
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:108
subroutine strsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
STRSM
Definition strsm.f:181
subroutine sormlq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
SORMLQ
Definition sormlq.f:166
Here is the call graph for this function: