- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to use the routine vdrnggaussian to obtain a random vector. Here is the code I am using:
include 'mkl_vsl.fi'
include 'ERRCHECK.INC'
SUBROUTINE RandomNumber(ranval)
USE MKL_VSL_TYPE
USE MKL_VSL
!DEC$ ATTRIBUTES DLLEXPORT :: RandomNumber
!DEC$ ATTRIBUTES STDCALL :: RandomNumber
INTEGER METHOD,i, brng, seed
integer(kind=4) errcode
integer n
parameter(n=1000)
real(kind=8) ranval(n)
real(kind=8) r(n), sigma
real(kind=8) a
TYPE (VSL_STREAM_STATE) :: stream
do 20 i=1,n
r(i)=0
20 continue
brng=VSL_BRNG_MCG31
method=0
seed=777
a=0.5
sigma=0.166D+0
errcode=vslnewstream(stream,brng,seed)
call CheckVslError(errcode)
errcode = vdrnggaussian(method,stream,n,r,a,sigma)
do 10 i=1,n
ranval(i)=r(i)
10 continue
errcode=vslDeleteStream( stream );
call CheckVslError(errcode)
end
The problem is the following, I am always receivingfrom my fortran DLL the same random vector "r" ... I read the Intel MKL VSL notes pdf but could not figure out whatwas the problem.
Link Copied
- 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
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page