204 & ( ido, bmat, n, which, nev, np, tol, resid, mode, iupd,
205 & ishift, mxiter, v, ldv, h, ldh, ritz, bounds,
206 & q, ldq, workl, ipntr, workd, info, verbose, usrchk, unconv )
219 character bmat*1, which*2
220 integer ido, info, ishift, iupd, ldh, ldq, ldv, mxiter,
222 integer verbose, urschk, unconv
232 & bounds(nev+np), h(ldh,2), q(ldq,nev+np), resid(n),
233 & ritz(nev+np), v(ldv,nev+np), workd(3*n),
242 parameter(one = 1.0d+0, zero = 0.0d+0)
249 logical cnorm, getv0, initv, update, ushift
251 integer ierr, iter, j, kplusp, msglvl, nconv, nevbef, nev0,
252 & np0, nptemp, nevd2, nevm2, kp(3)
255 save cnorm, getv0, initv, update, ushift,
256 & iter, kplusp, msglvl, nconv, nev0, np0,
257 & rnorm, eps23, cnvchk
263 external dcopy, dgetv0, dsaitr, dscal, dsconv, dseigt, dsgets,
264 & dsapps, dsortr, dvout, ivout, second, dswap
271 & ddot, dnrm2, dlamch
272 external ddot, dnrm2, dlamch
298 eps23 = dlamch(
'Epsilon-Machine')
299 eps23 = eps23**(2.0d+0/3.0d+0)
333 if (info .ne. 0)
then
354 call dgetv0(ido, bmat, 1, initv, n, 1, v, ldv, resid, rnorm,
355 & ipntr, workd, info)
357 if (ido .ne. 99) go to 9000
359 if (rnorm .eq. zero)
then
395 if (cnvchk) go to 110
401 call dsaitr(ido, bmat, n, 0, nev0, mode, resid, rnorm, v, ldv,
402 & h, ldh, ipntr, workd, info)
409 if (ido .ne. 99) go to 9000
411 if (info .gt. 0)
then
437 if (verbose .gt. 0)
then
438 write(*,*)
' Iteration ',iter,
439 &
' - Number of converged eigenvalues ',nconv
442 if (msglvl .gt. 0)
then
443 call ivout(logfil, 1, iter, ndigit,
444 &
'_saup2: **** Start of major iteration number ****')
446 if (msglvl .gt. 1)
then
447 call ivout(logfil, 1, nev, ndigit,
448 &
'_saup2: The length of the current Lanczos factorization')
449 call ivout(logfil, 1, np, ndigit,
450 &
'_saup2: Extend the Lanczos factorization by')
461 call dsaitr(ido, bmat, n, nev, np, mode, resid, rnorm, v,
462 & ldv, h, ldh, ipntr, workd, info)
469 if (ido .ne. 99) go to 9000
471 if (info .gt. 0)
then
486 if (msglvl .gt. 1)
then
487 call dvout(logfil, 1, rnorm, ndigit,
488 &
'_saup2: Current B-norm of residual for factorization')
496 call dseigt(rnorm, kplusp, h, ldh, ritz, bounds, workl, ierr)
498 if (ierr .ne. 0)
then
508 call dcopy(kplusp, ritz, 1, workl(kplusp+1), 1)
509 call dcopy(kplusp, bounds, 1, workl(2*kplusp+1), 1)
523 call dsgets(ishift, which, nev, np, ritz, bounds, workl)
529 call dcopy(nev, bounds(np+1), 1, workl(np+1), 1)
530 if (usrchk .eq. zero)
then
531 call dsconv(nev, ritz(np+1), workl(np+1), tol, nconv)
550 if (usrchk .ne. zero)
then
555 if (msglvl .gt. 2)
then
559 call ivout(logfil, 3, kp, ndigit,
560 &
'_saup2: NEV, NP, NCONV are')
561 call dvout(logfil, kplusp, ritz, ndigit,
562 &
'_saup2: The eigenvalues of H')
563 call dvout(logfil, kplusp, bounds, ndigit,
564 &
'_saup2: Ritz estimates of the current NCV Ritz values')
579 if (bounds(j) .eq. zero)
then
585 if ( (nconv .ge. nev0) .or.
586 & (iter .gt. mxiter) .or.
597 if (which .eq.
'BE')
then
609 call dsortr(wprime, .true., kplusp, ritz, bounds)
612 if ( nev .gt. 1 )
then
613 call dswap( min(nevd2,np), ritz(nevm2+1), 1,
614 & ritz( max(kplusp-nevd2+1,kplusp-np+1) ), 1)
615 call dswap( min(nevd2,np), bounds(nevm2+1), 1,
616 & bounds( max(kplusp-nevd2+1,kplusp-np+1)), 1)
630 if (which .eq.
'LM') wprime =
'SM'
631 if (which .eq.
'SM') wprime =
'LM'
632 if (which .eq.
'LA') wprime =
'SA'
633 if (which .eq.
'SA') wprime =
'LA'
635 call dsortr(wprime, .true., kplusp, ritz, bounds)
645 temp = max( eps23, abs(ritz(j)) )
646 bounds(j) = bounds(j)/temp
657 call dsortr(wprime, .true., nev0, bounds, ritz)
665 temp = max( eps23, abs(ritz(j)) )
666 bounds(j) = bounds(j)*temp
676 if (which .eq.
'BE')
then
685 call dsortr(wprime, .true., nconv, ritz, bounds)
696 call dsortr(which, .true., nconv, ritz, bounds)
707 if (msglvl .gt. 1)
then
708 call dvout(logfil, kplusp, ritz, ndigit,
709 &
'_saup2: Sorted Ritz values.')
710 call dvout(logfil, kplusp, bounds, ndigit,
711 &
'_saup2: Sorted ritz estimates.')
718 if (iter .gt. mxiter .and. nconv .lt. nev) info = 1
724 if (np .eq. 0 .and. nconv .lt. nev0) info = 2
729 else if (nconv .lt. nev .and. ishift .eq. 1)
then
738 nev = nev + min(nconv, np/2)
739 if (nev .eq. 1 .and. kplusp .ge. 6)
then
741 else if (nev .eq. 1 .and. kplusp .gt. 2)
then
752 & call dsgets(ishift, which, nev, np, ritz, bounds,
757 if (msglvl .gt. 0)
then
758 call ivout(logfil, 1, nconv, ndigit,
759 &
'_saup2: no. of "converged" Ritz values at this iter.')
760 if (msglvl .gt. 1)
then
763 call ivout(logfil, 2, kp, ndigit,
764 &
'_saup2: NEV and NP are')
765 call dvout(logfil, nev, ritz(np+1), ndigit,
766 &
'_saup2: "wanted" Ritz values.')
767 call dvout(logfil, nev, bounds(np+1), ndigit,
768 &
'_saup2: Ritz estimates of the "wanted" values ')
773 if (ishift .eq. 0)
then
803 if (ishift .eq. 0) call dcopy(np, workl, 1, ritz, 1)
805 if (msglvl .gt. 2)
then
806 call ivout(logfil, 1, np, ndigit,
807 &
'_saup2: The number of shifts to apply ')
808 call dvout(logfil, np, workl, ndigit,
809 &
'_saup2: shifts selected')
810 if (ishift .eq. 1)
then
811 call dvout(logfil, np, bounds, ndigit,
812 &
'_saup2: corresponding Ritz estimates')
824 call dsapps(n, nev, np, ritz, v, ldv, h, ldh, resid, q, ldq,
835 if (bmat .eq.
'G')
then
837 call dcopy(n, resid, 1, workd(n+1), 1)
847 else if (bmat .eq.
'I')
then
848 call dcopy(n, resid, 1, workd, 1)
858 if (bmat .eq.
'G')
then
860 tmvbx = tmvbx + (t3 - t2)
863 if (bmat .eq.
'G')
then
864 rnorm = ddot(n, resid, 1, workd, 1)
865 rnorm = sqrt(abs(rnorm))
866 else if (bmat .eq.
'I')
then
867 rnorm = dnrm2(n, resid, 1)
872 if (msglvl .gt. 2)
then
873 call dvout(logfil, 1, rnorm, ndigit,
874 &
'_saup2: B-norm of residual for NEV factorization')
875 call dvout(logfil, nev, h(1,2), ndigit,
876 &
'_saup2: main diagonal of compressed H matrix')
877 call dvout(logfil, nev-1, h(2,1), ndigit,
878 &
'_saup2: subdiagonal of compressed H matrix')