     Next: Post Processing for Eigenvalues Up: An Example for a Previous: An Example for a

## The Reverse Communication Interface

The easiest way to describe the reverse communication interface is through the example code segment shown in Figure 2.2. Once storage has been declared and the input parameters initialized, the reverse communication loop (Fig. 2.2) is entered and repeated calls to dsaupd are made. On return the parameter ido will indicate the action to be taken. In this simple example, the only action taken is a matrix-vector product (see call av in the code segment of Figure 2.2). The more sophisticated shift-invert computational modes require more complicated actions but the basic idea remains the same.

 1|cPARAMETER 1c|DESCRIPTION 1|c 1c| ido Reverse communication flag. nev The number of requested eigenvalues to compute. ncv The number of Lanczos basis vectors to use through the course of the computation. bmat Indicates whether the problem is standard bmat = I' or generalized (bmat = G'). which Specifies which eigenvalues of are to be computed. tol Specifies the relative accuracy to which eigenvalues are to be computed. iparam Specifies the computational mode, number of IRAM iterations, the implicit shift strategy, and outputs various informational parameters upon completion of IRAM.

  c c %------------------------------------------------% c | M A I N L O O P (Reverse communication loop) | c %------------------------------------------------% c 10 continue c c %---------------------------------------------% c | Repeatedly call the routine DSAUPD and take | c | actions indicated by parameter IDO until | c | either convergence is indicated or maxitr | c | has been exceeded. | c %---------------------------------------------% c call dsaupd ( ido, bmat, n, which, nev, tol, resid, & ncv, v, ldv, iparam, ipntr, workd, & workl, lworkl, info ) c if (ido .eq. -1 .or. ido .eq. 1) then c c %--------------------------------------% c | Perform matrix-vector multiplication | c | y <--- OP*x | c | The user should supply his/her own | c | matrix-vector multiplication routine | c | here that takes workd(ipntr(1)) as | c | the input, and return the result to | c | workd(ipntr(2)). | c %--------------------------------------% c call av (nx, workd(ipntr(1)), workd(ipntr(2))) c c %-----------------------------------------% c | L O O P B A C K to call DSAUPD again. | c %-----------------------------------------% c go to 10 c end if     Next: Post Processing for Eigenvalues Up: An Example for a Previous: An Example for a
Chao Yang
11/7/1997