SERVING THE QUANTITATIVE FINANCE COMMUNITY

  • 1
  • 2
  • 3
  • 4
  • 5
  • 8
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 13th, 2013, 12:10 pm

Have a working version in C#. Will check if I get same values in C++. When all OK I will provide a lovely dll .NET assembly Q. Can you check if these initial values look reasonable? I'm using 32 unsigned integers in .NET
Last edited by Cuchulainn on December 12th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 13th, 2013, 12:23 pm

Same test in C++Bingo!
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 13th, 2013, 1:32 pm

QuoteOriginally posted by: outrunCool! Bravo!..so you did it with pointer to the C++ objects to wrap it?Thanks.It's C# <-> Managed C++ <-> Native Managed C++ is bilingual. Now can take that C# code below, create a Console project, add dll refrence, build and Bob's yer unkle!
Attachments
SitmoPRNG.zip
(27.1 KiB) Downloaded 6 times
Last edited by Cuchulainn on December 12th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 13th, 2013, 1:42 pm

Next step is in the C# MC framework.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 13th, 2013, 1:52 pm

QuoteOriginally posted by: outrun..and can you use templates in the manages c++ CLI language? E.g. provide "sitmo:rng_engine" as a type to the namespace (wtf, no a class??) SitmoWrapper?CLI can have templates since it is bilingual.SitmoWrapper is a namespace.No, But .NET generics and C++ templates don't mix unfortunately AFAIK.
Last edited by Cuchulainn on December 12th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 13th, 2013, 5:56 pm

QuoteI was just thinking that if you would write a wrapper for another random engine then the code would be 99% identical, apart from the name. Maybe you can use MACRO's? I C#, I can _generate_ code at run-time using .NET. Reflection. Just like (btw you can see I can make it a generic class)using System;public class Class1{ public static void Main() { GaudeamusIgitur<int, int> g = new GaudeamusIgitur<int, int>(); g.key = 1; g.value = 42; g.Salve(); }}where the code to generate this class is (cool yes?)
Last edited by Cuchulainn on December 12th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 13th, 2013, 8:24 pm

Am I on the right track?Q. So I can now plug in your engine into Box Muller (for example)? GOAL is N(0,1) variates of course. I need U(0,1) variates.
Last edited by Cuchulainn on December 12th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 59665
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 14th, 2013, 9:34 am

Thanks. I'll rebuild.Going back to 'p' in 'prng' in you test case main() each seed has to be locked to avoid race conditions. After that I hope the code related to prng directly does not need these expensive operations.
Last edited by Cuchulainn on December 13th, 2013, 11:00 pm, edited 1 time in total.
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On