Sobol sequence generator

Sobol sequence generator

http://web.maths.unsw.edu.au/~fkuo/sobol/

 

https://blog.csdn.net/qq_33274326/article/details/69952035

那么如何计算出能生成如此高质量分布的矩阵呢?Quasi Monte Carlo的学者们已经花了数10年的时间搜索这种矩阵,现在我们可以在这个网页(Sobol sequence generator )找到可以生成21201维度的Sobol序列的矩阵。

 

 

Sobol sequence generator

This page contains the primitive polynomials and various sets of initial direction numbers for generating Sobol sequences.

This is a joint project between Stephen Joe and Frances Kuo. More details can be found in the following papers:

  1. S. Joe and F. Y. Kuo, Remark on Algorithm 659: Implementing Sobol's quasirandom sequence generator, ACM Trans. Math. Softw. 29, 49-57 (2003). Link to paper.
  2. S. Joe and F. Y. Kuo, Constructing Sobol sequences with better two-dimensional projections, SIAM J. Sci. Comput. 30, 2635-2654 (2008). Link to paper.

Here is a 3-page notes on generating Sobol sequences.

 

 

NEW sets of direction numbers from [2]

The following files contain primitive polynomials and direction numbers obtained using the search algorithm in [2]. The columns in the files are d, s, a, m, where d is the dimension, s is the degree of the primitive polynomial, a is the number representing the coefficients, and m is the list of initial direction numbers. We arrange the primitive polynomials in increasing order of their degrees, and for those with the same degree we systematically arrange them in increasing order of the numbers a. Property A is satisfied up to dimension 1111.

  • The file new-joe-kuo-6.21201 contains the direction numbers obtained using the search criterion D(6) up to dimension 21201.
    This is our recommended choice.
  • The file new-joe-kuo-7.21201 contains the direction numbers obtained using the search criterion D(7) up to dimension 21201.
  • The file new-joe-kuo-5.21201 contains the direction numbers obtained using the search criterion D(5) up to dimension 21201.

They were last updated on 16 September 2010. The dimension 21201 was our target dimension. At this stage we have no plan to update these further.

 

NOTE: The files posted here prior to June 2010 have been removed because we identified some undesirable properties which can affect the quality of the resulting Sobol sequence. The three replacement files do not have these undesirable properties.

WARNING: Our search criteria in [2] incorporated some "weights" so that the projections with earlier variables are treated as more important than those with later variables. This choice of weights makes sense when the variables are arranged in the order of decreasing importance. This choice of weights may not be suitable for the type of problems where the interactions between successive variables are the more important ones; in that case, a different choice of weights should be used in the search criteria, thus leading to a different set of direction numbers.

 

Other sets of direction numbers

The following files contain primitive polynomials and direction numbers obtained using an earlier version of the search algorithm from [2]. The error criteria are similar but slightly different to those in [2]. The columns in the files are d, s, a, m as above. For the first 40 dimensions, we use the primitive polynomials from the Bratley and Fox (1988) paper. From dimension 41 onward, we arrange the primitive polynomials in increasing order of their degrees, and for those with the same degree we systematically arrange them in increasing order of the numbers a. As a result, the polynomials from the first 46 dimensions are in a different order to the new data from [2] above. Property A is satisfied in all dimensions.

These files will not be updated further.

 

 

Comparison of [2] and [1]

The following table compares the direction numbers obtained using the search criterion D(6) with the direction numbers from [1]. This table is an updated version of [2,Table 3.8] correponding to the new replacement files.

 

 

Dimension at which each t-value first occurs
  t-value
 0123456789101112131415161718
 
m=10D(6) 23459163276167402>21201        
[1] 234581521231836>1111        
 
m=12D(6) 2346101634401092335591069>21201      
[1] 23471010102235519661>1111      
 
m=14D(6) 234681222488516438372012351861>21201    
[1] 234591025174055676713161>1111    
 
m=16D(6) 2346814153580159255500837155323752721>21201  
[1] 23469815133258697410295447167>1111  
 
m=18D(6) 234781115357010821341472011771819261630923677>21201
[1] 234771012212825103126115114196232665380>1111

 

Simple C++ program

The file sobol.cc is a simple C++ program for generating Sobol points in graycode order. This program and the accompanying direction numbers above are covered by this BSD-style licence.

Compile the program with the command

g++ -o sobol sobol.cc

Then run the program with three arguments N D FILENAME. For example, the command

./sobol 10 3 new-joe-kuo-6.21201

gives the output

0 0 0
0.5 0.5 0.5
0.75 0.25 0.25
0.25 0.75 0.75
0.375 0.375 0.625
0.875 0.875 0.125
0.625 0.125 0.875
0.125 0.625 0.375
0.1875 0.3125 0.9375
0.6875 0.8125 0.4375

These are the first 10 Sobol points in 3 dimensions.

WARNING: This simple program generates ALL the points at once and stores everything in memory. It is NOT meant to be used directly for practical computations where the total number of points is large and/or the dimension is high. For such computations the points should be generated ONE POINT AT A TIME and cleared from memory immediately after the associated function evaluation is finished. It should be straightforward to extract the appropriate C++ code for doing this from our simple program.

 

 

Questions or comments?

We are keen to hear from you regarding your experience with these direction numbers. Please email Frances Kuo <f.kuo@unsw.edu.au> and Stephen Joe <stephenj@math.waikato.ac.nz>.

 

If you have any publication arising which makes use of the material here, it would be appreciated if you could cite our ACM Trans. Math. Softw. paper and/or our SIAM J. Sci. Comput. paper as appropriate.

03-13
<think>好的,我现在需要处理用户关于Sobol序列的查询。首先,我要确定用户的需求是什么。他们提到想了解Sobol序列在数值方法或编程中的应用,所以应该从基本定义、特点、应用场景以及编程实现这几个方面来组织回答。 首先,Sobol序列属于准蒙特卡洛方法中的低差异序列,这一点需要明确。低差异序列的特点是在高维空间中分布均匀,这有助于提高数值积分的收敛速度。用户可能对蒙特卡洛方法和准蒙特卡洛方法的区别不太清楚,需要简要说明。 接下来是Sobol序列的应用场景。常见的包括高维积分计算、金融衍生品定价、图形学中的渲染优化,以及全局优化问题。每个应用场景需要举例说明,比如在金融中使用Sobol序列进行期权定价,图形学中用其生成采样点减少噪点等。这里要注意引用提供的资料,比如引用3和4提到了图形学中的应用,需要正确标注引用。 然后是编程实现部分。用户可能希望看到具体的代码示例,比如Python中使用第三方库如SciPy来生成Sobol序列。需要确保代码示例正确,并解释关键参数如维度和样本数。此外,提到Matlab的工具箱和Lightspeed Toolbox(引用2),可以补充说明其他语言的实现资源。 在生成相关问题部分,需要围绕Sobol序列的特性、与其他序列的比较、性能优化、图形学应用等方面提出问题。这些问题应引导用户进一步探索,比如与伪随机数的对比,或者如何在高维情况下保持低差异。 同时,用户提供的引用中有一些可能相关的资料,比如引用3提到的HXA图形库中的Sobol序列实现,引用4提到的计算机图形学研究软件,这些都需要在适当的地方引用,增强回答的可信度。 需要注意的是,所有数学公式必须按照系统级指令的要求使用$...$或$$...$$格式。例如,提到低差异性时,可以写出差异度的数学表达式。此外,代码块需要用正确的语法高亮,这里Python示例已经给出,需确认是否正确。 最后,确保回答结构清晰,分点说明,并且语言流畅自然。检查是否有遗漏的重要信息,比如Sobol序列的缺点或使用时的注意事项,比如维度的限制或需要预先设定维度数等,这些对用户实际应用可能有帮助,可以简要提及。 总结一下,回答的结构应该是:定义和特点、应用场景、编程实现示例、相关问题。每个部分都要简明扼要,引用正确,并且符合格式要求。现在需要把这些内容整合起来,确保逻辑连贯,信息准确。</think>### Sobol序列及其应用 #### 1. Sobol序列的定义与特点 Sobol序列是一种**低差异序列**(Low-Discrepancy Sequence),属于准蒙特卡洛方法(Quasi-Monte Carlo, QMC)的核心工具。其核心思想是通过确定性算法生成高维空间中分布均匀的点集,从而在数值积分、优化等问题中比伪随机数更快收敛[^3]。 - **低差异性**:点集差异度满足$D_N^* = O\left(\frac{(\log N)^d}{N}\right)$,其中$d$为维度,$N$为点数。 - **确定性**:序列生成依赖预定义的**方向数**(Direction Numbers),可重复。 - **高效性**:在高维积分中收敛速度显著优于传统蒙特卡洛方法[^4]。 --- #### 2. 应用场景 1. **高维数值积分** 例如计算$I = \int_{[0,1]^d} f(\mathbf{x}) d\mathbf{x}$,使用Sobol序列生成点集$\{\mathbf{x}_i\}$,估计值为$\frac{1}{N}\sum_{i=1}^N f(\mathbf{x}_i)$,收敛速度接近$O(1/N)$。 2. **金融衍生品定价** 在期权定价模型中,Sobol序列用于高效模拟资产价格路径,减少方差[^2]。 3. **图形学渲染** 用于光线追踪中的采样,减少噪点。例如HXA图形库通过Sobol序列生成Halton序列改进渲染质量[^3]。 4. **全局优化问题** 在参数搜索空间中均匀采样,避免陷入局部最优。 --- #### 3. 编程实现示例(Python) ```python from scipy.stats import qmc # 生成2维Sobol序列(1024个点) dim = 2 n_samples = 1024 sampler = qmc.Sobol(d=dim, scramble=True) samples = sampler.random(n_samples) # 可视化 import matplotlib.pyplot as plt plt.scatter(samples[:,0], samples[:,1], s=5) plt.title("2D Sobol序列") plt.show() ``` - **关键参数**:`scramble=True`可避免在低样本数时的结构相关性[^3]。 --- #### 4. 扩展工具与库 - **Matlab**: `sobolset`函数(Statistics and Machine Learning Toolbox) - **C++**: Boost库中的`sobol.hpp` - **图形学专用**: HXA图形库提供Sobol序列生成器[^3] ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值