📄 randnt.c
字号:
/*
Truncated Gaussian numbers generator
Usage
-----
y = randnt(m , sigma , [left] , [right] , [n1] , ... , [np]);
Inputs
------
m Mean values (v1 x v2 x ...x vl) or scalar if randnt if called with more than 4 arguments
sigma Variance values (v1 x v2 x ...x vl) or scalar if randnt if called with more than 4 arguments
left Left boundaries (v1 x v2 x ...x vl) or scalar if randnt if called with more than 4 arguments
Right Right boundaries (v1 x v2 x ...x vl) or scalar if randnt if called with more than 4 arguments
ni Size of dimension i
Outputs
------
y Truncated independant samples (v1 x v2 x ... x vl) or (n1 x n2 x .... x np)
Examples
-------
y = randnt(0 , 1 , 0 , 3 , 2 , 3);
y = randnt(0 , 1 , [] , 3 , 2 , 3 , 2);
y = randnt(0 , 1 , [] , [] , 2 , 3 , 2); % <=> randn(2 , 3 , 2)
y = randnt(ones(2,2,3) , ones(2,2,3) , zeros(2,2,3) , ones(2,2,3));
y = randnt(ones(2,2) , ones(2,2)); N(1 , 1)*I_{2,2}
To compile :
------------
mex -DranSHR3 -output randnt.dll randnt.c or mex -DranKISS -output randnt.dll randnt.c (little bit slower)
Myself, I use Intel CPP compiler as :
mex -DranSHR3 -f mexopts_intel10AMD.bat -output randnt.dll randnt.c
Ver 1.0 (03/04/05)
Author : S閎astien PARIS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -