00001 DOUBLE PRECISION FUNCTION DLANSF( NORM, TRANSR, UPLO, N, A, WORK )
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 CHARACTER NORM, TRANSR, UPLO
00013 INTEGER N
00014
00015
00016 DOUBLE PRECISION A( 0: * ), WORK( 0: * )
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167 DOUBLE PRECISION ONE, ZERO
00168 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
00169
00170
00171 INTEGER I, J, IFM, ILU, NOE, N1, K, L, LDA
00172 DOUBLE PRECISION SCALE, S, VALUE, AA
00173
00174
00175 LOGICAL LSAME
00176 INTEGER IDAMAX
00177 EXTERNAL LSAME, IDAMAX
00178
00179
00180 EXTERNAL DLASSQ
00181
00182
00183 INTRINSIC ABS, MAX, SQRT
00184
00185
00186
00187 IF( N.EQ.0 ) THEN
00188 DLANSF = ZERO
00189 RETURN
00190 END IF
00191
00192
00193
00194 NOE = 1
00195 IF( MOD( N, 2 ).EQ.0 )
00196 + NOE = 0
00197
00198
00199
00200 IFM = 1
00201 IF( LSAME( TRANSR, 'T' ) )
00202 + IFM = 0
00203
00204
00205
00206 ILU = 1
00207 IF( LSAME( UPLO, 'U' ) )
00208 + ILU = 0
00209
00210
00211
00212
00213
00214 IF( IFM.EQ.1 ) THEN
00215 IF( NOE.EQ.1 ) THEN
00216 LDA = N
00217 ELSE
00218
00219 LDA = N + 1
00220 END IF
00221 ELSE
00222
00223 LDA = ( N+1 ) / 2
00224 END IF
00225
00226 IF( LSAME( NORM, 'M' ) ) THEN
00227
00228
00229
00230 K = ( N+1 ) / 2
00231 VALUE = ZERO
00232 IF( NOE.EQ.1 ) THEN
00233
00234 IF( IFM.EQ.1 ) THEN
00235
00236 DO J = 0, K - 1
00237 DO I = 0, N - 1
00238 VALUE = MAX( VALUE, ABS( A( I+J*LDA ) ) )
00239 END DO
00240 END DO
00241 ELSE
00242
00243 DO J = 0, N - 1
00244 DO I = 0, K - 1
00245 VALUE = MAX( VALUE, ABS( A( I+J*LDA ) ) )
00246 END DO
00247 END DO
00248 END IF
00249 ELSE
00250
00251 IF( IFM.EQ.1 ) THEN
00252
00253 DO J = 0, K - 1
00254 DO I = 0, N
00255 VALUE = MAX( VALUE, ABS( A( I+J*LDA ) ) )
00256 END DO
00257 END DO
00258 ELSE
00259
00260 DO J = 0, N
00261 DO I = 0, K - 1
00262 VALUE = MAX( VALUE, ABS( A( I+J*LDA ) ) )
00263 END DO
00264 END DO
00265 END IF
00266 END IF
00267 ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
00268 + ( NORM.EQ.'1' ) ) THEN
00269
00270
00271
00272 IF( IFM.EQ.1 ) THEN
00273 K = N / 2
00274 IF( NOE.EQ.1 ) THEN
00275
00276 IF( ILU.EQ.0 ) THEN
00277 DO I = 0, K - 1
00278 WORK( I ) = ZERO
00279 END DO
00280 DO J = 0, K
00281 S = ZERO
00282 DO I = 0, K + J - 1
00283 AA = ABS( A( I+J*LDA ) )
00284
00285 S = S + AA
00286 WORK( I ) = WORK( I ) + AA
00287 END DO
00288 AA = ABS( A( I+J*LDA ) )
00289
00290 WORK( J+K ) = S + AA
00291 IF( I.EQ.K+K )
00292 + GO TO 10
00293 I = I + 1
00294 AA = ABS( A( I+J*LDA ) )
00295
00296 WORK( J ) = WORK( J ) + AA
00297 S = ZERO
00298 DO L = J + 1, K - 1
00299 I = I + 1
00300 AA = ABS( A( I+J*LDA ) )
00301
00302 S = S + AA
00303 WORK( L ) = WORK( L ) + AA
00304 END DO
00305 WORK( J ) = WORK( J ) + S
00306 END DO
00307 10 CONTINUE
00308 I = IDAMAX( N, WORK, 1 )
00309 VALUE = WORK( I-1 )
00310 ELSE
00311
00312 K = K + 1
00313
00314 DO I = K, N - 1
00315 WORK( I ) = ZERO
00316 END DO
00317 DO J = K - 1, 0, -1
00318 S = ZERO
00319 DO I = 0, J - 2
00320 AA = ABS( A( I+J*LDA ) )
00321
00322 S = S + AA
00323 WORK( I+K ) = WORK( I+K ) + AA
00324 END DO
00325 IF( J.GT.0 ) THEN
00326 AA = ABS( A( I+J*LDA ) )
00327
00328 S = S + AA
00329 WORK( I+K ) = WORK( I+K ) + S
00330
00331 I = I + 1
00332 END IF
00333 AA = ABS( A( I+J*LDA ) )
00334
00335 WORK( J ) = AA
00336 S = ZERO
00337 DO L = J + 1, N - 1
00338 I = I + 1
00339 AA = ABS( A( I+J*LDA ) )
00340
00341 S = S + AA
00342 WORK( L ) = WORK( L ) + AA
00343 END DO
00344 WORK( J ) = WORK( J ) + S
00345 END DO
00346 I = IDAMAX( N, WORK, 1 )
00347 VALUE = WORK( I-1 )
00348 END IF
00349 ELSE
00350
00351 IF( ILU.EQ.0 ) THEN
00352 DO I = 0, K - 1
00353 WORK( I ) = ZERO
00354 END DO
00355 DO J = 0, K - 1
00356 S = ZERO
00357 DO I = 0, K + J - 1
00358 AA = ABS( A( I+J*LDA ) )
00359
00360 S = S + AA
00361 WORK( I ) = WORK( I ) + AA
00362 END DO
00363 AA = ABS( A( I+J*LDA ) )
00364
00365 WORK( J+K ) = S + AA
00366 I = I + 1
00367 AA = ABS( A( I+J*LDA ) )
00368
00369 WORK( J ) = WORK( J ) + AA
00370 S = ZERO
00371 DO L = J + 1, K - 1
00372 I = I + 1
00373 AA = ABS( A( I+J*LDA ) )
00374
00375 S = S + AA
00376 WORK( L ) = WORK( L ) + AA
00377 END DO
00378 WORK( J ) = WORK( J ) + S
00379 END DO
00380 I = IDAMAX( N, WORK, 1 )
00381 VALUE = WORK( I-1 )
00382 ELSE
00383
00384 DO I = K, N - 1
00385 WORK( I ) = ZERO
00386 END DO
00387 DO J = K - 1, 0, -1
00388 S = ZERO
00389 DO I = 0, J - 1
00390 AA = ABS( A( I+J*LDA ) )
00391
00392 S = S + AA
00393 WORK( I+K ) = WORK( I+K ) + AA
00394 END DO
00395 AA = ABS( A( I+J*LDA ) )
00396
00397 S = S + AA
00398 WORK( I+K ) = WORK( I+K ) + S
00399
00400 I = I + 1
00401 AA = ABS( A( I+J*LDA ) )
00402
00403 WORK( J ) = AA
00404 S = ZERO
00405 DO L = J + 1, N - 1
00406 I = I + 1
00407 AA = ABS( A( I+J*LDA ) )
00408
00409 S = S + AA
00410 WORK( L ) = WORK( L ) + AA
00411 END DO
00412 WORK( J ) = WORK( J ) + S
00413 END DO
00414 I = IDAMAX( N, WORK, 1 )
00415 VALUE = WORK( I-1 )
00416 END IF
00417 END IF
00418 ELSE
00419
00420 K = N / 2
00421 IF( NOE.EQ.1 ) THEN
00422
00423 IF( ILU.EQ.0 ) THEN
00424 N1 = K
00425
00426 K = K + 1
00427
00428 DO I = N1, N - 1
00429 WORK( I ) = ZERO
00430 END DO
00431 DO J = 0, N1 - 1
00432 S = ZERO
00433 DO I = 0, K - 1
00434 AA = ABS( A( I+J*LDA ) )
00435
00436 WORK( I+N1 ) = WORK( I+N1 ) + AA
00437 S = S + AA
00438 END DO
00439 WORK( J ) = S
00440 END DO
00441
00442 S = ABS( A( 0+J*LDA ) )
00443
00444 DO I = 1, K - 1
00445 AA = ABS( A( I+J*LDA ) )
00446
00447 WORK( I+N1 ) = WORK( I+N1 ) + AA
00448 S = S + AA
00449 END DO
00450 WORK( J ) = WORK( J ) + S
00451 DO J = K, N - 1
00452 S = ZERO
00453 DO I = 0, J - K - 1
00454 AA = ABS( A( I+J*LDA ) )
00455
00456 WORK( I ) = WORK( I ) + AA
00457 S = S + AA
00458 END DO
00459
00460 AA = ABS( A( I+J*LDA ) )
00461
00462 S = S + AA
00463 WORK( J-K ) = WORK( J-K ) + S
00464 I = I + 1
00465 S = ABS( A( I+J*LDA ) )
00466
00467 DO L = J + 1, N - 1
00468 I = I + 1
00469 AA = ABS( A( I+J*LDA ) )
00470
00471 WORK( L ) = WORK( L ) + AA
00472 S = S + AA
00473 END DO
00474 WORK( J ) = WORK( J ) + S
00475 END DO
00476 I = IDAMAX( N, WORK, 1 )
00477 VALUE = WORK( I-1 )
00478 ELSE
00479
00480 K = K + 1
00481
00482 DO I = K, N - 1
00483 WORK( I ) = ZERO
00484 END DO
00485 DO J = 0, K - 2
00486
00487 S = ZERO
00488 DO I = 0, J - 1
00489 AA = ABS( A( I+J*LDA ) )
00490
00491 WORK( I ) = WORK( I ) + AA
00492 S = S + AA
00493 END DO
00494 AA = ABS( A( I+J*LDA ) )
00495
00496 S = S + AA
00497 WORK( J ) = S
00498
00499 I = I + 1
00500
00501 AA = ABS( A( I+J*LDA ) )
00502 S = AA
00503 DO L = K + J + 1, N - 1
00504 I = I + 1
00505 AA = ABS( A( I+J*LDA ) )
00506
00507 S = S + AA
00508 WORK( L ) = WORK( L ) + AA
00509 END DO
00510 WORK( K+J ) = WORK( K+J ) + S
00511 END DO
00512
00513 S = ZERO
00514 DO I = 0, K - 2
00515 AA = ABS( A( I+J*LDA ) )
00516
00517 WORK( I ) = WORK( I ) + AA
00518 S = S + AA
00519 END DO
00520
00521 AA = ABS( A( I+J*LDA ) )
00522
00523 S = S + AA
00524 WORK( I ) = S
00525
00526 DO J = K, N - 1
00527
00528 S = ZERO
00529 DO I = 0, K - 1
00530 AA = ABS( A( I+J*LDA ) )
00531
00532 WORK( I ) = WORK( I ) + AA
00533 S = S + AA
00534 END DO
00535 WORK( J ) = WORK( J ) + S
00536 END DO
00537 I = IDAMAX( N, WORK, 1 )
00538 VALUE = WORK( I-1 )
00539 END IF
00540 ELSE
00541
00542 IF( ILU.EQ.0 ) THEN
00543 DO I = K, N - 1
00544 WORK( I ) = ZERO
00545 END DO
00546 DO J = 0, K - 1
00547 S = ZERO
00548 DO I = 0, K - 1
00549 AA = ABS( A( I+J*LDA ) )
00550
00551 WORK( I+K ) = WORK( I+K ) + AA
00552 S = S + AA
00553 END DO
00554 WORK( J ) = S
00555 END DO
00556
00557 AA = ABS( A( 0+J*LDA ) )
00558
00559 S = AA
00560 DO I = 1, K - 1
00561 AA = ABS( A( I+J*LDA ) )
00562
00563 WORK( I+K ) = WORK( I+K ) + AA
00564 S = S + AA
00565 END DO
00566 WORK( J ) = WORK( J ) + S
00567 DO J = K + 1, N - 1
00568 S = ZERO
00569 DO I = 0, J - 2 - K
00570 AA = ABS( A( I+J*LDA ) )
00571
00572 WORK( I ) = WORK( I ) + AA
00573 S = S + AA
00574 END DO
00575
00576 AA = ABS( A( I+J*LDA ) )
00577
00578 S = S + AA
00579 WORK( J-K-1 ) = WORK( J-K-1 ) + S
00580 I = I + 1
00581 AA = ABS( A( I+J*LDA ) )
00582
00583 S = AA
00584 DO L = J + 1, N - 1
00585 I = I + 1
00586 AA = ABS( A( I+J*LDA ) )
00587
00588 WORK( L ) = WORK( L ) + AA
00589 S = S + AA
00590 END DO
00591 WORK( J ) = WORK( J ) + S
00592 END DO
00593
00594 S = ZERO
00595 DO I = 0, K - 2
00596 AA = ABS( A( I+J*LDA ) )
00597
00598 WORK( I ) = WORK( I ) + AA
00599 S = S + AA
00600 END DO
00601
00602 AA = ABS( A( I+J*LDA ) )
00603
00604 S = S + AA
00605 WORK( I ) = WORK( I ) + S
00606 I = IDAMAX( N, WORK, 1 )
00607 VALUE = WORK( I-1 )
00608 ELSE
00609
00610 DO I = K, N - 1
00611 WORK( I ) = ZERO
00612 END DO
00613
00614 S = ABS( A( 0 ) )
00615
00616 DO I = 1, K - 1
00617 AA = ABS( A( I ) )
00618
00619 WORK( I+K ) = WORK( I+K ) + AA
00620 S = S + AA
00621 END DO
00622 WORK( K ) = WORK( K ) + S
00623 DO J = 1, K - 1
00624
00625 S = ZERO
00626 DO I = 0, J - 2
00627 AA = ABS( A( I+J*LDA ) )
00628
00629 WORK( I ) = WORK( I ) + AA
00630 S = S + AA
00631 END DO
00632 AA = ABS( A( I+J*LDA ) )
00633
00634 S = S + AA
00635 WORK( J-1 ) = S
00636
00637 I = I + 1
00638
00639 AA = ABS( A( I+J*LDA ) )
00640 S = AA
00641 DO L = K + J + 1, N - 1
00642 I = I + 1
00643 AA = ABS( A( I+J*LDA ) )
00644
00645 S = S + AA
00646 WORK( L ) = WORK( L ) + AA
00647 END DO
00648 WORK( K+J ) = WORK( K+J ) + S
00649 END DO
00650
00651 S = ZERO
00652 DO I = 0, K - 2
00653 AA = ABS( A( I+J*LDA ) )
00654
00655 WORK( I ) = WORK( I ) + AA
00656 S = S + AA
00657 END DO
00658
00659 AA = ABS( A( I+J*LDA ) )
00660
00661 S = S + AA
00662 WORK( I ) = S
00663
00664 DO J = K + 1, N
00665
00666 S = ZERO
00667 DO I = 0, K - 1
00668 AA = ABS( A( I+J*LDA ) )
00669
00670 WORK( I ) = WORK( I ) + AA
00671 S = S + AA
00672 END DO
00673 WORK( J-1 ) = WORK( J-1 ) + S
00674 END DO
00675 I = IDAMAX( N, WORK, 1 )
00676 VALUE = WORK( I-1 )
00677 END IF
00678 END IF
00679 END IF
00680 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
00681
00682
00683
00684 K = ( N+1 ) / 2
00685 SCALE = ZERO
00686 S = ONE
00687 IF( NOE.EQ.1 ) THEN
00688
00689 IF( IFM.EQ.1 ) THEN
00690
00691 IF( ILU.EQ.0 ) THEN
00692
00693 DO J = 0, K - 3
00694 CALL DLASSQ( K-J-2, A( K+J+1+J*LDA ), 1, SCALE, S )
00695
00696 END DO
00697 DO J = 0, K - 1
00698 CALL DLASSQ( K+J-1, A( 0+J*LDA ), 1, SCALE, S )
00699
00700 END DO
00701 S = S + S
00702
00703 CALL DLASSQ( K-1, A( K ), LDA+1, SCALE, S )
00704
00705 CALL DLASSQ( K, A( K-1 ), LDA+1, SCALE, S )
00706
00707 ELSE
00708
00709 DO J = 0, K - 1
00710 CALL DLASSQ( N-J-1, A( J+1+J*LDA ), 1, SCALE, S )
00711
00712 END DO
00713 DO J = 0, K - 2
00714 CALL DLASSQ( J, A( 0+( 1+J )*LDA ), 1, SCALE, S )
00715
00716 END DO
00717 S = S + S
00718
00719 CALL DLASSQ( K, A( 0 ), LDA+1, SCALE, S )
00720
00721 CALL DLASSQ( K-1, A( 0+LDA ), LDA+1, SCALE, S )
00722
00723 END IF
00724 ELSE
00725
00726 IF( ILU.EQ.0 ) THEN
00727
00728 DO J = 1, K - 2
00729 CALL DLASSQ( J, A( 0+( K+J )*LDA ), 1, SCALE, S )
00730
00731 END DO
00732 DO J = 0, K - 2
00733 CALL DLASSQ( K, A( 0+J*LDA ), 1, SCALE, S )
00734
00735 END DO
00736 DO J = 0, K - 2
00737 CALL DLASSQ( K-J-1, A( J+1+( J+K-1 )*LDA ), 1,
00738 + SCALE, S )
00739
00740 END DO
00741 S = S + S
00742
00743 CALL DLASSQ( K-1, A( 0+K*LDA ), LDA+1, SCALE, S )
00744
00745 CALL DLASSQ( K, A( 0+( K-1 )*LDA ), LDA+1, SCALE, S )
00746
00747 ELSE
00748
00749 DO J = 1, K - 1
00750 CALL DLASSQ( J, A( 0+J*LDA ), 1, SCALE, S )
00751
00752 END DO
00753 DO J = K, N - 1
00754 CALL DLASSQ( K, A( 0+J*LDA ), 1, SCALE, S )
00755
00756 END DO
00757 DO J = 0, K - 3
00758 CALL DLASSQ( K-J-2, A( J+2+J*LDA ), 1, SCALE, S )
00759
00760 END DO
00761 S = S + S
00762
00763 CALL DLASSQ( K, A( 0 ), LDA+1, SCALE, S )
00764
00765 CALL DLASSQ( K-1, A( 1 ), LDA+1, SCALE, S )
00766
00767 END IF
00768 END IF
00769 ELSE
00770
00771 IF( IFM.EQ.1 ) THEN
00772
00773 IF( ILU.EQ.0 ) THEN
00774
00775 DO J = 0, K - 2
00776 CALL DLASSQ( K-J-1, A( K+J+2+J*LDA ), 1, SCALE, S )
00777
00778 END DO
00779 DO J = 0, K - 1
00780 CALL DLASSQ( K+J, A( 0+J*LDA ), 1, SCALE, S )
00781
00782 END DO
00783 S = S + S
00784
00785 CALL DLASSQ( K, A( K+1 ), LDA+1, SCALE, S )
00786
00787 CALL DLASSQ( K, A( K ), LDA+1, SCALE, S )
00788
00789 ELSE
00790
00791 DO J = 0, K - 1
00792 CALL DLASSQ( N-J-1, A( J+2+J*LDA ), 1, SCALE, S )
00793
00794 END DO
00795 DO J = 1, K - 1
00796 CALL DLASSQ( J, A( 0+J*LDA ), 1, SCALE, S )
00797
00798 END DO
00799 S = S + S
00800
00801 CALL DLASSQ( K, A( 1 ), LDA+1, SCALE, S )
00802
00803 CALL DLASSQ( K, A( 0 ), LDA+1, SCALE, S )
00804
00805 END IF
00806 ELSE
00807
00808 IF( ILU.EQ.0 ) THEN
00809
00810 DO J = 1, K - 1
00811 CALL DLASSQ( J, A( 0+( K+1+J )*LDA ), 1, SCALE, S )
00812
00813 END DO
00814 DO J = 0, K - 1
00815 CALL DLASSQ( K, A( 0+J*LDA ), 1, SCALE, S )
00816
00817 END DO
00818 DO J = 0, K - 2
00819 CALL DLASSQ( K-J-1, A( J+1+( J+K )*LDA ), 1, SCALE,
00820 + S )
00821
00822 END DO
00823 S = S + S
00824
00825 CALL DLASSQ( K, A( 0+( K+1 )*LDA ), LDA+1, SCALE, S )
00826
00827 CALL DLASSQ( K, A( 0+K*LDA ), LDA+1, SCALE, S )
00828
00829 ELSE
00830
00831 DO J = 1, K - 1
00832 CALL DLASSQ( J, A( 0+( J+1 )*LDA ), 1, SCALE, S )
00833
00834 END DO
00835 DO J = K + 1, N
00836 CALL DLASSQ( K, A( 0+J*LDA ), 1, SCALE, S )
00837
00838 END DO
00839 DO J = 0, K - 2
00840 CALL DLASSQ( K-J-1, A( J+1+J*LDA ), 1, SCALE, S )
00841
00842 END DO
00843 S = S + S
00844
00845 CALL DLASSQ( K, A( LDA ), LDA+1, SCALE, S )
00846
00847 CALL DLASSQ( K, A( 0 ), LDA+1, SCALE, S )
00848
00849 END IF
00850 END IF
00851 END IF
00852 VALUE = SCALE*SQRT( S )
00853 END IF
00854
00855 DLANSF = VALUE
00856 RETURN
00857
00858
00859
00860 END