LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
sgelsd.f
Go to the documentation of this file.
1*> \brief <b> SGELSD computes the minimum-norm solution to a linear least squares problem for GE matrices</b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> \htmlonly
9*> Download SGELSD + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sgelsd.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sgelsd.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgelsd.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* SUBROUTINE SGELSD( M, N, NRHS, A, LDA, B, LDB, S, RCOND,
22* RANK, WORK, LWORK, IWORK, INFO )
23*
24* .. Scalar Arguments ..
25* INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
26* REAL RCOND
27* ..
28* .. Array Arguments ..
29* INTEGER IWORK( * )
30* REAL A( LDA, * ), B( LDB, * ), S( * ), WORK( * )
31* ..
32*
33*
34*> \par Purpose:
35* =============
36*>
37*> \verbatim
38*>
39*> SGELSD computes the minimum-norm solution to a real linear least
40*> squares problem:
41*> minimize 2-norm(| b - A*x |)
42*> using the singular value decomposition (SVD) of A. A is an M-by-N
43*> matrix which may be rank-deficient.
44*>
45*> Several right hand side vectors b and solution vectors x can be
46*> handled in a single call; they are stored as the columns of the
47*> M-by-NRHS right hand side matrix B and the N-by-NRHS solution
48*> matrix X.
49*>
50*> The problem is solved in three steps:
51*> (1) Reduce the coefficient matrix A to bidiagonal form with
52*> Householder transformations, reducing the original problem
53*> into a "bidiagonal least squares problem" (BLS)
54*> (2) Solve the BLS using a divide and conquer approach.
55*> (3) Apply back all the Householder transformations to solve
56*> the original least squares problem.
57*>
58*> The effective rank of A is determined by treating as zero those
59*> singular values which are less than RCOND times the largest singular
60*> value.
61*>
62*> \endverbatim
63*
64* Arguments:
65* ==========
66*
67*> \param[in] M
68*> \verbatim
69*> M is INTEGER
70*> The number of rows of A. M >= 0.
71*> \endverbatim
72*>
73*> \param[in] N
74*> \verbatim
75*> N is INTEGER
76*> The number of columns of A. N >= 0.
77*> \endverbatim
78*>
79*> \param[in] NRHS
80*> \verbatim
81*> NRHS is INTEGER
82*> The number of right hand sides, i.e., the number of columns
83*> of the matrices B and X. NRHS >= 0.
84*> \endverbatim
85*>
86*> \param[in,out] A
87*> \verbatim
88*> A is REAL array, dimension (LDA,N)
89*> On entry, the M-by-N matrix A.
90*> On exit, A has been destroyed.
91*> \endverbatim
92*>
93*> \param[in] LDA
94*> \verbatim
95*> LDA is INTEGER
96*> The leading dimension of the array A. LDA >= max(1,M).
97*> \endverbatim
98*>
99*> \param[in,out] B
100*> \verbatim
101*> B is REAL array, dimension (LDB,NRHS)
102*> On entry, the M-by-NRHS right hand side matrix B.
103*> On exit, B is overwritten by the N-by-NRHS solution
104*> matrix X. If m >= n and RANK = n, the residual
105*> sum-of-squares for the solution in the i-th column is given
106*> by the sum of squares of elements n+1:m in that column.
107*> \endverbatim
108*>
109*> \param[in] LDB
110*> \verbatim
111*> LDB is INTEGER
112*> The leading dimension of the array B. LDB >= max(1,max(M,N)).
113*> \endverbatim
114*>
115*> \param[out] S
116*> \verbatim
117*> S is REAL array, dimension (min(M,N))
118*> The singular values of A in decreasing order.
119*> The condition number of A in the 2-norm = S(1)/S(min(m,n)).
120*> \endverbatim
121*>
122*> \param[in] RCOND
123*> \verbatim
124*> RCOND is REAL
125*> RCOND is used to determine the effective rank of A.
126*> Singular values S(i) <= RCOND*S(1) are treated as zero.
127*> If RCOND < 0, machine precision is used instead.
128*> \endverbatim
129*>
130*> \param[out] RANK
131*> \verbatim
132*> RANK is INTEGER
133*> The effective rank of A, i.e., the number of singular values
134*> which are greater than RCOND*S(1).
135*> \endverbatim
136*>
137*> \param[out] WORK
138*> \verbatim
139*> WORK is REAL array, dimension (MAX(1,LWORK))
140*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
141*> \endverbatim
142*>
143*> \param[in] LWORK
144*> \verbatim
145*> LWORK is INTEGER
146*> The dimension of the array WORK. LWORK must be at least 1.
147*> The exact minimum amount of workspace needed depends on M,
148*> N and NRHS. As long as LWORK is at least
149*> 12*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS + (SMLSIZ+1)**2,
150*> if M is greater than or equal to N or
151*> 12*M + 2*M*SMLSIZ + 8*M*NLVL + M*NRHS + (SMLSIZ+1)**2,
152*> if M is less than N, the code will execute correctly.
153*> SMLSIZ is returned by ILAENV and is equal to the maximum
154*> size of the subproblems at the bottom of the computation
155*> tree (usually about 25), and
156*> NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1 )
157*> For good performance, LWORK should generally be larger.
158*>
159*> If LWORK = -1, then a workspace query is assumed; the routine
160*> only calculates the optimal size of the array WORK and the
161*> minimum size of the array IWORK, and returns these values as
162*> the first entries of the WORK and IWORK arrays, and no error
163*> message related to LWORK is issued by XERBLA.
164*> \endverbatim
165*>
166*> \param[out] IWORK
167*> \verbatim
168*> IWORK is INTEGER array, dimension (MAX(1,LIWORK))
169*> LIWORK >= max(1, 3*MINMN*NLVL + 11*MINMN),
170*> where MINMN = MIN( M,N ).
171*> On exit, if INFO = 0, IWORK(1) returns the minimum LIWORK.
172*> \endverbatim
173*>
174*> \param[out] INFO
175*> \verbatim
176*> INFO is INTEGER
177*> = 0: successful exit
178*> < 0: if INFO = -i, the i-th argument had an illegal value.
179*> > 0: the algorithm for computing the SVD failed to converge;
180*> if INFO = i, i off-diagonal elements of an intermediate
181*> bidiagonal form did not converge to zero.
182*> \endverbatim
183*
184* Authors:
185* ========
186*
187*> \author Univ. of Tennessee
188*> \author Univ. of California Berkeley
189*> \author Univ. of Colorado Denver
190*> \author NAG Ltd.
191*
192*> \ingroup gelsd
193*
194*> \par Contributors:
195* ==================
196*>
197*> Ming Gu and Ren-Cang Li, Computer Science Division, University of
198*> California at Berkeley, USA \n
199*> Osni Marques, LBNL/NERSC, USA \n
200*
201* =====================================================================
202 SUBROUTINE sgelsd( M, N, NRHS, A, LDA, B, LDB, S, RCOND,
203 $ RANK, WORK, LWORK, IWORK, INFO )
204*
205* -- LAPACK driver routine --
206* -- LAPACK is a software package provided by Univ. of Tennessee, --
207* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
208*
209* .. Scalar Arguments ..
210 INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
211 REAL RCOND
212* ..
213* .. Array Arguments ..
214 INTEGER IWORK( * )
215 REAL A( LDA, * ), B( LDB, * ), S( * ), WORK( * )
216* ..
217*
218* =====================================================================
219*
220* .. Parameters ..
221 REAL ZERO, ONE, TWO
222 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0 )
223* ..
224* .. Local Scalars ..
225 LOGICAL LQUERY
226 INTEGER IASCL, IBSCL, IE, IL, ITAU, ITAUP, ITAUQ,
227 $ ldwork, liwork, maxmn, maxwrk, minmn, minwrk,
228 $ mm, mnthr, nlvl, nwork, smlsiz, wlalsd
229 REAL ANRM, BIGNUM, BNRM, EPS, SFMIN, SMLNUM
230* ..
231* .. External Subroutines ..
232 EXTERNAL sgebrd, sgelqf, sgeqrf, slacpy, slalsd, slascl,
234* ..
235* .. External Functions ..
236 INTEGER ILAENV
237 REAL SLAMCH, SLANGE, SROUNDUP_LWORK
238 EXTERNAL slamch, slange, ilaenv, sroundup_lwork
239* ..
240* .. Intrinsic Functions ..
241 INTRINSIC int, log, max, min, real
242* ..
243* .. Executable Statements ..
244*
245* Test the input arguments.
246*
247 info = 0
248 minmn = min( m, n )
249 maxmn = max( m, n )
250 lquery = ( lwork.EQ.-1 )
251 IF( m.LT.0 ) THEN
252 info = -1
253 ELSE IF( n.LT.0 ) THEN
254 info = -2
255 ELSE IF( nrhs.LT.0 ) THEN
256 info = -3
257 ELSE IF( lda.LT.max( 1, m ) ) THEN
258 info = -5
259 ELSE IF( ldb.LT.max( 1, maxmn ) ) THEN
260 info = -7
261 END IF
262*
263* Compute workspace.
264* (Note: Comments in the code beginning "Workspace:" describe the
265* minimal amount of workspace needed at that point in the code,
266* as well as the preferred amount for good performance.
267* NB refers to the optimal block size for the immediately
268* following subroutine, as returned by ILAENV.)
269*
270 IF( info.EQ.0 ) THEN
271 minwrk = 1
272 maxwrk = 1
273 liwork = 1
274 IF( minmn.GT.0 ) THEN
275 smlsiz = ilaenv( 9, 'SGELSD', ' ', 0, 0, 0, 0 )
276 mnthr = ilaenv( 6, 'SGELSD', ' ', m, n, nrhs, -1 )
277 nlvl = max( int( log( real( minmn ) / real( smlsiz + 1 ) ) /
278 $ log( two ) ) + 1, 0 )
279 liwork = 3*minmn*nlvl + 11*minmn
280 mm = m
281 IF( m.GE.n .AND. m.GE.mnthr ) THEN
282*
283* Path 1a - overdetermined, with many more rows than
284* columns.
285*
286 mm = n
287 maxwrk = max( maxwrk, n + n*ilaenv( 1, 'SGEQRF', ' ', m,
288 $ n, -1, -1 ) )
289 maxwrk = max( maxwrk, n + nrhs*ilaenv( 1, 'SORMQR', 'LT',
290 $ m, nrhs, n, -1 ) )
291 END IF
292 IF( m.GE.n ) THEN
293*
294* Path 1 - overdetermined or exactly determined.
295*
296 maxwrk = max( maxwrk, 3*n + ( mm + n )*ilaenv( 1,
297 $ 'SGEBRD', ' ', mm, n, -1, -1 ) )
298 maxwrk = max( maxwrk, 3*n + nrhs*ilaenv( 1, 'SORMBR',
299 $ 'QLT', mm, nrhs, n, -1 ) )
300 maxwrk = max( maxwrk, 3*n + ( n - 1 )*ilaenv( 1,
301 $ 'SORMBR', 'PLN', n, nrhs, n, -1 ) )
302 wlalsd = 9*n + 2*n*smlsiz + 8*n*nlvl + n*nrhs +
303 $ ( smlsiz + 1 )**2
304 maxwrk = max( maxwrk, 3*n + wlalsd )
305 minwrk = max( 3*n + mm, 3*n + nrhs, 3*n + wlalsd )
306 END IF
307 IF( n.GT.m ) THEN
308 wlalsd = 9*m + 2*m*smlsiz + 8*m*nlvl + m*nrhs +
309 $ ( smlsiz + 1 )**2
310 IF( n.GE.mnthr ) THEN
311*
312* Path 2a - underdetermined, with many more columns
313* than rows.
314*
315 maxwrk = m + m*ilaenv( 1, 'SGELQF', ' ', m, n, -1,
316 $ -1 )
317 maxwrk = max( maxwrk, m*m + 4*m + 2*m*ilaenv( 1,
318 $ 'SGEBRD', ' ', m, m, -1, -1 ) )
319 maxwrk = max( maxwrk, m*m + 4*m + nrhs*ilaenv( 1,
320 $ 'SORMBR', 'QLT', m, nrhs, m, -1 ) )
321 maxwrk = max( maxwrk, m*m + 4*m + ( m - 1 )*ilaenv( 1,
322 $ 'SORMBR', 'PLN', m, nrhs, m, -1 ) )
323 IF( nrhs.GT.1 ) THEN
324 maxwrk = max( maxwrk, m*m + m + m*nrhs )
325 ELSE
326 maxwrk = max( maxwrk, m*m + 2*m )
327 END IF
328 maxwrk = max( maxwrk, m + nrhs*ilaenv( 1, 'SORMLQ',
329 $ 'LT', n, nrhs, m, -1 ) )
330 maxwrk = max( maxwrk, m*m + 4*m + wlalsd )
331! XXX: Ensure the Path 2a case below is triggered. The workspace
332! calculation should use queries for all routines eventually.
333 maxwrk = max( maxwrk,
334 $ 4*m+m*m+max( m, 2*m-4, nrhs, n-3*m ) )
335 ELSE
336*
337* Path 2 - remaining underdetermined cases.
338*
339 maxwrk = 3*m + ( n + m )*ilaenv( 1, 'SGEBRD', ' ', m,
340 $ n, -1, -1 )
341 maxwrk = max( maxwrk, 3*m + nrhs*ilaenv( 1, 'SORMBR',
342 $ 'QLT', m, nrhs, n, -1 ) )
343 maxwrk = max( maxwrk, 3*m + m*ilaenv( 1, 'SORMBR',
344 $ 'PLN', n, nrhs, m, -1 ) )
345 maxwrk = max( maxwrk, 3*m + wlalsd )
346 END IF
347 minwrk = max( 3*m + nrhs, 3*m + m, 3*m + wlalsd )
348 END IF
349 END IF
350 minwrk = min( minwrk, maxwrk )
351 work( 1 ) = sroundup_lwork(maxwrk)
352 iwork( 1 ) = liwork
353*
354 IF( lwork.LT.minwrk .AND. .NOT.lquery ) THEN
355 info = -12
356 END IF
357 END IF
358*
359 IF( info.NE.0 ) THEN
360 CALL xerbla( 'SGELSD', -info )
361 RETURN
362 ELSE IF( lquery ) THEN
363 RETURN
364 END IF
365*
366* Quick return if possible.
367*
368 IF( m.EQ.0 .OR. n.EQ.0 ) THEN
369 rank = 0
370 RETURN
371 END IF
372*
373* Get machine parameters.
374*
375 eps = slamch( 'P' )
376 sfmin = slamch( 'S' )
377 smlnum = sfmin / eps
378 bignum = one / smlnum
379*
380* Scale A if max entry outside range [SMLNUM,BIGNUM].
381*
382 anrm = slange( 'M', m, n, a, lda, work )
383 iascl = 0
384 IF( anrm.GT.zero .AND. anrm.LT.smlnum ) THEN
385*
386* Scale matrix norm up to SMLNUM.
387*
388 CALL slascl( 'G', 0, 0, anrm, smlnum, m, n, a, lda, info )
389 iascl = 1
390 ELSE IF( anrm.GT.bignum ) THEN
391*
392* Scale matrix norm down to BIGNUM.
393*
394 CALL slascl( 'G', 0, 0, anrm, bignum, m, n, a, lda, info )
395 iascl = 2
396 ELSE IF( anrm.EQ.zero ) THEN
397*
398* Matrix all zero. Return zero solution.
399*
400 CALL slaset( 'F', max( m, n ), nrhs, zero, zero, b, ldb )
401 CALL slaset( 'F', minmn, 1, zero, zero, s, 1 )
402 rank = 0
403 GO TO 10
404 END IF
405*
406* Scale B if max entry outside range [SMLNUM,BIGNUM].
407*
408 bnrm = slange( 'M', m, nrhs, b, ldb, work )
409 ibscl = 0
410 IF( bnrm.GT.zero .AND. bnrm.LT.smlnum ) THEN
411*
412* Scale matrix norm up to SMLNUM.
413*
414 CALL slascl( 'G', 0, 0, bnrm, smlnum, m, nrhs, b, ldb, info )
415 ibscl = 1
416 ELSE IF( bnrm.GT.bignum ) THEN
417*
418* Scale matrix norm down to BIGNUM.
419*
420 CALL slascl( 'G', 0, 0, bnrm, bignum, m, nrhs, b, ldb, info )
421 ibscl = 2
422 END IF
423*
424* If M < N make sure certain entries of B are zero.
425*
426 IF( m.LT.n )
427 $ CALL slaset( 'F', n-m, nrhs, zero, zero, b( m+1, 1 ), ldb )
428*
429* Overdetermined case.
430*
431 IF( m.GE.n ) THEN
432*
433* Path 1 - overdetermined or exactly determined.
434*
435 mm = m
436 IF( m.GE.mnthr ) THEN
437*
438* Path 1a - overdetermined, with many more rows than columns.
439*
440 mm = n
441 itau = 1
442 nwork = itau + n
443*
444* Compute A=Q*R.
445* (Workspace: need 2*N, prefer N+N*NB)
446*
447 CALL sgeqrf( m, n, a, lda, work( itau ), work( nwork ),
448 $ lwork-nwork+1, info )
449*
450* Multiply B by transpose(Q).
451* (Workspace: need N+NRHS, prefer N+NRHS*NB)
452*
453 CALL sormqr( 'L', 'T', m, nrhs, n, a, lda, work( itau ), b,
454 $ ldb, work( nwork ), lwork-nwork+1, info )
455*
456* Zero out below R.
457*
458 IF( n.GT.1 ) THEN
459 CALL slaset( 'L', n-1, n-1, zero, zero, a( 2, 1 ), lda )
460 END IF
461 END IF
462*
463 ie = 1
464 itauq = ie + n
465 itaup = itauq + n
466 nwork = itaup + n
467*
468* Bidiagonalize R in A.
469* (Workspace: need 3*N+MM, prefer 3*N+(MM+N)*NB)
470*
471 CALL sgebrd( mm, n, a, lda, s, work( ie ), work( itauq ),
472 $ work( itaup ), work( nwork ), lwork-nwork+1,
473 $ info )
474*
475* Multiply B by transpose of left bidiagonalizing vectors of R.
476* (Workspace: need 3*N+NRHS, prefer 3*N+NRHS*NB)
477*
478 CALL sormbr( 'Q', 'L', 'T', mm, nrhs, n, a, lda, work( itauq ),
479 $ b, ldb, work( nwork ), lwork-nwork+1, info )
480*
481* Solve the bidiagonal least squares problem.
482*
483 CALL slalsd( 'U', smlsiz, n, nrhs, s, work( ie ), b, ldb,
484 $ rcond, rank, work( nwork ), iwork, info )
485 IF( info.NE.0 ) THEN
486 GO TO 10
487 END IF
488*
489* Multiply B by right bidiagonalizing vectors of R.
490*
491 CALL sormbr( 'P', 'L', 'N', n, nrhs, n, a, lda, work( itaup ),
492 $ b, ldb, work( nwork ), lwork-nwork+1, info )
493*
494 ELSE IF( n.GE.mnthr .AND. lwork.GE.4*m+m*m+
495 $ max( m, 2*m-4, nrhs, n-3*m, wlalsd ) ) THEN
496*
497* Path 2a - underdetermined, with many more columns than rows
498* and sufficient workspace for an efficient algorithm.
499*
500 ldwork = m
501 IF( lwork.GE.max( 4*m+m*lda+max( m, 2*m-4, nrhs, n-3*m ),
502 $ m*lda+m+m*nrhs, 4*m+m*lda+wlalsd ) )ldwork = lda
503 itau = 1
504 nwork = m + 1
505*
506* Compute A=L*Q.
507* (Workspace: need 2*M, prefer M+M*NB)
508*
509 CALL sgelqf( m, n, a, lda, work( itau ), work( nwork ),
510 $ lwork-nwork+1, info )
511 il = nwork
512*
513* Copy L to WORK(IL), zeroing out above its diagonal.
514*
515 CALL slacpy( 'L', m, m, a, lda, work( il ), ldwork )
516 CALL slaset( 'U', m-1, m-1, zero, zero, work( il+ldwork ),
517 $ ldwork )
518 ie = il + ldwork*m
519 itauq = ie + m
520 itaup = itauq + m
521 nwork = itaup + m
522*
523* Bidiagonalize L in WORK(IL).
524* (Workspace: need M*M+5*M, prefer M*M+4*M+2*M*NB)
525*
526 CALL sgebrd( m, m, work( il ), ldwork, s, work( ie ),
527 $ work( itauq ), work( itaup ), work( nwork ),
528 $ lwork-nwork+1, info )
529*
530* Multiply B by transpose of left bidiagonalizing vectors of L.
531* (Workspace: need M*M+4*M+NRHS, prefer M*M+4*M+NRHS*NB)
532*
533 CALL sormbr( 'Q', 'L', 'T', m, nrhs, m, work( il ), ldwork,
534 $ work( itauq ), b, ldb, work( nwork ),
535 $ lwork-nwork+1, info )
536*
537* Solve the bidiagonal least squares problem.
538*
539 CALL slalsd( 'U', smlsiz, m, nrhs, s, work( ie ), b, ldb,
540 $ rcond, rank, work( nwork ), iwork, info )
541 IF( info.NE.0 ) THEN
542 GO TO 10
543 END IF
544*
545* Multiply B by right bidiagonalizing vectors of L.
546*
547 CALL sormbr( 'P', 'L', 'N', m, nrhs, m, work( il ), ldwork,
548 $ work( itaup ), b, ldb, work( nwork ),
549 $ lwork-nwork+1, info )
550*
551* Zero out below first M rows of B.
552*
553 CALL slaset( 'F', n-m, nrhs, zero, zero, b( m+1, 1 ), ldb )
554 nwork = itau + m
555*
556* Multiply transpose(Q) by B.
557* (Workspace: need M+NRHS, prefer M+NRHS*NB)
558*
559 CALL sormlq( 'L', 'T', n, nrhs, m, a, lda, work( itau ), b,
560 $ ldb, work( nwork ), lwork-nwork+1, info )
561*
562 ELSE
563*
564* Path 2 - remaining underdetermined cases.
565*
566 ie = 1
567 itauq = ie + m
568 itaup = itauq + m
569 nwork = itaup + m
570*
571* Bidiagonalize A.
572* (Workspace: need 3*M+N, prefer 3*M+(M+N)*NB)
573*
574 CALL sgebrd( m, n, a, lda, s, work( ie ), work( itauq ),
575 $ work( itaup ), work( nwork ), lwork-nwork+1,
576 $ info )
577*
578* Multiply B by transpose of left bidiagonalizing vectors.
579* (Workspace: need 3*M+NRHS, prefer 3*M+NRHS*NB)
580*
581 CALL sormbr( 'Q', 'L', 'T', m, nrhs, n, a, lda, work( itauq ),
582 $ b, ldb, work( nwork ), lwork-nwork+1, info )
583*
584* Solve the bidiagonal least squares problem.
585*
586 CALL slalsd( 'L', smlsiz, m, nrhs, s, work( ie ), b, ldb,
587 $ rcond, rank, work( nwork ), iwork, info )
588 IF( info.NE.0 ) THEN
589 GO TO 10
590 END IF
591*
592* Multiply B by right bidiagonalizing vectors of A.
593*
594 CALL sormbr( 'P', 'L', 'N', n, nrhs, m, a, lda, work( itaup ),
595 $ b, ldb, work( nwork ), lwork-nwork+1, info )
596*
597 END IF
598*
599* Undo scaling.
600*
601 IF( iascl.EQ.1 ) THEN
602 CALL slascl( 'G', 0, 0, anrm, smlnum, n, nrhs, b, ldb, info )
603 CALL slascl( 'G', 0, 0, smlnum, anrm, minmn, 1, s, minmn,
604 $ info )
605 ELSE IF( iascl.EQ.2 ) THEN
606 CALL slascl( 'G', 0, 0, anrm, bignum, n, nrhs, b, ldb, info )
607 CALL slascl( 'G', 0, 0, bignum, anrm, minmn, 1, s, minmn,
608 $ info )
609 END IF
610 IF( ibscl.EQ.1 ) THEN
611 CALL slascl( 'G', 0, 0, smlnum, bnrm, n, nrhs, b, ldb, info )
612 ELSE IF( ibscl.EQ.2 ) THEN
613 CALL slascl( 'G', 0, 0, bignum, bnrm, n, nrhs, b, ldb, info )
614 END IF
615*
616 10 CONTINUE
617 work( 1 ) = sroundup_lwork(maxwrk)
618 iwork( 1 ) = liwork
619 RETURN
620*
621* End of SGELSD
622*
623 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sgebrd(m, n, a, lda, d, e, tauq, taup, work, lwork, info)
SGEBRD
Definition sgebrd.f:205
subroutine sgelqf(m, n, a, lda, tau, work, lwork, info)
SGELQF
Definition sgelqf.f:143
subroutine sgelsd(m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, iwork, info)
SGELSD computes the minimum-norm solution to a linear least squares problem for GE matrices
Definition sgelsd.f:204
subroutine sgeqrf(m, n, a, lda, tau, work, lwork, info)
SGEQRF
Definition sgeqrf.f:146
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
Definition slacpy.f:103
subroutine slalsd(uplo, smlsiz, n, nrhs, d, e, b, ldb, rcond, rank, work, iwork, info)
SLALSD uses the singular value decomposition of A to solve the least squares problem.
Definition slalsd.f:173
subroutine slascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
SLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
Definition slascl.f:143
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:110
subroutine sormbr(vect, side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
SORMBR
Definition sormbr.f:196
subroutine sormlq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
SORMLQ
Definition sormlq.f:168
subroutine sormqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
SORMQR
Definition sormqr.f:168