dirnums.m
来自「very good matlab of Monte carlo」· M 代码 · 共 18 行
M
18 行
%DIRNUMS calculates the direction numbers
%m=dirnums(poly,k,m)
% for the sobol sequence given
% poly - 1/0 vectors indicating the indices - descending order including leading and following 1
% k - the required number of direction numbers
% m - the initial d direction numbers
function m=dirnums(poly,k,m)
%d=3,a1 =1,a2=0
d=length(poly)-1;
poly=poly(2:end-1);
for i=d+1:k
m(i)=bitxor(2^d*m(i-d),m(i-d)); %last 2 element
for j=1:(d-1)
m(i)=bitxor(2^j*poly(j)*m(i-j),m(i)); %binary or is commutative and associative
end;
end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?