- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have IVF10.1 Professional bundled with IMSL V6.0 and MKL10.0.I'd liketo use one of the IMSL functions (specificially, the version of ASIN that takes complex arguments) within a FORALL structure to initialize a large array.
When I try to compile, I get an error message stating "Any function referenced in a forall-body-stmt must have the PURE attribute explicitly declared [ZASIN]". Fair enough. It's probably safe to assume that the library function meets this criterion, so I go to the top of my module and put in an INTERFACE block, viz.:
include 'link_fnl_static_hpc.h' use asin_int implicit noneinterface pure complex(8) function zasin(z) complex(8), intent(in) :: z end function zasinend interface
However, now when I compile I get the error message "The procedure name of the INTERFACE block conflicts with a name in the encompassing scoping unit". This goes away if I comment out "use asin_int", but then the ZASIN function seems no longer to be visible and I get a new warning message saying "This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL".
There's obviously a right way to do this. Please could you tell me what it is?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
interface asin
instead of
interface
The way you had it, the compiler thought you were calling the intrinsic asin. which does not accept complex arguments.
However, I would not be quick to assume that the function is pure. Many (if not all) of the IMSL routines have side-effects, in particular, storing an error code for later retrieval. You can probably get away with it, though.
I suppose the way I would approach it is to find module asin_int in numerical_libraries_f90.f90 in the IMSL include folder, copy it into my own source file and call it something like my_asin_int. Edit it to add PURE and then USE MY_ASIN_INT.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes indeed, "interface asin" works nicely.
In my installation I can't find any .f90 files in the "include" directory, just precompiled .mod files. If I get problems because the function isn't in fact pure I guess I'll just have to replace the FORALL block with a regular DO loop, but I'm loth to do that as it's a pretty intensive piece of code...
Thank you for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FORALL is not a loop construct and isn't necessarily going to get you better performance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
interface asin
instead of
interface
The way you had it, the compiler thought you were calling the intrinsic asin. which does not accept complex arguments.
However, I would not be quick to assume that the function is pure. Many (if not all) of the IMSL routines have side-effects, in particular, storing an error code for later retrieval. You can probably get away with it, though.
I suppose the way I would approach it is to find module asin_int in numerical_libraries_f90.f90 in the IMSL include folder, copy it into my own source file and call it something like my_asin_int. Edit it to add PURE and then USE MY_ASIN_INT.
Iused the IMSL routine NEQBF in my code like the following:
subroutine myfun
USE NEQBF_INT
.......
CALL DNEQBF(RATEEQN,X,XGUESS=XGUESS)
........
end subroutine
However, the compiler issues the following error message:
Error: Keyword arguments are invalid without an explicit interface.
According to the code innumerical_libraries_f90.f90 file, DNEQBF's interface is in NEQBF_INT. Then why I got this error message?
Do I have to copy its interface into my code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DNEQBF is a "Fortran 77" interface. You want to call NEQBF instead.
Note - this issue is not related to the rest of this thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DNEQBF is a "Fortran 77" interface. You want to call NEQBF instead.
Note - this issue is not related to the rest of this thread.
Thank you very much!
After change DNEQBF to NEQBF, the problem is solved.
It seems that the DOUBLEPRECISION routines for "Root of a System of Equations" are all with"Fortran 77 Interface"!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much!
After change DNEQBF to NEQBF, the problem is solved.
It seems that the DOUBLEPRECISION routines for "Root of a System of Equations" are all with"Fortran 77 Interface"!!!
That's one of the features of the Fortran 90 interface. The base name can be used to support automatic selection of single or double precision function. If you want to short circuit that feature, you have to use the Fortran 77 call; you can't do half and half, without a lot of extra implementation, and difficulty with documentation.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page