I find it difficult to run a program, which calls the LAPACK library routines, I know which section of or which group of routines deals with generalized eigenvalue problems in LAPACK but doesn't succeed with setting up the proper compiling with GNU gfortran compiler. Some of the compiler errors are given below for the the eigenvalue example given at the bottom.

Your help will be appreciated!

1

Error: Syntax error in argument list at (1)

main_fortran.f90:39.7:

& 'V', N, A, LDA, B, LDB,

1

Error: Invalid character in name at (1)

main_fortran.f90:40.7:

& ALPHAR, ALPHAI, BETA, SCRATCH, 1, SCRATCH, 1,

1

- Code: Select all
`PROGRAM TEST`

IMPLICIT NONE

!C

INTEGER LDA, LDB, LDWORK, M, N

PARAMETER (M = 3)

PARAMETER (N = 3)

PARAMETER (LDA = M)

PARAMETER (LDB = M)

PARAMETER (LDWORK = 8 * N)

!C

DOUBLE PRECISION A(LDA,N), ALPHAI(N), ALPHAR(N), B(LDB,N)

DOUBLE PRECISION BETA(N), SCRATCH, WORK(LDWORK)

INTEGER ICOL, INFO, IROW

!C

EXTERNAL DGEGV

INTRINSIC ABS, DCMPLX

!C

!C Initialize the arrays A and B to store the matrices A and B

!C shown below.

!C

!C 1 1 1 1 1 1

!C A = 2 1 1 B = 1 0 0

!C 1 3 1 0 1 0

!C

DATA A / 1.0D0, 2.0D0, 1.0D0, 1.0D0, 1.0D0, 3.0D0, 1.0D0, 1.0D0, 1.0D0 /

DATA B / 1.0D0, 1.0D0, 0.0D0, 1.0D0, 0.0D0, 1.0D0, 1.0D0, 0.0D0, 0.0D0 /

!C

!C Print the initial value of the arrays.

!C

PRINT 1000

PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, N)

PRINT 1020

PRINT 1010, ((B(IROW,ICOL), ICOL = 1, N), IROW = 1, N)

!C

!C Compute and print the eigenvalues.

!C

CALL DGEGV ('N' ,

& 'V', N, A, LDA, B, LDB,

& ALPHAR, ALPHAI, BETA, SCRATCH, 1, SCRATCH, 1,

& WORK, LDWORK, INFO)

IF (INFO .NE. 0) THEN

IF (INFO .LT. 0) THEN

PRINT 1030, ABS(INFO)

STOP 1

ELSE

PRINT 1040, INFO

STOP 2

END IF

END IF

PRINT 1050

PRINT 1060, (ALPHAR(IROW), ALPHAI(IROW), BETA(IROW),

& IROW = 1, M)

PRINT 1070

PRINT 1080, (DCMPLX(ALPHAR(IROW), ALPHAI(IROW)) /

& BETA(IROW), IROW = 1, M)

!C

1000 FORMAT (1X, 'A:')

1010 FORMAT (3(3X, F4.1))

1020 FORMAT (/1X, 'B:')

1030 FORMAT (1X, 'Illegal argument to DGEGV, argument #', I2)

1040 FORMAT (1X, 'Internal failure in DGEGV, INFO = ', I4)

1050 FORMAT (/1X, T6, 'ALPHA', T20, 'BETA')

1060 FORMAT (1X, '(', F5.2, ',', F5.2, ')', T19, F5.2)

1070 FORMAT (/1X, 'ALPHA / BETA')

1080 FORMAT (1X, '(', F5.2, ',', F5.2, ')')

! C

END