Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29559 Discussions

problem using QDNG subroutin from IMSL

yuezhanwei
Beginner
1,582 Views
Hi, I am tring to use the QDNG subroutine. I have Intel Visual Fortran composer XE with IMSL library. I have added IMSL library to the library and includ path (page 891). I got two erros even when I run the sample code from the IMSL math mannual:
1. program exception - access violation
this error occus when calling QDNG subroutine
2. Keyword arguments are invalid without an explicit interface. [ERRABS]
Keyword arguments are invalid without an explicit interface. [ERREST]
this is an error for compiling the code when I include these optional arguments.

Please help me. Thank you very much !!!

The code is below:

PROGRAM Main
INCLUDE 'link_fnl_static.h'
!DEC$ OBJCOMMENT LIB:'libiomp5md.lib'
IMPLICIT NONE
INTEGER NOUT
REAL A, ABS, B, ERRABS, ERREST, ERROR, EXACT, EXP, F, RESULT
INTRINSIC ABS, EXP
EXTERNAL F
! Get output unit number
CALL UMACH (2, NOUT)
! Set limits of integration
A = 0.0
B = 2.0
! Set error tolerances
ERRABS = 0.0
!CALL QDNG (F, A, B, RESULT) !, ERRABS=ERRABS, ERREST=ERREST)
! Print results
EXACT = 1.0 + EXP(2.0)
ERROR = ABS(RESULT-EXACT)
WRITE (NOUT,99999) RESULT, EXACT, ERREST, ERROR
99999 FORMAT (' Computed =', F8.3, 13X, ' Exact =', F8.3, /, /, &
' Error estimate =', 1PE10.3, 6X, 'Error =', 1PE10.3)
END
!
REAL FUNCTION F (X)
REAL X
REAL EXP
INTRINSIC EXP
F = X*EXP(X)
RETURN
END
0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,582 Views
You are calling the "Fortran 90" interface and therefore must add:

USE QDNG_INT

after the PROGRAM statement. You probably missed this because in the manual, this line is shown on the previous page. The example also requires the line:

USE UMACH_INT

as shown there.
0 Kudos
yuezhanwei
Beginner
1,582 Views
Thank you very much. My code now works.
0 Kudos
Reply