173 SUBROUTINE slatm4( ITYPE, N, NZ1, NZ2, ISIGN, AMAGN, RCOND,
174 $ TRIANG, IDIST, ISEED, A, LDA )
181 INTEGER IDIST, ISIGN, ITYPE, LDA, N, NZ1, NZ2
182 REAL AMAGN, RCOND, TRIANG
193 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0 )
195 parameter( half = one / two )
198 INTEGER I, IOFF, ISDB, ISDE, JC, JD, JR, K, KBEG, KEND,
200 REAL ALPHA, CL, CR, SAFMIN, SL, SR, SV1, SV2, TEMP
203 REAL SLAMCH, SLARAN, SLARND
204 EXTERNAL slamch, slaran, slarnd
210 INTRINSIC abs, exp, log, max, min, mod, real, sqrt
216 CALL slaset(
'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 ) = real( 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 / real( klen-1 ) )
307 a( nz1+i, nz1+i ) = alpha**real( i-1 )
315 a( kbeg, kbeg ) = one
317 alpha = ( one-rcond ) / real( klen-1 )
319 a( nz1+i, nz1+i ) = real( klen-i )*alpha + rcond
328 DO 190 jd = kbeg, kend
329 a( jd, jd ) = exp( alpha*slaran( iseed ) )
336 DO 210 jd = kbeg, kend
337 a( jd, jd ) = slarnd( idist, iseed )
344 DO 230 jd = kbeg, kend
345 a( jd, jd ) = amagn*real( a( jd, jd ) )
347 DO 240 jd = isdb, isde
348 a( jd+1, jd ) = amagn*real( a( jd+1, jd ) )
354 IF( isign.GT.0 )
THEN
355 DO 250 jd = kbeg, kend
356 IF( real( a( jd, jd ) ).NE.zero )
THEN
357 IF( slaran( iseed ).GT.half )
358 $ a( jd, jd ) = -a( jd, jd )
361 DO 260 jd = isdb, isde
362 IF( real( a( jd+1, jd ) ).NE.zero )
THEN
363 IF( slaran( 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 = slamch(
'S' )
389 DO 290 jd = kbeg, kend - 1, 2
390 IF( slaran( iseed ).GT.half )
THEN
394 cl = two*slaran( iseed ) - one
395 sl = two*slaran( iseed ) - one
396 temp = one / max( safmin, sqrt( cl**2+sl**2 ) )
402 cr = two*slaran( iseed ) - one
403 sr = two*slaran( 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*slarnd( idist, iseed )
436 DO 310 jr = 1, jc - ioff
437 a( jr, jc ) = triang*slarnd( idist, iseed )
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.
subroutine slatm4(itype, n, nz1, nz2, isign, amagn, rcond, triang, idist, iseed, a, lda)
SLATM4