- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to draw random number from a normal distribution but my FORTRAN code does not work. Ireceive the following error: "unresolved external symbol vsrnggaussian referenced in function main".It is the first time that I am using the Math Kernel Library and I hope someone van help me with it. My code is as follows:
PROGRAM drawnormal
USE mkl_vsl
IMPLICIT NONE
integer status !Error / status
integer brng !Index of generator to initialize stream
integer method !Method = 0 in case of uniform distribution
integer dimen !Initial condition of the stream
TYPE (VSL_STREAM_STATE) stream !Random stream
integer, PARAMETER :: nr = 1000 !Number of values required (whatever you want)
real gauss(nr)
real mean, sigma
mean = 0.0
sigma = 1.0
!SOBEL
method = VSL_METHOD_SGAUSSIAN_ICDF !NB - are different alternatives, but I found this worked well
brng = VSL_BRNG_SOBOL
dimen = 1 ! <== different values may be needed depending on application
gauss = 0.0
status = vslnewstream( stream, brng, dimen ) !Create new stream (SOBOL in this case
status = vsrnggaussian( method, stream, nr, gauss, mean, sigma )
status = vsldeletestream( stream ) !Delete the stream
end
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From the command line, use the -Qmkl (Windows) or -mkl (Linux/OSX) compiler option for a simple program such as the above.
In an IDE, do whatever is needed to link in the MKL as an additional library. See the MKL Link Line Advisor link at the top of this forum for further guidance.
- 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