173 SUBROUTINE dlatm4( ITYPE, N, NZ1, NZ2, ISIGN, AMAGN, RCOND,
174 $ TRIANG, IDIST, ISEED, A, LDA )
181 INTEGER IDIST, ISIGN, ITYPE, LDA, N, NZ1, NZ2
182 DOUBLE PRECISION AMAGN, RCOND, TRIANG
186 DOUBLE PRECISION A( LDA, * )
192 DOUBLE PRECISION ZERO, ONE, TWO
193 parameter( zero = 0.0d0, one = 1.0d0, two = 2.0d0 )
194 DOUBLE PRECISION HALF
195 parameter( half = one / two )
198 INTEGER I, IOFF, ISDB, ISDE, JC, JD, JR, K, KBEG, KEND,
200 DOUBLE PRECISION ALPHA, CL, CR, SAFMIN, SL, SR, SV1, SV2, TEMP
203 DOUBLE PRECISION DLAMCH, DLARAN, DLARND
204 EXTERNAL dlamch, dlaran, dlarnd
210 INTRINSIC abs, dble, exp, log, max, min, mod, sqrt
216 CALL dlaset(
'Full', n, n, zero, zero, a, lda )
220 IF( mod( iseed( 4 ), 2 ).NE.1 )
221 $ iseed( 4 ) = iseed( 4 ) + 1
226 IF( itype.NE.0 )
THEN
227 IF( abs( itype ).GE.4 )
THEN
228 kbeg = max( 1, min( n, nz1+1 ) )
229 kend = max( kbeg, min( n, n-nz2 ) )
230 klen = kend + 1 - kbeg
238 GO TO ( 10, 30, 50, 80, 100, 120, 140, 160,
239 $ 180, 200 )abs( itype )
269 DO 70 jd = k + 2, 2*k + 1
277 DO 90 jd = kbeg, kend
278 a( jd, jd ) = dble( jd-nz1 )
285 DO 110 jd = kbeg + 1, kend
288 a( kbeg, kbeg ) = one
294 DO 130 jd = kbeg, kend - 1
297 a( kend, kend ) = rcond
303 a( kbeg, kbeg ) = one
305 alpha = rcond**( one / dble( klen-1 ) )
307 a( nz1+i, nz1+i ) = alpha**dble( i-1 )
315 a( kbeg, kbeg ) = one
317 alpha = ( one-rcond ) / dble( klen-1 )
319 a( nz1+i, nz1+i ) = dble( klen-i )*alpha + rcond
328 DO 190 jd = kbeg, kend
329 a( jd, jd ) = exp( alpha*dlaran( iseed ) )
336 DO 210 jd = kbeg, kend
337 a( jd, jd ) = dlarnd( idist, iseed )
344 DO 230 jd = kbeg, kend
345 a( jd, jd ) = amagn*dble( a( jd, jd ) )
347 DO 240 jd = isdb, isde
348 a( jd+1, jd ) = amagn*dble( a( jd+1, jd ) )
354 IF( isign.GT.0 )
THEN
355 DO 250 jd = kbeg, kend
356 IF( dble( a( jd, jd ) ).NE.zero )
THEN
357 IF( dlaran( iseed ).GT.half )
358 $ a( jd, jd ) = -a( jd, jd )
361 DO 260 jd = isdb, isde
362 IF( dble( a( jd+1, jd ) ).NE.zero )
THEN
363 IF( dlaran( iseed ).GT.half )
364 $ a( jd+1, jd ) = -a( jd+1, jd )
371 IF( itype.LT.0 )
THEN
372 DO 270 jd = kbeg, ( kbeg+kend-1 ) / 2
374 a( jd, jd ) = a( kbeg+kend-jd, kbeg+kend-jd )
375 a( kbeg+kend-jd, kbeg+kend-jd ) = temp
377 DO 280 jd = 1, ( n-1 ) / 2
379 a( jd+1, jd ) = a( n+1-jd, n-jd )
380 a( n+1-jd, n-jd ) = temp
387 IF( isign.EQ.2 .AND. itype.NE.2 .AND. itype.NE.3 )
THEN
388 safmin = dlamch(
'S' )
389 DO 290 jd = kbeg, kend - 1, 2
390 IF( dlaran( iseed ).GT.half )
THEN
394 cl = two*dlaran( iseed ) - one
395 sl = two*dlaran( iseed ) - one
396 temp = one / max( safmin, sqrt( cl**2+sl**2 ) )
402 cr = two*dlaran( iseed ) - one
403 sr = two*dlaran( iseed ) - one
404 temp = one / max( safmin, sqrt( cr**2+sr**2 ) )
411 sv2 = a( jd+1, jd+1 )
412 a( jd, jd ) = cl*cr*sv1 + sl*sr*sv2
413 a( jd+1, jd ) = -sl*cr*sv1 + cl*sr*sv2
414 a( jd, jd+1 ) = -cl*sr*sv1 + sl*cr*sv2
415 a( jd+1, jd+1 ) = sl*sr*sv1 + cl*cr*sv2
424 IF( triang.NE.zero )
THEN
425 IF( isign.NE.2 .OR. itype.EQ.2 .OR. itype.EQ.3 )
THEN
430 IF( a( jr+1, jr ).EQ.zero )
431 $ a( jr, jr+1 ) = triang*dlarnd( idist, iseed )
436 DO 310 jr = 1, jc - ioff
437 a( jr, jc ) = triang*dlarnd( idist, iseed )
subroutine dlatm4(itype, n, nz1, nz2, isign, amagn, rcond, triang, idist, iseed, a, lda)
DLATM4
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.