- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I'm using some VML routines (for calculating things including the normal cdf, inverse normal cdf). I'd like to call these from functions/subroutines declared as pure. If I change the respective interface block to include the pure keyword, my code compiles and executes as expected. Is this safe? Thanks.
Link kopiert
3 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hello,
How do you change the function declaration by adding pure? For example, for the following function, virngpoisson( method, stream, n, r, lambda )
Only the output vector, and stream may be changed after the function call. It has no other side effect. If they are taken as the output value, it is fine to define the subroutine as pure.
Thanks,
Chao
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I haven't used the routine you mentioned, but for one I have (to compute normal cdf), I just add the following interface in my (pure) subroutine which calls this.
Is this OK?
[fortran]interface
pure subroutine vdcdfnorm(n,a,r)
integer,intent(in) :: n
real(kind=8),intent(in) :: a(n)
real(kind=8),intent(out) :: r(n)
end subroutine
end interface[/fortran] Is this OK?
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hello,
It is fine for this one. r is the only output forthis function.
Thanks,
Chao
It is fine for this one. r is the only output forthis function.
Thanks,
Chao
Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite