1 *> \brief \b ZLATBS solves a triangular banded system of equations.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZLATBS + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlatbs.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlatbs.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlatbs.f">
21 * SUBROUTINE ZLATBS( UPLO, TRANS, DIAG, NORMIN, N, KD, AB, LDAB, X,
22 * SCALE, CNORM, INFO )
24 * .. Scalar Arguments ..
25 * CHARACTER DIAG, NORMIN, TRANS, UPLO
26 * INTEGER INFO, KD, LDAB, N
27 * DOUBLE PRECISION SCALE
29 * .. Array Arguments ..
30 * DOUBLE PRECISION CNORM( * )
31 * COMPLEX*16 AB( LDAB, * ), X( * )
40 *> ZLATBS solves one of the triangular systems
42 *> A * x = s*b, A**T * x = s*b, or A**H * x = s*b,
44 *> with scaling to prevent overflow, where A is an upper or lower
45 *> triangular band matrix. Here A**T denotes the transpose of A, x and b
46 *> are n-element vectors, and s is a scaling factor, usually less than
47 *> or equal to 1, chosen so that the components of x will be less than
48 *> the overflow threshold. If the unscaled problem will not cause
49 *> overflow, the Level 2 BLAS routine ZTBSV is called. If the matrix A
50 *> is singular (A(j,j) = 0 for some j), then s is set to 0 and a
51 *> non-trivial solution to A*x = 0 is returned.
59 *> UPLO is CHARACTER*1
60 *> Specifies whether the matrix A is upper or lower triangular.
61 *> = 'U': Upper triangular
62 *> = 'L': Lower triangular
67 *> TRANS is CHARACTER*1
68 *> Specifies the operation applied to A.
69 *> = 'N': Solve A * x = s*b (No transpose)
70 *> = 'T': Solve A**T * x = s*b (Transpose)
71 *> = 'C': Solve A**H * x = s*b (Conjugate transpose)
76 *> DIAG is CHARACTER*1
77 *> Specifies whether or not the matrix A is unit triangular.
78 *> = 'N': Non-unit triangular
79 *> = 'U': Unit triangular
84 *> NORMIN is CHARACTER*1
85 *> Specifies whether CNORM has been set or not.
86 *> = 'Y': CNORM contains the column norms on entry
87 *> = 'N': CNORM is not set on entry. On exit, the norms will
88 *> be computed and stored in CNORM.
94 *> The order of the matrix A. N >= 0.
100 *> The number of subdiagonals or superdiagonals in the
101 *> triangular matrix A. KD >= 0.
106 *> AB is COMPLEX*16 array, dimension (LDAB,N)
107 *> The upper or lower triangular band matrix A, stored in the
108 *> first KD+1 rows of the array. The j-th column of A is stored
109 *> in the j-th column of the array AB as follows:
110 *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
111 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
117 *> The leading dimension of the array AB. LDAB >= KD+1.
122 *> X is COMPLEX*16 array, dimension (N)
123 *> On entry, the right hand side b of the triangular system.
124 *> On exit, X is overwritten by the solution vector x.
129 *> SCALE is DOUBLE PRECISION
130 *> The scaling factor s for the triangular system
131 *> A * x = s*b, A**T * x = s*b, or A**H * x = s*b.
132 *> If SCALE = 0, the matrix A is singular or badly scaled, and
133 *> the vector x is an exact or approximate solution to A*x = 0.
136 *> \param[in,out] CNORM
138 *> CNORM is DOUBLE PRECISION array, dimension (N)
140 *> If NORMIN = 'Y', CNORM is an input argument and CNORM(j)
141 *> contains the norm of the off-diagonal part of the j-th column
142 *> of A. If TRANS = 'N', CNORM(j) must be greater than or equal
143 *> to the infinity-norm, and if TRANS = 'T' or 'C', CNORM(j)
144 *> must be greater than or equal to the 1-norm.
146 *> If NORMIN = 'N', CNORM is an output argument and CNORM(j)
147 *> returns the 1-norm of the offdiagonal part of the j-th column
154 *> = 0: successful exit
155 *> < 0: if INFO = -k, the k-th argument had an illegal value
161 *> \author Univ. of Tennessee
162 *> \author Univ. of California Berkeley
163 *> \author Univ. of Colorado Denver
166 *> \date September 2012
168 *> \ingroup complex16OTHERauxiliary
170 *> \par Further Details:
171 * =====================
175 *> A rough bound on x is computed; if that is less than overflow, ZTBSV
176 *> is called, otherwise, specific code is used which checks for possible
177 *> overflow or divide-by-zero at every operation.
179 *> A columnwise scheme is used for solving A*x = b. The basic algorithm
180 *> if A is lower triangular is
184 *> x(j) := x(j) / A(j,j)
185 *> x[j+1:n] := x[j+1:n] - x(j) * A[j+1:n,j]
188 *> Define bounds on the components of x after j iterations of the loop:
189 *> M(j) = bound on x[1:j]
190 *> G(j) = bound on x[j+1:n]
191 *> Initially, let M(0) = 0 and G(0) = max{x(i), i=1,...,n}.
193 *> Then for iteration j+1 we have
194 *> M(j+1) <= G(j) / | A(j+1,j+1) |
195 *> G(j+1) <= G(j) + M(j+1) * | A[j+2:n,j+1] |
196 *> <= G(j) ( 1 + CNORM(j+1) / | A(j+1,j+1) | )
198 *> where CNORM(j+1) is greater than or equal to the infinity-norm of
199 *> column j+1 of A, not counting the diagonal. Hence
201 *> G(j) <= G(0) product ( 1 + CNORM(i) / | A(i,i) | )
205 *> |x(j)| <= ( G(0) / |A(j,j)| ) product ( 1 + CNORM(i) / |A(i,i)| )
208 *> Since |x(j)| <= M(j), we use the Level 2 BLAS routine ZTBSV if the
209 *> reciprocal of the largest M(j), j=1,..,n, is larger than
210 *> max(underflow, 1/overflow).
212 *> The bound on x(j) is also used to determine when a step in the
213 *> columnwise method can be performed without fear of overflow. If
214 *> the computed bound is greater than a large constant, x is scaled to
215 *> prevent overflow, but if the bound overflows, x is set to 0, x(j) to
216 *> 1, and scale to 0, and a non-trivial solution to A*x = 0 is found.
218 *> Similarly, a row-wise scheme is used to solve A**T *x = b or
219 *> A**H *x = b. The basic algorithm for A upper triangular is
222 *> x(j) := ( b(j) - A[1:j-1,j]' * x[1:j-1] ) / A(j,j)
225 *> We simultaneously compute two bounds
226 *> G(j) = bound on ( b(i) - A[1:i-1,i]' * x[1:i-1] ), 1<=i<=j
227 *> M(j) = bound on x(i), 1<=i<=j
229 *> The initial values are G(0) = 0, M(0) = max{b(i), i=1,..,n}, and we
230 *> add the constraint G(j) >= G(j-1) and M(j) >= M(j-1) for j >= 1.
231 *> Then the bound on x(j) is
233 *> M(j) <= M(j-1) * ( 1 + CNORM(j) ) / | A(j,j) |
235 *> <= M(0) * product ( ( 1 + CNORM(i) ) / |A(i,i)| )
238 *> and we can safely call ZTBSV if 1/M(n) and 1/G(n) are both greater
239 *> than max(underflow, 1/overflow).
242 * =====================================================================
243 SUBROUTINE ZLATBS( UPLO, TRANS, DIAG, NORMIN, N, KD, AB, LDAB, X,
244 $ SCALE, CNORM, INFO )
246 * -- LAPACK auxiliary routine (version 3.4.2) --
247 * -- LAPACK is a software package provided by Univ. of Tennessee, --
248 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
251 * .. Scalar Arguments ..
252 CHARACTER DIAG, NORMIN, TRANS, UPLO
253 INTEGER INFO, KD, LDAB, N
254 DOUBLE PRECISION SCALE
256 * .. Array Arguments ..
257 DOUBLE PRECISION CNORM( * )
258 COMPLEX*16 AB( LDAB, * ), X( * )
261 * =====================================================================
264 DOUBLE PRECISION ZERO, HALF, ONE, TWO
265 PARAMETER ( ZERO = 0.0D+0, HALF = 0.5D+0, ONE = 1.0D+0,
268 * .. Local Scalars ..
269 LOGICAL NOTRAN, NOUNIT, UPPER
270 INTEGER I, IMAX, J, JFIRST, JINC, JLAST, JLEN, MAIND
271 DOUBLE PRECISION BIGNUM, GROW, REC, SMLNUM, TJJ, TMAX, TSCAL,
273 COMPLEX*16 CSUMJ, TJJS, USCAL, ZDUM
275 * .. External Functions ..
277 INTEGER IDAMAX, IZAMAX
278 DOUBLE PRECISION DLAMCH, DZASUM
279 COMPLEX*16 ZDOTC, ZDOTU, ZLADIV
280 EXTERNAL LSAME, IDAMAX, IZAMAX, DLAMCH, DZASUM, ZDOTC,
283 * .. External Subroutines ..
284 EXTERNAL DSCAL, XERBLA, ZAXPY, ZDSCAL, ZTBSV
286 * .. Intrinsic Functions ..
287 INTRINSIC ABS, DBLE, DCMPLX, DCONJG, DIMAG, MAX, MIN
289 * .. Statement Functions ..
290 DOUBLE PRECISION CABS1, CABS2
292 * .. Statement Function definitions ..
293 CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
294 CABS2( ZDUM ) = ABS( DBLE( ZDUM ) / 2.D0 ) +
295 $ ABS( DIMAG( ZDUM ) / 2.D0 )
297 * .. Executable Statements ..
300 UPPER = LSAME( UPLO, 'U' )
301 NOTRAN = LSAME( TRANS, 'N' )
302 NOUNIT = LSAME( DIAG, 'N' )
304 * Test the input parameters.
306 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
308 ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'T' ) .AND. .NOT.
309 $ LSAME( TRANS, 'C' ) ) THEN
311 ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
313 ELSE IF( .NOT.LSAME( NORMIN, 'Y' ) .AND. .NOT.
314 $ LSAME( NORMIN, 'N' ) ) THEN
316 ELSE IF( N.LT.0 ) THEN
318 ELSE IF( KD.LT.0 ) THEN
320 ELSE IF( LDAB.LT.KD+1 ) THEN
324 CALL XERBLA( 'ZLATBS', -INFO )
328 * Quick return if possible
333 * Determine machine dependent parameters to control overflow.
335 SMLNUM = DLAMCH( 'Safe minimum' )
336 BIGNUM = ONE / SMLNUM
337 CALL DLABAD( SMLNUM, BIGNUM )
338 SMLNUM = SMLNUM / DLAMCH( 'Precision' )
339 BIGNUM = ONE / SMLNUM
342 IF( LSAME( NORMIN, 'N' ) ) THEN
344 * Compute the 1-norm of each column, not including the diagonal.
348 * A is upper triangular.
351 JLEN = MIN( KD, J-1 )
352 CNORM( J ) = DZASUM( JLEN, AB( KD+1-JLEN, J ), 1 )
356 * A is lower triangular.
359 JLEN = MIN( KD, N-J )
361 CNORM( J ) = DZASUM( JLEN, AB( 2, J ), 1 )
369 * Scale the column norms by TSCAL if the maximum element in CNORM is
370 * greater than BIGNUM/2.
372 IMAX = IDAMAX( N, CNORM, 1 )
374 IF( TMAX.LE.BIGNUM*HALF ) THEN
377 TSCAL = HALF / ( SMLNUM*TMAX )
378 CALL DSCAL( N, TSCAL, CNORM, 1 )
381 * Compute a bound on the computed solution vector to see if the
382 * Level 2 BLAS routine ZTBSV can be used.
386 XMAX = MAX( XMAX, CABS2( X( J ) ) )
391 * Compute the growth in A * x = b.
405 IF( TSCAL.NE.ONE ) THEN
412 * A is non-unit triangular.
414 * Compute GROW = 1/G(j) and XBND = 1/M(j).
415 * Initially, G(0) = max{x(i), i=1,...,n}.
417 GROW = HALF / MAX( XBND, SMLNUM )
419 DO 40 J = JFIRST, JLAST, JINC
421 * Exit the loop if the growth factor is too small.
426 TJJS = AB( MAIND, J )
429 IF( TJJ.GE.SMLNUM ) THEN
431 * M(j) = G(j-1) / abs(A(j,j))
433 XBND = MIN( XBND, MIN( ONE, TJJ )*GROW )
436 * M(j) could overflow, set XBND to 0.
441 IF( TJJ+CNORM( J ).GE.SMLNUM ) THEN
443 * G(j) = G(j-1)*( 1 + CNORM(j) / abs(A(j,j)) )
445 GROW = GROW*( TJJ / ( TJJ+CNORM( J ) ) )
448 * G(j) could overflow, set GROW to 0.
456 * A is unit triangular.
458 * Compute GROW = 1/G(j), where G(0) = max{x(i), i=1,...,n}.
460 GROW = MIN( ONE, HALF / MAX( XBND, SMLNUM ) )
461 DO 50 J = JFIRST, JLAST, JINC
463 * Exit the loop if the growth factor is too small.
468 * G(j) = G(j-1)*( 1 + CNORM(j) )
470 GROW = GROW*( ONE / ( ONE+CNORM( J ) ) )
477 * Compute the growth in A**T * x = b or A**H * x = b.
491 IF( TSCAL.NE.ONE ) THEN
498 * A is non-unit triangular.
500 * Compute GROW = 1/G(j) and XBND = 1/M(j).
501 * Initially, M(0) = max{x(i), i=1,...,n}.
503 GROW = HALF / MAX( XBND, SMLNUM )
505 DO 70 J = JFIRST, JLAST, JINC
507 * Exit the loop if the growth factor is too small.
512 * G(j) = max( G(j-1), M(j-1)*( 1 + CNORM(j) ) )
514 XJ = ONE + CNORM( J )
515 GROW = MIN( GROW, XBND / XJ )
517 TJJS = AB( MAIND, J )
520 IF( TJJ.GE.SMLNUM ) THEN
522 * M(j) = M(j-1)*( 1 + CNORM(j) ) / abs(A(j,j))
525 $ XBND = XBND*( TJJ / XJ )
528 * M(j) could overflow, set XBND to 0.
533 GROW = MIN( GROW, XBND )
536 * A is unit triangular.
538 * Compute GROW = 1/G(j), where G(0) = max{x(i), i=1,...,n}.
540 GROW = MIN( ONE, HALF / MAX( XBND, SMLNUM ) )
541 DO 80 J = JFIRST, JLAST, JINC
543 * Exit the loop if the growth factor is too small.
548 * G(j) = ( 1 + CNORM(j) )*G(j-1)
550 XJ = ONE + CNORM( J )
557 IF( ( GROW*TSCAL ).GT.SMLNUM ) THEN
559 * Use the Level 2 BLAS solve if the reciprocal of the bound on
560 * elements of X is not too small.
562 CALL ZTBSV( UPLO, TRANS, DIAG, N, KD, AB, LDAB, X, 1 )
565 * Use a Level 1 BLAS solve, scaling intermediate results.
567 IF( XMAX.GT.BIGNUM*HALF ) THEN
569 * Scale X so that its components are less than or equal to
570 * BIGNUM in absolute value.
572 SCALE = ( BIGNUM*HALF ) / XMAX
573 CALL ZDSCAL( N, SCALE, X, 1 )
583 DO 120 J = JFIRST, JLAST, JINC
585 * Compute x(j) = b(j) / A(j,j), scaling x if necessary.
589 TJJS = AB( MAIND, J )*TSCAL
596 IF( TJJ.GT.SMLNUM ) THEN
598 * abs(A(j,j)) > SMLNUM:
600 IF( TJJ.LT.ONE ) THEN
601 IF( XJ.GT.TJJ*BIGNUM ) THEN
606 CALL ZDSCAL( N, REC, X, 1 )
611 X( J ) = ZLADIV( X( J ), TJJS )
613 ELSE IF( TJJ.GT.ZERO ) THEN
615 * 0 < abs(A(j,j)) <= SMLNUM:
617 IF( XJ.GT.TJJ*BIGNUM ) THEN
619 * Scale x by (1/abs(x(j)))*abs(A(j,j))*BIGNUM
620 * to avoid overflow when dividing by A(j,j).
622 REC = ( TJJ*BIGNUM ) / XJ
623 IF( CNORM( J ).GT.ONE ) THEN
625 * Scale by 1/CNORM(j) to avoid overflow when
626 * multiplying x(j) times column j.
628 REC = REC / CNORM( J )
630 CALL ZDSCAL( N, REC, X, 1 )
634 X( J ) = ZLADIV( X( J ), TJJS )
638 * A(j,j) = 0: Set x(1:n) = 0, x(j) = 1, and
639 * scale = 0, and compute a solution to A*x = 0.
651 * Scale x if necessary to avoid overflow when adding a
652 * multiple of column j of A.
656 IF( CNORM( J ).GT.( BIGNUM-XMAX )*REC ) THEN
658 * Scale x by 1/(2*abs(x(j))).
661 CALL ZDSCAL( N, REC, X, 1 )
664 ELSE IF( XJ*CNORM( J ).GT.( BIGNUM-XMAX ) ) THEN
668 CALL ZDSCAL( N, HALF, X, 1 )
676 * x(max(1,j-kd):j-1) := x(max(1,j-kd):j-1) -
677 * x(j)* A(max(1,j-kd):j-1,j)
679 JLEN = MIN( KD, J-1 )
680 CALL ZAXPY( JLEN, -X( J )*TSCAL,
681 $ AB( KD+1-JLEN, J ), 1, X( J-JLEN ), 1 )
682 I = IZAMAX( J-1, X, 1 )
683 XMAX = CABS1( X( I ) )
685 ELSE IF( J.LT.N ) THEN
688 * x(j+1:min(j+kd,n)) := x(j+1:min(j+kd,n)) -
689 * x(j) * A(j+1:min(j+kd,n),j)
691 JLEN = MIN( KD, N-J )
693 $ CALL ZAXPY( JLEN, -X( J )*TSCAL, AB( 2, J ), 1,
695 I = J + IZAMAX( N-J, X( J+1 ), 1 )
696 XMAX = CABS1( X( I ) )
700 ELSE IF( LSAME( TRANS, 'T' ) ) THEN
704 DO 170 J = JFIRST, JLAST, JINC
706 * Compute x(j) = b(j) - sum A(k,j)*x(k).
711 REC = ONE / MAX( XMAX, ONE )
712 IF( CNORM( J ).GT.( BIGNUM-XJ )*REC ) THEN
714 * If x(j) could overflow, scale x by 1/(2*XMAX).
718 TJJS = AB( MAIND, J )*TSCAL
723 IF( TJJ.GT.ONE ) THEN
725 * Divide by A(j,j) when scaling x if A(j,j) > 1.
727 REC = MIN( ONE, REC*TJJ )
728 USCAL = ZLADIV( USCAL, TJJS )
730 IF( REC.LT.ONE ) THEN
731 CALL ZDSCAL( N, REC, X, 1 )
738 IF( USCAL.EQ.DCMPLX( ONE ) ) THEN
740 * If the scaling needed for A in the dot product is 1,
741 * call ZDOTU to perform the dot product.
744 JLEN = MIN( KD, J-1 )
745 CSUMJ = ZDOTU( JLEN, AB( KD+1-JLEN, J ), 1,
748 JLEN = MIN( KD, N-J )
750 $ CSUMJ = ZDOTU( JLEN, AB( 2, J ), 1, X( J+1 ),
755 * Otherwise, use in-line code for the dot product.
758 JLEN = MIN( KD, J-1 )
760 CSUMJ = CSUMJ + ( AB( KD+I-JLEN, J )*USCAL )*
764 JLEN = MIN( KD, N-J )
766 CSUMJ = CSUMJ + ( AB( I+1, J )*USCAL )*X( J+I )
771 IF( USCAL.EQ.DCMPLX( TSCAL ) ) THEN
773 * Compute x(j) := ( x(j) - CSUMJ ) / A(j,j) if 1/A(j,j)
774 * was not used to scale the dotproduct.
776 X( J ) = X( J ) - CSUMJ
780 * Compute x(j) = x(j) / A(j,j), scaling if necessary.
782 TJJS = AB( MAIND, J )*TSCAL
789 IF( TJJ.GT.SMLNUM ) THEN
791 * abs(A(j,j)) > SMLNUM:
793 IF( TJJ.LT.ONE ) THEN
794 IF( XJ.GT.TJJ*BIGNUM ) THEN
796 * Scale X by 1/abs(x(j)).
799 CALL ZDSCAL( N, REC, X, 1 )
804 X( J ) = ZLADIV( X( J ), TJJS )
805 ELSE IF( TJJ.GT.ZERO ) THEN
807 * 0 < abs(A(j,j)) <= SMLNUM:
809 IF( XJ.GT.TJJ*BIGNUM ) THEN
811 * Scale x by (1/abs(x(j)))*abs(A(j,j))*BIGNUM.
813 REC = ( TJJ*BIGNUM ) / XJ
814 CALL ZDSCAL( N, REC, X, 1 )
818 X( J ) = ZLADIV( X( J ), TJJS )
821 * A(j,j) = 0: Set x(1:n) = 0, x(j) = 1, and
822 * scale = 0 and compute a solution to A**T *x = 0.
834 * Compute x(j) := x(j) / A(j,j) - CSUMJ if the dot
835 * product has already been divided by 1/A(j,j).
837 X( J ) = ZLADIV( X( J ), TJJS ) - CSUMJ
839 XMAX = MAX( XMAX, CABS1( X( J ) ) )
846 DO 220 J = JFIRST, JLAST, JINC
848 * Compute x(j) = b(j) - sum A(k,j)*x(k).
853 REC = ONE / MAX( XMAX, ONE )
854 IF( CNORM( J ).GT.( BIGNUM-XJ )*REC ) THEN
856 * If x(j) could overflow, scale x by 1/(2*XMAX).
860 TJJS = DCONJG( AB( MAIND, J ) )*TSCAL
865 IF( TJJ.GT.ONE ) THEN
867 * Divide by A(j,j) when scaling x if A(j,j) > 1.
869 REC = MIN( ONE, REC*TJJ )
870 USCAL = ZLADIV( USCAL, TJJS )
872 IF( REC.LT.ONE ) THEN
873 CALL ZDSCAL( N, REC, X, 1 )
880 IF( USCAL.EQ.DCMPLX( ONE ) ) THEN
882 * If the scaling needed for A in the dot product is 1,
883 * call ZDOTC to perform the dot product.
886 JLEN = MIN( KD, J-1 )
887 CSUMJ = ZDOTC( JLEN, AB( KD+1-JLEN, J ), 1,
890 JLEN = MIN( KD, N-J )
892 $ CSUMJ = ZDOTC( JLEN, AB( 2, J ), 1, X( J+1 ),
897 * Otherwise, use in-line code for the dot product.
900 JLEN = MIN( KD, J-1 )
902 CSUMJ = CSUMJ + ( DCONJG( AB( KD+I-JLEN, J ) )*
903 $ USCAL )*X( J-JLEN-1+I )
906 JLEN = MIN( KD, N-J )
908 CSUMJ = CSUMJ + ( DCONJG( AB( I+1, J ) )*USCAL )
914 IF( USCAL.EQ.DCMPLX( TSCAL ) ) THEN
916 * Compute x(j) := ( x(j) - CSUMJ ) / A(j,j) if 1/A(j,j)
917 * was not used to scale the dotproduct.
919 X( J ) = X( J ) - CSUMJ
923 * Compute x(j) = x(j) / A(j,j), scaling if necessary.
925 TJJS = DCONJG( AB( MAIND, J ) )*TSCAL
932 IF( TJJ.GT.SMLNUM ) THEN
934 * abs(A(j,j)) > SMLNUM:
936 IF( TJJ.LT.ONE ) THEN
937 IF( XJ.GT.TJJ*BIGNUM ) THEN
939 * Scale X by 1/abs(x(j)).
942 CALL ZDSCAL( N, REC, X, 1 )
947 X( J ) = ZLADIV( X( J ), TJJS )
948 ELSE IF( TJJ.GT.ZERO ) THEN
950 * 0 < abs(A(j,j)) <= SMLNUM:
952 IF( XJ.GT.TJJ*BIGNUM ) THEN
954 * Scale x by (1/abs(x(j)))*abs(A(j,j))*BIGNUM.
956 REC = ( TJJ*BIGNUM ) / XJ
957 CALL ZDSCAL( N, REC, X, 1 )
961 X( J ) = ZLADIV( X( J ), TJJS )
964 * A(j,j) = 0: Set x(1:n) = 0, x(j) = 1, and
965 * scale = 0 and compute a solution to A**H *x = 0.
977 * Compute x(j) := x(j) / A(j,j) - CSUMJ if the dot
978 * product has already been divided by 1/A(j,j).
980 X( J ) = ZLADIV( X( J ), TJJS ) - CSUMJ
982 XMAX = MAX( XMAX, CABS1( X( J ) ) )
985 SCALE = SCALE / TSCAL
988 * Scale the column norms by 1/TSCAL for return.
990 IF( TSCAL.NE.ONE ) THEN
991 CALL DSCAL( N, ONE / TSCAL, CNORM, 1 )