HP MLIB User's Guide Vol. 2 7th Ed.

Chapter 15 Sparse Eigenvalues and Eigenvectors 1015
Sample program
Sample program
As illustrated in Figure 15-3, there are many possible paths of control through
this sparse eigenvalue package. The following sample program shows one
possible path through the package, where the problem to be solved is the
ordinary eigenvalue problem Ax = λx. It is intended to demonstrate that the
package is not as difficult to use as Figure 15-3 implies.
In this example, the row and column indices and the corresponding value for
each nonzero entry of the matrix are stored in the three arrays IROW, JCOL, and
MXVALU. This example demonstrates the use of the subroutines for solving a
sparse eigenproblem when the subroutine DSEVES cannot be used. The
eigenproblem posed here is to find the 10 lowest eigenvalues of the matrix A
represented by the three arrays. Hence, this is an ordinary eigenproblem. The
code assumes that there are NNZERO nonzero entries in the matrix, which has
NEQNS rows and columns.
INTEGER*4 IROW(NNZERO),JCOL(NNZERO),WARNNG
LOGICAL*4 ORTWRN
REAL*8 DISCRP,DUMMY,VALUE
REAL*8 MXVALU(NNZERO),GLOBAL(150),EVALUE(10),EVECTR(NEQNS,10)
C
C ... INPUT THE MATRIX STRUCTURE
C
CALL DSEVIN (NEQNS,’I’,1,6,GLOBAL,IER )
IF ( IER .NE. 0 ) GO TO 8000
DO 100 K = 1, NNZERO
I = IROW(K)
J = JCOL(K)
CALL DSEVI1 (’A’,I,J,GLOBAL,IER)
IF ( IER .NE. 0 ) GO TO 8000
100 CONTINUE
CALL DSEVIF (GLOBAL,IER)
IF ( IER .NE. 0 ) GO TO 8000
C
C ... REORDER THE MATRIX
C
CALL DSEVOR (GLOBAL,IER)
IF ( IER .NE. 0 ) GO TO 8000