1 *> \brief \b DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DLASCL + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlascl.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlascl.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlascl.f">
21 * SUBROUTINE DLASCL( TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO )
23 * .. Scalar Arguments ..
25 * INTEGER INFO, KL, KU, LDA, M, N
26 * DOUBLE PRECISION CFROM, CTO
28 * .. Array Arguments ..
29 * DOUBLE PRECISION A( LDA, * )
38 *> DLASCL multiplies the M by N real matrix A by the real scalar
39 *> CTO/CFROM. This is done without over/underflow as long as the final
40 *> result CTO*A(I,J)/CFROM does not over/underflow. TYPE specifies that
41 *> A may be full, upper triangular, lower triangular, upper Hessenberg,
50 *> TYPE is CHARACTER*1
51 *> TYPE indices the storage type of the input matrix.
52 *> = 'G': A is a full matrix.
53 *> = 'L': A is a lower triangular matrix.
54 *> = 'U': A is an upper triangular matrix.
55 *> = 'H': A is an upper Hessenberg matrix.
56 *> = 'B': A is a symmetric band matrix with lower bandwidth KL
57 *> and upper bandwidth KU and with the only the lower
59 *> = 'Q': A is a symmetric band matrix with lower bandwidth KL
60 *> and upper bandwidth KU and with the only the upper
62 *> = 'Z': A is a band matrix with lower bandwidth KL and upper
63 *> bandwidth KU. See DGBTRF for storage details.
69 *> The lower bandwidth of A. Referenced only if TYPE = 'B',
76 *> The upper bandwidth of A. Referenced only if TYPE = 'B',
82 *> CFROM is DOUBLE PRECISION
87 *> CTO is DOUBLE PRECISION
89 *> The matrix A is multiplied by CTO/CFROM. A(I,J) is computed
90 *> without over/underflow if the final result CTO*A(I,J)/CFROM
91 *> can be represented without over/underflow. CFROM must be
98 *> The number of rows of the matrix A. M >= 0.
104 *> The number of columns of the matrix A. N >= 0.
109 *> A is DOUBLE PRECISION array, dimension (LDA,N)
110 *> The matrix to be multiplied by CTO/CFROM. See TYPE for the
117 *> The leading dimension of the array A. LDA >= max(1,M).
123 *> 0 - successful exit
124 *> <0 - if INFO = -i, the i-th argument had an illegal value.
130 *> \author Univ. of Tennessee
131 *> \author Univ. of California Berkeley
132 *> \author Univ. of Colorado Denver
135 *> \date September 2012
137 *> \ingroup auxOTHERauxiliary
139 * =====================================================================
140 SUBROUTINE DLASCL( TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO )
142 * -- LAPACK auxiliary routine (version 3.4.2) --
143 * -- LAPACK is a software package provided by Univ. of Tennessee, --
144 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
147 * .. Scalar Arguments ..
149 INTEGER INFO, KL, KU, LDA, M, N
150 DOUBLE PRECISION CFROM, CTO
152 * .. Array Arguments ..
153 DOUBLE PRECISION A( LDA, * )
156 * =====================================================================
159 DOUBLE PRECISION ZERO, ONE
160 PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
162 * .. Local Scalars ..
164 INTEGER I, ITYPE, J, K1, K2, K3, K4
165 DOUBLE PRECISION BIGNUM, CFROM1, CFROMC, CTO1, CTOC, MUL, SMLNUM
167 * .. External Functions ..
168 LOGICAL LSAME, DISNAN
169 DOUBLE PRECISION DLAMCH
170 EXTERNAL LSAME, DLAMCH, DISNAN
172 * .. Intrinsic Functions ..
173 INTRINSIC ABS, MAX, MIN
175 * .. External Subroutines ..
178 * .. Executable Statements ..
180 * Test the input arguments
184 IF( LSAME( TYPE, 'G' ) ) THEN
186 ELSE IF( LSAME( TYPE, 'L' ) ) THEN
188 ELSE IF( LSAME( TYPE, 'U' ) ) THEN
190 ELSE IF( LSAME( TYPE, 'H' ) ) THEN
192 ELSE IF( LSAME( TYPE, 'B' ) ) THEN
194 ELSE IF( LSAME( TYPE, 'Q' ) ) THEN
196 ELSE IF( LSAME( TYPE, 'Z' ) ) THEN
202 IF( ITYPE.EQ.-1 ) THEN
204 ELSE IF( CFROM.EQ.ZERO .OR. DISNAN(CFROM) ) THEN
206 ELSE IF( DISNAN(CTO) ) THEN
208 ELSE IF( M.LT.0 ) THEN
210 ELSE IF( N.LT.0 .OR. ( ITYPE.EQ.4 .AND. N.NE.M ) .OR.
211 $ ( ITYPE.EQ.5 .AND. N.NE.M ) ) THEN
213 ELSE IF( ITYPE.LE.3 .AND. LDA.LT.MAX( 1, M ) ) THEN
215 ELSE IF( ITYPE.GE.4 ) THEN
216 IF( KL.LT.0 .OR. KL.GT.MAX( M-1, 0 ) ) THEN
218 ELSE IF( KU.LT.0 .OR. KU.GT.MAX( N-1, 0 ) .OR.
219 $ ( ( ITYPE.EQ.4 .OR. ITYPE.EQ.5 ) .AND. KL.NE.KU ) )
222 ELSE IF( ( ITYPE.EQ.4 .AND. LDA.LT.KL+1 ) .OR.
223 $ ( ITYPE.EQ.5 .AND. LDA.LT.KU+1 ) .OR.
224 $ ( ITYPE.EQ.6 .AND. LDA.LT.2*KL+KU+1 ) ) THEN
230 CALL XERBLA( 'DLASCL', -INFO )
234 * Quick return if possible
236 IF( N.EQ.0 .OR. M.EQ.0 )
239 * Get machine parameters
241 SMLNUM = DLAMCH( 'S' )
242 BIGNUM = ONE / SMLNUM
248 CFROM1 = CFROMC*SMLNUM
249 IF( CFROM1.EQ.CFROMC ) THEN
250 ! CFROMC is an inf. Multiply by a correctly signed zero for
251 ! finite CTOC, or a NaN if CTOC is infinite.
257 IF( CTO1.EQ.CTOC ) THEN
258 ! CTOC is either 0 or an inf. In both cases, CTOC itself
259 ! serves as the correct multiplication factor.
263 ELSE IF( ABS( CFROM1 ).GT.ABS( CTOC ) .AND. CTOC.NE.ZERO ) THEN
267 ELSE IF( ABS( CTO1 ).GT.ABS( CFROMC ) ) THEN
277 IF( ITYPE.EQ.0 ) THEN
283 A( I, J ) = A( I, J )*MUL
287 ELSE IF( ITYPE.EQ.1 ) THEN
289 * Lower triangular matrix
293 A( I, J ) = A( I, J )*MUL
297 ELSE IF( ITYPE.EQ.2 ) THEN
299 * Upper triangular matrix
302 DO 60 I = 1, MIN( J, M )
303 A( I, J ) = A( I, J )*MUL
307 ELSE IF( ITYPE.EQ.3 ) THEN
309 * Upper Hessenberg matrix
312 DO 80 I = 1, MIN( J+1, M )
313 A( I, J ) = A( I, J )*MUL
317 ELSE IF( ITYPE.EQ.4 ) THEN
319 * Lower half of a symmetric band matrix
324 DO 100 I = 1, MIN( K3, K4-J )
325 A( I, J ) = A( I, J )*MUL
329 ELSE IF( ITYPE.EQ.5 ) THEN
331 * Upper half of a symmetric band matrix
336 DO 120 I = MAX( K1-J, 1 ), K3
337 A( I, J ) = A( I, J )*MUL
341 ELSE IF( ITYPE.EQ.6 ) THEN
350 DO 140 I = MAX( K1-J, K2 ), MIN( K3, K4-J )
351 A( I, J ) = A( I, J )*MUL