The reverse communication interface is one of the most important aspects of the design of ARPACK. This interface avoids having to express a matrix-vector product through a subroutine with a fixed calling sequence. This means that the user is free to choose any convenient data structure for the matrix representation. Moreover, if the matrix is not available explicitly, the user is free to express the action of the matrix on a vector through a subroutine call or a code segment. It is not necessary to conform to a fixed format for a subroutine interface and hence there is no need to communicate data through the use of COMMON .
A typical usage of this interface is illustrated with the example in
Figure 1.1. This shows a code segment of the routine
the user must write to set up the reverse communication call to the
top level ARPACK routine snaupd to solve a nonsymmetric
eigenvalue problem.
As usual, with reverse communication, control is returned to the
calling program when interaction with the matrix is required.
The action requested of the calling program is simply to perform
the task indicated by the reverse communication parameter ido
(in this case multiply the vector held in the array workd beginning
at location ipntr(1) and inserting the result into the array workd
beginning at location ipntr(2)). Note that the call to the
subroutine matvec in this code segment is simply meant to indicate
that this matrix-vector operation is taking place.
The user is free to use any available mechanism or subroutine
to accomplish this task. In particular, no specific data structure
is imposed and indeed, no explicit representation of the matrix
is even required. One only needs to supply the action of the matrix on
the specified vector.
10 continue
call snaupd (ido, bmat, n, which,...,workd,..., info)
if (ido .eq. newprod) then
call matvec ('A', n, workd(ipntr(1)), workd(ipntr(2)))
else
return
endif
go to 10