SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ slaneg2a()

integer function slaneg2a ( integer  n,
real, dimension( * )  dlld,
real  sigma,
real  pivmin,
integer  r 
)

Definition at line 490 of file slarrb2.f.

491*
492 IMPLICIT NONE
493*
494 INTEGER SLANEG2A
495*
496* .. Scalar Arguments ..
497 INTEGER N, R
498 REAL PIVMIN, SIGMA
499* ..
500* .. Array Arguments ..
501 REAL DLLD( * )
502*
503 REAL ZERO
504 parameter( zero = 0.0e0 )
505
506 INTEGER BLKLEN
507 parameter( blklen = 512 )
508*
509* ..
510* .. Intrinsic Functions ..
511 INTRINSIC int
512* ..
513* .. Local Scalars ..
514 INTEGER BJ, I, J, NB, NEG1, NEG2, NEGCNT, NX
515 REAL DMINUS, DPLUS, GAMMA, P, S, T, TMP, XSAV
516 LOGICAL SAWNAN
517* ..
518* .. External Functions ..
519 LOGICAL SISNAN
520 EXTERNAL sisnan
521
522 negcnt = 0
523*
524* I) upper part: L D L^T - SIGMA I = L+ D+ L+^T
525* run dstqds block-wise to avoid excessive work when NaNs occur,
526* first in chunks of size BLKLEN and then the remainder
527*
528 nb = int((r-1)/blklen)
529 nx = nb*blklen
530 s = zero
531 DO 210 bj = 1, nx, blklen
532 neg1 = 0
533 xsav = s
534 DO 21 j = bj, bj+blklen-1
535 i = 2*j
536 t = s - sigma
537 dplus = dlld( i-1 ) + t
538 IF( dplus.LT.zero ) neg1=neg1 + 1
539 s = t*dlld( i ) / dplus
540 21 CONTINUE
541 sawnan = sisnan( s )
542*
543 IF( sawnan ) THEN
544 neg1 = 0
545 s = xsav
546 DO 23 j = bj, bj+blklen-1
547 i = 2*j
548 t = s - sigma
549 dplus = dlld( i-1 ) + t
550 IF(abs(dplus).LT.pivmin)
551 $ dplus = -pivmin
552 tmp = dlld( i ) / dplus
553 IF( dplus.LT.zero )
554 $ neg1 = neg1 + 1
555 s = t*tmp
556 IF( tmp.EQ.zero ) s = dlld( i )
557 23 CONTINUE
558 END IF
559 negcnt = negcnt + neg1
560 210 CONTINUE
561*
562 neg1 = 0
563 xsav = s
564 DO 22 j = nx+1, r-1
565 i = 2*j
566 t = s - sigma
567 dplus = dlld( i-1 ) + t
568 IF( dplus.LT.zero ) neg1=neg1 + 1
569 s = t*dlld( i ) / dplus
570 22 CONTINUE
571 sawnan = sisnan( s )
572*
573 IF( sawnan ) THEN
574 neg1 = 0
575 s = xsav
576 DO 24 j = nx+1, r-1
577 i = 2*j
578 t = s - sigma
579 dplus = dlld( i-1 ) + t
580 IF(abs(dplus).LT.pivmin)
581 $ dplus = -pivmin
582 tmp = dlld( i ) / dplus
583 IF( dplus.LT.zero ) neg1=neg1+1
584 s = t*tmp
585 IF( tmp.EQ.zero ) s = dlld( i )
586 24 CONTINUE
587 ENDIF
588 negcnt = negcnt + neg1
589*
590* II) lower part: L D L^T - SIGMA I = U- D- U-^T
591*
592 nb = int((n-r)/blklen)
593 nx = n-nb*blklen
594 p = dlld( 2*n-1 ) - sigma
595 DO 230 bj = n-1, nx, -blklen
596 neg2 = 0
597 xsav = p
598 DO 25 j = bj, bj-blklen+1, -1
599 i = 2*j
600 dminus = dlld( i ) + p
601 IF( dminus.LT.zero ) neg2=neg2+1
602 tmp = p / dminus
603 p = tmp * dlld( i-1 ) - sigma
604 25 CONTINUE
605 sawnan = sisnan( p )
606*
607 IF( sawnan ) THEN
608 neg2 = 0
609 p = xsav
610 DO 27 j = bj, bj-blklen+1, -1
611 i = 2*j
612 dminus = dlld( i ) + p
613 IF(abs(dminus).LT.pivmin)
614 $ dminus = -pivmin
615 tmp = dlld( i-1 ) / dminus
616 IF( dminus.LT.zero )
617 $ neg2 = neg2 + 1
618 p = p*tmp - sigma
619 IF( tmp.EQ.zero )
620 $ p = dlld( i-1 ) - sigma
621 27 CONTINUE
622 END IF
623 negcnt = negcnt + neg2
624 230 CONTINUE
625
626 neg2 = 0
627 xsav = p
628 DO 26 j = nx-1, r, -1
629 i = 2*j
630 dminus = dlld( i ) + p
631 IF( dminus.LT.zero ) neg2=neg2+1
632 tmp = p / dminus
633 p = tmp * dlld( i-1 ) - sigma
634 26 CONTINUE
635 sawnan = sisnan( p )
636*
637 IF( sawnan ) THEN
638 neg2 = 0
639 p = xsav
640 DO 28 j = nx-1, r, -1
641 i = 2*j
642 dminus = dlld( i ) + p
643 IF(abs(dminus).LT.pivmin)
644 $ dminus = -pivmin
645 tmp = dlld( i-1 ) / dminus
646 IF( dminus.LT.zero )
647 $ neg2 = neg2 + 1
648 p = p*tmp - sigma
649 IF( tmp.EQ.zero )
650 $ p = dlld( i-1 ) - sigma
651 28 CONTINUE
652 END IF
653 negcnt = negcnt + neg2
654*
655* III) Twist index
656*
657 gamma = s + p
658 IF( gamma.LT.zero ) negcnt = negcnt+1
659
660 slaneg2a = negcnt
integer function slaneg2a(n, dlld, sigma, pivmin, r)
Definition slarrb2.f:491
Here is the call graph for this function:
Here is the caller graph for this function: