1 *> \brief <b> CGELSS solves overdetermined or underdetermined systems for GE matrices</b>
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CGELSS + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cgelss.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cgelss.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgelss.f">
21 * SUBROUTINE CGELSS( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK,
22 * WORK, LWORK, RWORK, INFO )
24 * .. Scalar Arguments ..
25 * INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
28 * .. Array Arguments ..
29 * REAL RWORK( * ), S( * )
30 * COMPLEX A( LDA, * ), B( LDB, * ), WORK( * )
39 *> CGELSS computes the minimum norm solution to a complex linear
40 *> least squares problem:
42 *> Minimize 2-norm(| b - A*x |).
44 *> using the singular value decomposition (SVD) of A. A is an M-by-N
45 *> matrix which may be rank-deficient.
47 *> Several right hand side vectors b and solution vectors x can be
48 *> handled in a single call; they are stored as the columns of the
49 *> M-by-NRHS right hand side matrix B and the N-by-NRHS solution matrix
52 *> The effective rank of A is determined by treating as zero those
53 *> singular values which are less than RCOND times the largest singular
63 *> The number of rows of the matrix A. M >= 0.
69 *> The number of columns of the matrix A. N >= 0.
75 *> The number of right hand sides, i.e., the number of columns
76 *> of the matrices B and X. NRHS >= 0.
81 *> A is COMPLEX array, dimension (LDA,N)
82 *> On entry, the M-by-N matrix A.
83 *> On exit, the first min(m,n) rows of A are overwritten with
84 *> its right singular vectors, stored rowwise.
90 *> The leading dimension of the array A. LDA >= max(1,M).
95 *> B is COMPLEX array, dimension (LDB,NRHS)
96 *> On entry, the M-by-NRHS right hand side matrix B.
97 *> On exit, B is overwritten by the N-by-NRHS solution matrix X.
98 *> If m >= n and RANK = n, the residual sum-of-squares for
99 *> the solution in the i-th column is given by the sum of
100 *> squares of the modulus of elements n+1:m in that column.
106 *> The leading dimension of the array B. LDB >= max(1,M,N).
111 *> S is REAL array, dimension (min(M,N))
112 *> The singular values of A in decreasing order.
113 *> The condition number of A in the 2-norm = S(1)/S(min(m,n)).
119 *> RCOND is used to determine the effective rank of A.
120 *> Singular values S(i) <= RCOND*S(1) are treated as zero.
121 *> If RCOND < 0, machine precision is used instead.
127 *> The effective rank of A, i.e., the number of singular values
128 *> which are greater than RCOND*S(1).
133 *> WORK is COMPLEX array, dimension (MAX(1,LWORK))
134 *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
140 *> The dimension of the array WORK. LWORK >= 1, and also:
141 *> LWORK >= 2*min(M,N) + max(M,N,NRHS)
142 *> For good performance, LWORK should generally be larger.
144 *> If LWORK = -1, then a workspace query is assumed; the routine
145 *> only calculates the optimal size of the WORK array, returns
146 *> this value as the first entry of the WORK array, and no error
147 *> message related to LWORK is issued by XERBLA.
152 *> RWORK is REAL array, dimension (5*min(M,N))
158 *> = 0: successful exit
159 *> < 0: if INFO = -i, the i-th argument had an illegal value.
160 *> > 0: the algorithm for computing the SVD failed to converge;
161 *> if INFO = i, i off-diagonal elements of an intermediate
162 *> bidiagonal form did not converge to zero.
168 *> \author Univ. of Tennessee
169 *> \author Univ. of California Berkeley
170 *> \author Univ. of Colorado Denver
175 *> \ingroup complexGEsolve
177 * =====================================================================
178 SUBROUTINE CGELSS( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK,
179 $ WORK, LWORK, RWORK, INFO )
181 * -- LAPACK driver routine (version 3.6.1) --
182 * -- LAPACK is a software package provided by Univ. of Tennessee, --
183 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
186 * .. Scalar Arguments ..
187 INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
190 * .. Array Arguments ..
191 REAL RWORK( * ), S( * )
192 COMPLEX A( LDA, * ), B( LDB, * ), WORK( * )
195 * =====================================================================
199 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
201 PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ),
202 $ CONE = ( 1.0E+0, 0.0E+0 ) )
204 * .. Local Scalars ..
206 INTEGER BL, CHUNK, I, IASCL, IBSCL, IE, IL, IRWORK,
207 $ ITAU, ITAUP, ITAUQ, IWORK, LDWORK, MAXMN,
208 $ MAXWRK, MINMN, MINWRK, MM, MNTHR
209 INTEGER LWORK_CGEQRF, LWORK_CUNMQR, LWORK_CGEBRD,
210 $ LWORK_CUNMBR, LWORK_CUNGBR, LWORK_CUNMLQ,
212 REAL ANRM, BIGNUM, BNRM, EPS, SFMIN, SMLNUM, THR
217 * .. External Subroutines ..
218 EXTERNAL CBDSQR, CCOPY, CGEBRD, CGELQF, CGEMM, CGEMV,
219 $ CGEQRF, CLACPY, CLASCL, CLASET, CSRSCL, CUNGBR,
220 $ CUNMBR, CUNMLQ, CUNMQR, SLABAD, SLASCL, SLASET,
223 * .. External Functions ..
226 EXTERNAL ILAENV, CLANGE, SLAMCH
228 * .. Intrinsic Functions ..
231 * .. Executable Statements ..
233 * Test the input arguments
238 LQUERY = ( LWORK.EQ.-1 )
241 ELSE IF( N.LT.0 ) THEN
243 ELSE IF( NRHS.LT.0 ) THEN
245 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
247 ELSE IF( LDB.LT.MAX( 1, MAXMN ) ) THEN
252 * (Note: Comments in the code beginning "Workspace:" describe the
253 * minimal amount of workspace needed at that point in the code,
254 * as well as the preferred amount for good performance.
255 * CWorkspace refers to complex workspace, and RWorkspace refers
256 * to real workspace. NB refers to the optimal block size for the
257 * immediately following subroutine, as returned by ILAENV.)
262 IF( MINMN.GT.0 ) THEN
264 MNTHR = ILAENV( 6, 'CGELSS', ' ', M, N, NRHS, -1 )
265 IF( M.GE.N .AND. M.GE.MNTHR ) THEN
267 * Path 1a - overdetermined, with many more rows than
270 * Compute space needed for CGEQRF
271 CALL CGEQRF( M, N, A, LDA, DUM(1), DUM(1), -1, INFO )
273 * Compute space needed for CUNMQR
274 CALL CUNMQR( 'L', 'C', M, NRHS, N, A, LDA, DUM(1), B,
275 $ LDB, DUM(1), -1, INFO )
278 MAXWRK = MAX( MAXWRK, N + N*ILAENV( 1, 'CGEQRF', ' ', M,
280 MAXWRK = MAX( MAXWRK, N + NRHS*ILAENV( 1, 'CUNMQR', 'LC',
285 * Path 1 - overdetermined or exactly determined
287 * Compute space needed for CGEBRD
288 CALL CGEBRD( MM, N, A, LDA, S, S, DUM(1), DUM(1), DUM(1),
291 * Compute space needed for CUNMBR
292 CALL CUNMBR( 'Q', 'L', 'C', MM, NRHS, N, A, LDA, DUM(1),
293 $ B, LDB, DUM(1), -1, INFO )
295 * Compute space needed for CUNGBR
296 CALL CUNGBR( 'P', N, N, N, A, LDA, DUM(1),
299 * Compute total workspace needed
300 MAXWRK = MAX( MAXWRK, 2*N + LWORK_CGEBRD )
301 MAXWRK = MAX( MAXWRK, 2*N + LWORK_CUNMBR )
302 MAXWRK = MAX( MAXWRK, 2*N + LWORK_CUNGBR )
303 MAXWRK = MAX( MAXWRK, N*NRHS )
304 MINWRK = 2*N + MAX( NRHS, M )
307 MINWRK = 2*M + MAX( NRHS, N )
308 IF( N.GE.MNTHR ) THEN
310 * Path 2a - underdetermined, with many more columns
313 * Compute space needed for CGELQF
314 CALL CGELQF( M, N, A, LDA, DUM(1), DUM(1),
317 * Compute space needed for CGEBRD
318 CALL CGEBRD( M, M, A, LDA, S, S, DUM(1), DUM(1),
321 * Compute space needed for CUNMBR
322 CALL CUNMBR( 'Q', 'L', 'C', M, NRHS, N, A, LDA,
323 $ DUM(1), B, LDB, DUM(1), -1, INFO )
325 * Compute space needed for CUNGBR
326 CALL CUNGBR( 'P', M, M, M, A, LDA, DUM(1),
329 * Compute space needed for CUNMLQ
330 CALL CUNMLQ( 'L', 'C', N, NRHS, M, A, LDA, DUM(1),
331 $ B, LDB, DUM(1), -1, INFO )
333 * Compute total workspace needed
334 MAXWRK = M + LWORK_CGELQF
335 MAXWRK = MAX( MAXWRK, 3*M + M*M + LWORK_CGEBRD )
336 MAXWRK = MAX( MAXWRK, 3*M + M*M + LWORK_CUNMBR )
337 MAXWRK = MAX( MAXWRK, 3*M + M*M + LWORK_CUNGBR )
339 MAXWRK = MAX( MAXWRK, M*M + M + M*NRHS )
341 MAXWRK = MAX( MAXWRK, M*M + 2*M )
343 MAXWRK = MAX( MAXWRK, M + LWORK_CUNMLQ )
346 * Path 2 - underdetermined
348 * Compute space needed for CGEBRD
349 CALL CGEBRD( M, N, A, LDA, S, S, DUM(1), DUM(1),
352 * Compute space needed for CUNMBR
353 CALL CUNMBR( 'Q', 'L', 'C', M, NRHS, M, A, LDA,
354 $ DUM(1), B, LDB, DUM(1), -1, INFO )
356 * Compute space needed for CUNGBR
357 CALL CUNGBR( 'P', M, N, M, A, LDA, DUM(1),
360 MAXWRK = 2*M + LWORK_CGEBRD
361 MAXWRK = MAX( MAXWRK, 2*M + LWORK_CUNMBR )
362 MAXWRK = MAX( MAXWRK, 2*M + LWORK_CUNGBR )
363 MAXWRK = MAX( MAXWRK, N*NRHS )
366 MAXWRK = MAX( MINWRK, MAXWRK )
370 IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
375 CALL XERBLA( 'CGELSS', -INFO )
377 ELSE IF( LQUERY ) THEN
381 * Quick return if possible
383 IF( M.EQ.0 .OR. N.EQ.0 ) THEN
388 * Get machine parameters
391 SFMIN = SLAMCH( 'S' )
393 BIGNUM = ONE / SMLNUM
394 CALL SLABAD( SMLNUM, BIGNUM )
396 * Scale A if max element outside range [SMLNUM,BIGNUM]
398 ANRM = CLANGE( 'M', M, N, A, LDA, RWORK )
400 IF( ANRM.GT.ZERO .AND. ANRM.LT.SMLNUM ) THEN
402 * Scale matrix norm up to SMLNUM
404 CALL CLASCL( 'G', 0, 0, ANRM, SMLNUM, M, N, A, LDA, INFO )
406 ELSE IF( ANRM.GT.BIGNUM ) THEN
408 * Scale matrix norm down to BIGNUM
410 CALL CLASCL( 'G', 0, 0, ANRM, BIGNUM, M, N, A, LDA, INFO )
412 ELSE IF( ANRM.EQ.ZERO ) THEN
414 * Matrix all zero. Return zero solution.
416 CALL CLASET( 'F', MAX( M, N ), NRHS, CZERO, CZERO, B, LDB )
417 CALL SLASET( 'F', MINMN, 1, ZERO, ZERO, S, MINMN )
422 * Scale B if max element outside range [SMLNUM,BIGNUM]
424 BNRM = CLANGE( 'M', M, NRHS, B, LDB, RWORK )
426 IF( BNRM.GT.ZERO .AND. BNRM.LT.SMLNUM ) THEN
428 * Scale matrix norm up to SMLNUM
430 CALL CLASCL( 'G', 0, 0, BNRM, SMLNUM, M, NRHS, B, LDB, INFO )
432 ELSE IF( BNRM.GT.BIGNUM ) THEN
434 * Scale matrix norm down to BIGNUM
436 CALL CLASCL( 'G', 0, 0, BNRM, BIGNUM, M, NRHS, B, LDB, INFO )
440 * Overdetermined case
444 * Path 1 - overdetermined or exactly determined
447 IF( M.GE.MNTHR ) THEN
449 * Path 1a - overdetermined, with many more rows than columns
456 * (CWorkspace: need 2*N, prefer N+N*NB)
459 CALL CGEQRF( M, N, A, LDA, WORK( ITAU ), WORK( IWORK ),
460 $ LWORK-IWORK+1, INFO )
462 * Multiply B by transpose(Q)
463 * (CWorkspace: need N+NRHS, prefer N+NRHS*NB)
466 CALL CUNMQR( 'L', 'C', M, NRHS, N, A, LDA, WORK( ITAU ), B,
467 $ LDB, WORK( IWORK ), LWORK-IWORK+1, INFO )
472 $ CALL CLASET( 'L', N-1, N-1, CZERO, CZERO, A( 2, 1 ),
481 * Bidiagonalize R in A
482 * (CWorkspace: need 2*N+MM, prefer 2*N+(MM+N)*NB)
483 * (RWorkspace: need N)
485 CALL CGEBRD( MM, N, A, LDA, S, RWORK( IE ), WORK( ITAUQ ),
486 $ WORK( ITAUP ), WORK( IWORK ), LWORK-IWORK+1,
489 * Multiply B by transpose of left bidiagonalizing vectors of R
490 * (CWorkspace: need 2*N+NRHS, prefer 2*N+NRHS*NB)
493 CALL CUNMBR( 'Q', 'L', 'C', MM, NRHS, N, A, LDA, WORK( ITAUQ ),
494 $ B, LDB, WORK( IWORK ), LWORK-IWORK+1, INFO )
496 * Generate right bidiagonalizing vectors of R in A
497 * (CWorkspace: need 3*N-1, prefer 2*N+(N-1)*NB)
500 CALL CUNGBR( 'P', N, N, N, A, LDA, WORK( ITAUP ),
501 $ WORK( IWORK ), LWORK-IWORK+1, INFO )
504 * Perform bidiagonal QR iteration
505 * multiply B by transpose of left singular vectors
506 * compute right singular vectors in A
508 * (RWorkspace: need BDSPAC)
510 CALL CBDSQR( 'U', N, N, 0, NRHS, S, RWORK( IE ), A, LDA, DUM,
511 $ 1, B, LDB, RWORK( IRWORK ), INFO )
515 * Multiply B by reciprocals of singular values
517 THR = MAX( RCOND*S( 1 ), SFMIN )
519 $ THR = MAX( EPS*S( 1 ), SFMIN )
522 IF( S( I ).GT.THR ) THEN
523 CALL CSRSCL( NRHS, S( I ), B( I, 1 ), LDB )
526 CALL CLASET( 'F', 1, NRHS, CZERO, CZERO, B( I, 1 ), LDB )
530 * Multiply B by right singular vectors
531 * (CWorkspace: need N, prefer N*NRHS)
534 IF( LWORK.GE.LDB*NRHS .AND. NRHS.GT.1 ) THEN
535 CALL CGEMM( 'C', 'N', N, NRHS, N, CONE, A, LDA, B, LDB,
537 CALL CLACPY( 'G', N, NRHS, WORK, LDB, B, LDB )
538 ELSE IF( NRHS.GT.1 ) THEN
540 DO 20 I = 1, NRHS, CHUNK
541 BL = MIN( NRHS-I+1, CHUNK )
542 CALL CGEMM( 'C', 'N', N, BL, N, CONE, A, LDA, B( 1, I ),
543 $ LDB, CZERO, WORK, N )
544 CALL CLACPY( 'G', N, BL, WORK, N, B( 1, I ), LDB )
547 CALL CGEMV( 'C', N, N, CONE, A, LDA, B, 1, CZERO, WORK, 1 )
548 CALL CCOPY( N, WORK, 1, B, 1 )
551 ELSE IF( N.GE.MNTHR .AND. LWORK.GE.3*M+M*M+MAX( M, NRHS, N-2*M ) )
554 * Underdetermined case, M much less than N
556 * Path 2a - underdetermined, with many more columns than rows
557 * and sufficient workspace for an efficient algorithm
560 IF( LWORK.GE.3*M+M*LDA+MAX( M, NRHS, N-2*M ) )
566 * (CWorkspace: need 2*M, prefer M+M*NB)
569 CALL CGELQF( M, N, A, LDA, WORK( ITAU ), WORK( IWORK ),
570 $ LWORK-IWORK+1, INFO )
573 * Copy L to WORK(IL), zeroing out above it
575 CALL CLACPY( 'L', M, M, A, LDA, WORK( IL ), LDWORK )
576 CALL CLASET( 'U', M-1, M-1, CZERO, CZERO, WORK( IL+LDWORK ),
579 ITAUQ = IL + LDWORK*M
583 * Bidiagonalize L in WORK(IL)
584 * (CWorkspace: need M*M+4*M, prefer M*M+3*M+2*M*NB)
585 * (RWorkspace: need M)
587 CALL CGEBRD( M, M, WORK( IL ), LDWORK, S, RWORK( IE ),
588 $ WORK( ITAUQ ), WORK( ITAUP ), WORK( IWORK ),
589 $ LWORK-IWORK+1, INFO )
591 * Multiply B by transpose of left bidiagonalizing vectors of L
592 * (CWorkspace: need M*M+3*M+NRHS, prefer M*M+3*M+NRHS*NB)
595 CALL CUNMBR( 'Q', 'L', 'C', M, NRHS, M, WORK( IL ), LDWORK,
596 $ WORK( ITAUQ ), B, LDB, WORK( IWORK ),
597 $ LWORK-IWORK+1, INFO )
599 * Generate right bidiagonalizing vectors of R in WORK(IL)
600 * (CWorkspace: need M*M+4*M-1, prefer M*M+3*M+(M-1)*NB)
603 CALL CUNGBR( 'P', M, M, M, WORK( IL ), LDWORK, WORK( ITAUP ),
604 $ WORK( IWORK ), LWORK-IWORK+1, INFO )
607 * Perform bidiagonal QR iteration, computing right singular
608 * vectors of L in WORK(IL) and multiplying B by transpose of
609 * left singular vectors
610 * (CWorkspace: need M*M)
611 * (RWorkspace: need BDSPAC)
613 CALL CBDSQR( 'U', M, M, 0, NRHS, S, RWORK( IE ), WORK( IL ),
614 $ LDWORK, A, LDA, B, LDB, RWORK( IRWORK ), INFO )
618 * Multiply B by reciprocals of singular values
620 THR = MAX( RCOND*S( 1 ), SFMIN )
622 $ THR = MAX( EPS*S( 1 ), SFMIN )
625 IF( S( I ).GT.THR ) THEN
626 CALL CSRSCL( NRHS, S( I ), B( I, 1 ), LDB )
629 CALL CLASET( 'F', 1, NRHS, CZERO, CZERO, B( I, 1 ), LDB )
632 IWORK = IL + M*LDWORK
634 * Multiply B by right singular vectors of L in WORK(IL)
635 * (CWorkspace: need M*M+2*M, prefer M*M+M+M*NRHS)
638 IF( LWORK.GE.LDB*NRHS+IWORK-1 .AND. NRHS.GT.1 ) THEN
639 CALL CGEMM( 'C', 'N', M, NRHS, M, CONE, WORK( IL ), LDWORK,
640 $ B, LDB, CZERO, WORK( IWORK ), LDB )
641 CALL CLACPY( 'G', M, NRHS, WORK( IWORK ), LDB, B, LDB )
642 ELSE IF( NRHS.GT.1 ) THEN
643 CHUNK = ( LWORK-IWORK+1 ) / M
644 DO 40 I = 1, NRHS, CHUNK
645 BL = MIN( NRHS-I+1, CHUNK )
646 CALL CGEMM( 'C', 'N', M, BL, M, CONE, WORK( IL ), LDWORK,
647 $ B( 1, I ), LDB, CZERO, WORK( IWORK ), M )
648 CALL CLACPY( 'G', M, BL, WORK( IWORK ), M, B( 1, I ),
652 CALL CGEMV( 'C', M, M, CONE, WORK( IL ), LDWORK, B( 1, 1 ),
653 $ 1, CZERO, WORK( IWORK ), 1 )
654 CALL CCOPY( M, WORK( IWORK ), 1, B( 1, 1 ), 1 )
657 * Zero out below first M rows of B
659 CALL CLASET( 'F', N-M, NRHS, CZERO, CZERO, B( M+1, 1 ), LDB )
662 * Multiply transpose(Q) by B
663 * (CWorkspace: need M+NRHS, prefer M+NHRS*NB)
666 CALL CUNMLQ( 'L', 'C', N, NRHS, M, A, LDA, WORK( ITAU ), B,
667 $ LDB, WORK( IWORK ), LWORK-IWORK+1, INFO )
671 * Path 2 - remaining underdetermined cases
679 * (CWorkspace: need 3*M, prefer 2*M+(M+N)*NB)
680 * (RWorkspace: need N)
682 CALL CGEBRD( M, N, A, LDA, S, RWORK( IE ), WORK( ITAUQ ),
683 $ WORK( ITAUP ), WORK( IWORK ), LWORK-IWORK+1,
686 * Multiply B by transpose of left bidiagonalizing vectors
687 * (CWorkspace: need 2*M+NRHS, prefer 2*M+NRHS*NB)
690 CALL CUNMBR( 'Q', 'L', 'C', M, NRHS, N, A, LDA, WORK( ITAUQ ),
691 $ B, LDB, WORK( IWORK ), LWORK-IWORK+1, INFO )
693 * Generate right bidiagonalizing vectors in A
694 * (CWorkspace: need 3*M, prefer 2*M+M*NB)
697 CALL CUNGBR( 'P', M, N, M, A, LDA, WORK( ITAUP ),
698 $ WORK( IWORK ), LWORK-IWORK+1, INFO )
701 * Perform bidiagonal QR iteration,
702 * computing right singular vectors of A in A and
703 * multiplying B by transpose of left singular vectors
705 * (RWorkspace: need BDSPAC)
707 CALL CBDSQR( 'L', M, N, 0, NRHS, S, RWORK( IE ), A, LDA, DUM,
708 $ 1, B, LDB, RWORK( IRWORK ), INFO )
712 * Multiply B by reciprocals of singular values
714 THR = MAX( RCOND*S( 1 ), SFMIN )
716 $ THR = MAX( EPS*S( 1 ), SFMIN )
719 IF( S( I ).GT.THR ) THEN
720 CALL CSRSCL( NRHS, S( I ), B( I, 1 ), LDB )
723 CALL CLASET( 'F', 1, NRHS, CZERO, CZERO, B( I, 1 ), LDB )
727 * Multiply B by right singular vectors of A
728 * (CWorkspace: need N, prefer N*NRHS)
731 IF( LWORK.GE.LDB*NRHS .AND. NRHS.GT.1 ) THEN
732 CALL CGEMM( 'C', 'N', N, NRHS, M, CONE, A, LDA, B, LDB,
734 CALL CLACPY( 'G', N, NRHS, WORK, LDB, B, LDB )
735 ELSE IF( NRHS.GT.1 ) THEN
737 DO 60 I = 1, NRHS, CHUNK
738 BL = MIN( NRHS-I+1, CHUNK )
739 CALL CGEMM( 'C', 'N', N, BL, M, CONE, A, LDA, B( 1, I ),
740 $ LDB, CZERO, WORK, N )
741 CALL CLACPY( 'F', N, BL, WORK, N, B( 1, I ), LDB )
744 CALL CGEMV( 'C', M, N, CONE, A, LDA, B, 1, CZERO, WORK, 1 )
745 CALL CCOPY( N, WORK, 1, B, 1 )
751 IF( IASCL.EQ.1 ) THEN
752 CALL CLASCL( 'G', 0, 0, ANRM, SMLNUM, N, NRHS, B, LDB, INFO )
753 CALL SLASCL( 'G', 0, 0, SMLNUM, ANRM, MINMN, 1, S, MINMN,
755 ELSE IF( IASCL.EQ.2 ) THEN
756 CALL CLASCL( 'G', 0, 0, ANRM, BIGNUM, N, NRHS, B, LDB, INFO )
757 CALL SLASCL( 'G', 0, 0, BIGNUM, ANRM, MINMN, 1, S, MINMN,
760 IF( IBSCL.EQ.1 ) THEN
761 CALL CLASCL( 'G', 0, 0, SMLNUM, BNRM, N, NRHS, B, LDB, INFO )
762 ELSE IF( IBSCL.EQ.2 ) THEN
763 CALL CLASCL( 'G', 0, 0, BIGNUM, BNRM, N, NRHS, B, LDB, INFO )