#138 Sobol 18th inizialization polinomial


I have an old Sobol code.
Very clear implementation, but poor performance.
I tried to switch to QuantLib\'s one, as it should be better implemented.
But first, I checked they were the same (I mean, different implementation but same results).

I generated 8000 random vectors of dimension between 1 and 32 (because in my old Sobol code I can\'t use more than 32 dimensions).
All output are exactly the same except on the 18th dimension.
i.e.: the 8000 realizations of random vectors with dimension from 1 and 17 are exactly the same, while the 8000 realization of random vector of dimension between 18 and 32 differ only at the 18th component.

If I remember well (sorry but many years have passed since I deal with Sobol sequence), this may be caused from a different 18th inizialization polinomial.

I checked mine, and it is the same as publiched by Jaeckel at page 85 (table 8.3), i.e. 1101101.

Of course I\'m not sure the bug is in your library, but maybe a check can be a good idea ;-)

I attached two files for your convenience, old.txt and new.txt.
Both contain 8000 random vectors of dimension 20.
By comparing such files (for example with WinMerge) you can see the difference on the 18th dimension (the others being exactly the same).

Bye, Giulio


  • giulio

    giulio - 2011-10-19

    sample files

  • giulio

    giulio - 2011-10-19

    For size limit the files actually attached contain 3000 rows, instead of 8000 (as I wrongly wrote in the post above).

  • giulio

    giulio - 2011-10-20

    The problem was in my old code.
    The initializers polinomials were correct. The problem was in the direction integers.
    At the row 18, instead of (1, 1, 1, 3, 13, 39) I had (1, 1, 1, 3, 13, 13).
    Correcting that single istruction was sufficient to reproduce exactly the same numbers of QuantLib.

    Now I don't know. Do I have to put the keyword SOLVED in same place within this bug report?

    In this case, let me know...


  • Luigi Ballabio

    Luigi Ballabio - 2011-10-21

    Ok, glad it's solved. Thanks for putting effort into this.

  • Luigi Ballabio

    Luigi Ballabio - 2011-10-21
    • status: open --> closed-invalid

Log in to post a comment.