2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496 REAL ZERO, ONE
2497 parameter( zero = 0.0, one = 1.0 )
2498 REAL ROGUE
2499 parameter( rogue = -1.0e10 )
2500
2501 REAL TRANSL
2502 INTEGER LDA, M, N, NMAX
2503 LOGICAL RESET
2504 CHARACTER*1 DIAG, UPLO
2505 CHARACTER*2 TYPE
2506
2507 REAL A( NMAX, * ), AA( * )
2508
2509 INTEGER I, IBEG, IEND, J
2510 LOGICAL GEN, LOWER, SYM, TRI, UNIT, UPPER
2511
2512 REAL SBEG
2514
2515 gen = type.EQ.'GE'
2516 sym = type.EQ.'SY'
2517 tri = type.EQ.'TR'
2518 upper = ( sym.OR.tri ).AND.uplo.EQ.'U'
2519 lower = ( sym.OR.tri ).AND.uplo.EQ.'L'
2520 unit = tri.AND.diag.EQ.'U'
2521
2522
2523
2524 DO 20 j = 1, n
2525 DO 10 i = 1, m
2526 IF( gen.OR.( upper.AND.i.LE.j ).OR.( lower.AND.i.GE.j ) )
2527 $ THEN
2528 a( i, j ) =
sbeg( reset ) + transl
2529 IF( i.NE.j )THEN
2530
2531 IF( n.GT.3.AND.j.EQ.n/2 )
2532 $ a( i, j ) = zero
2533 IF( sym )THEN
2534 a( j, i ) = a( i, j )
2535 ELSE IF( tri )THEN
2536 a( j, i ) = zero
2537 END IF
2538 END IF
2539 END IF
2540 10 CONTINUE
2541 IF( tri )
2542 $ a( j, j ) = a( j, j ) + one
2543 IF( unit )
2544 $ a( j, j ) = one
2545 20 CONTINUE
2546
2547
2548
2549 IF( type.EQ.'GE' )THEN
2550 DO 50 j = 1, n
2551 DO 30 i = 1, m
2552 aa( i + ( j - 1 )*lda ) = a( i, j )
2553 30 CONTINUE
2554 DO 40 i = m + 1, lda
2555 aa( i + ( j - 1 )*lda ) = rogue
2556 40 CONTINUE
2557 50 CONTINUE
2558 ELSE IF( type.EQ.'SY'.OR.type.EQ.'TR' )THEN
2559 DO 90 j = 1, n
2560 IF( upper )THEN
2561 ibeg = 1
2562 IF( unit )THEN
2563 iend = j - 1
2564 ELSE
2565 iend = j
2566 END IF
2567 ELSE
2568 IF( unit )THEN
2569 ibeg = j + 1
2570 ELSE
2571 ibeg = j
2572 END IF
2573 iend = n
2574 END IF
2575 DO 60 i = 1, ibeg - 1
2576 aa( i + ( j - 1 )*lda ) = rogue
2577 60 CONTINUE
2578 DO 70 i = ibeg, iend
2579 aa( i + ( j - 1 )*lda ) = a( i, j )
2580 70 CONTINUE
2581 DO 80 i = iend + 1, lda
2582 aa( i + ( j - 1 )*lda ) = rogue
2583 80 CONTINUE
2584 90 CONTINUE
2585 END IF
2586 RETURN
2587
2588
2589
real function sbeg(reset)