Timeline for Compare C++ Standard Library's Mersenne Twister with Mathematica's Mersenne Twister
Current License: CC BY-SA 3.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 22, 2013 at 8:58 | comment | added | Stefan | And since yesterday I do have a working implementation for Takahashi Fibonacci algorithm. | |
Feb 22, 2013 at 8:57 | comment | added | Stefan | Hey @Scabolcs. I did not either. So far I'm well with MathLink for the moment. LibraryLink looks to me really weird. Due to the Fibonacci range product question, where I was hacking around using C++11 techniques to calculate the results I gave JLink a try and implemented there a full blown version with arbitrary precision support plus parallel Karatsuba, ToomCook3 and SchönhageStrassen. That was quite fun, but I do not dare to post this, since I obv. tend to exceed the answer limits ;) So I wait for the question on how to do this in Java/JLink. Cheers | |
Feb 19, 2013 at 22:43 | comment | added | Szabolcs | I did not yet get around to doing this. Did you manage to get it working with LibraryLink? | |
Feb 15, 2013 at 16:12 | comment | added | Szabolcs | If I get the time I'll show you how to convert your MathLink program to LibraryLink, but right now I can't do that. Maybe tonight. | |
Feb 15, 2013 at 15:59 | comment | added | Stefan | understood. Thank you. May I ask you if you know how to return a True/False? I'd like to check something out and need this return type for Select[] to pick the elements... | |
Feb 15, 2013 at 15:48 | comment | added | Szabolcs | Actually it depends on the situation. Also here I must state that while I have used both LibraryLink and MathLink, I don't have extensive experience with either. The big advantage of LibraryLink is that there's no data transfer overhead. You access kernel memory directly. It's also easier to learn and to set up. The disadvantage is that your functions are loaded directly into the kernel. If they crash, the kernel crashes. It's also less flexible: you can only work with numbers, but not symbols (to be precise you can use the MathLink API in LibraryLink functions too). | |
Feb 15, 2013 at 15:43 | comment | added | Stefan | @Szabolcs I see. Another alternative would be to use a buffered transfer for MathLink. So the general advise is to use LibraryLink with Mma >= 8 and forget MathLink? | |
Feb 15, 2013 at 15:34 | comment | added | Szabolcs |
Re your edit "Is there a better alternative?" --> The better alternative is using LibraryLink. This gives you direct access to the kernel's memory and the data transfer overhead will be minimal. With MathLink, the data transfer overhead is so large that you really don't want to send more elements that what fit in a 32-bit int . Whether it is possible to put more than $2^{31}$ elements through MathLink, I do not know.
|
|
Feb 15, 2013 at 15:19 | history | edited | Stefan | CC BY-SA 3.0 |
added 1098 characters in body
|
Feb 13, 2013 at 19:42 | comment | added | Szabolcs | @Stefan Are you sure it wouldn't also depend on hardware parameters, e.g. the size of a machine integer? You might not have control over this in Mathematica, so just using the C++ generator may be better ... I think the most complete docs on RNG methods is what I linked. It doesn't describe suboptions for MersenneTwister there, but there may be some undocumented ones. I'd just write to support and ask about it. They may be slow to reply, but they're pretty good at providing this type of information. If there are suboptions, they'll let you know. | |
Feb 13, 2013 at 19:39 | answer | added | Szabolcs | timeline score: 11 | |
Feb 13, 2013 at 19:38 | comment | added | Stefan | @Szabolcs thank you for the links. At the moment I'm writing on a skeleton implementation for integration into the RNG framework. But, nevertheless, this wasn't the question. The mt19937 is well defined and I just want to know what parameter values the folks at wolfram are using and if I can change them...like option values. The values I've listed are just parameter values for the typedef in the C++ standard library. | |
Feb 13, 2013 at 19:18 | comment | added | Szabolcs | See here for the three different Mersenne twister implementations Mathematica includes, and also for defining your own custom RNG method. | |
Feb 13, 2013 at 19:15 | comment | added | Szabolcs | You can define your own random number generation method for Mathematica, see tpfto.wordpress.com/2012/02/12/… for an example. The docs describe the API to do this. You can write a LibraryLink function which calls your C++'s RNG. | |
Feb 13, 2013 at 16:15 | history | tweeted | twitter.com/#!/StackMma/status/301726181789679616 | ||
Feb 13, 2013 at 15:17 | history | edited | Stefan | CC BY-SA 3.0 |
edited body
|
Feb 13, 2013 at 15:16 | comment | added | Stefan | Yes @OleksandrR my fault. Was a typo... | |
Feb 13, 2013 at 15:12 | history | edited | rm -rf♦ | CC BY-SA 3.0 |
added 88 characters in body
|
Feb 13, 2013 at 14:17 | history | asked | Stefan | CC BY-SA 3.0 |