Skip to content

Commit

Permalink
Wrappers to start trying out dsfmt.
Browse files Browse the repository at this point in the history
  • Loading branch information
Viral Shah committed Jul 2, 2011
1 parent 1f1a0c9 commit b147f0a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion j/random.j
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#libdsfmt = dlopen("libdSFMT")
libdsfmt = dlopen("libdSFMT")

DSFMT_MEXP = int32(19937)
DSFMT_STATE = Array(Int32, 100000)
DSFMT_POOL_SIZE = 10000

dsfmt_init() = ccall(dlsym(libdsfmt, :dsfmt_chk_init_gen_rand),
Void, (Ptr{Void}, Uint32, Int32),
DSFMT_STATE, uint32(0), DSFMT_MEXP)

dsfmt_fill_array_open_open(A::Array{Float64}, size::Size) =
ccall(dlsym(libdsfmt, :dsfmt_fill_array_open_open),
Void, (Ptr{Void}, Ptr{Float64}, Int32),
DSFMT_STATE, A, size)

randui64() = boxui64(or_int(zext64(unbox32(randui32())),
shl_int(zext64(unbox32(randui32())),unbox32(32))))
Expand Down
2 changes: 2 additions & 0 deletions j/start_image.j
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ libc = ccall(:jl_load_dynamic_library, Ptr{Void}, (Ptr{Uint8},), C_NULL)
libm = dlopen("libm")
libfdm = dlopen("libfdm")

libdsfmt = dlopen("libdSFMT")

libpcre = dlopen("libpcre")

libBLAS = dlopen("libLAPACK")
Expand Down

0 comments on commit b147f0a

Please sign in to comment.