📄 sample_ghmm.c
字号:
/* sample_ghmm.c
Returns samples of a Multivariate Gaussian process driven by HMM.
Usage
-------
[Z , X] = sample_ghmm(K , PI , A , M , S , [v1] , ... , [vp] );
Inputs
-------
PI Initial state probabilities (d x 1 x [n1] , ... , [nl]) , sum(PI) = ones(1 , 1 , [n1] , ... , [nl] )
A State transition probabilities (d x d x [n1] , ... , [nl]), sum(A) = ones(1 , d , [n1] , ... , [nl])
M Mean vectors (m x 1 x d x [n1] , ... , [nl])
S Covariance matrices (m x m x d x [n1] , ... , [nl])
Ouputs
-------
Z Measurements (m x K x [n1] , ... , [nl] , [v1] , ... , [vp])
X State/label sequence (1 x K x [n1] , ... , [nl] , [v1] , ... , [vp])
Example
-------
d = 3;
m = 2;
N = 1;
K = 3;
L = 4;
PI = rand(d , 1 , N);
sumPI = sum(PI);
PI = PI./sumPI(ones(d , 1) , : , :);
A = rand(d , d);
sumA = sum(A);
A = A./sumA(ones(d , 1) , : , :);
M = 3*randn(m , 1 , d);
S = cat(3 , [2 , 1.1 ; 1.1 1.5] , [1.3 , 0.3 ; 0.3 1.5] , [1 , 0 ; 0 1]);
%[Z , X] = sample_ghmm(K , PI(: , : , ones(1 , 4) , ones(1 , 2)) , A(: , : , ones(1 , 4), ones(1 , 2)) , M(: , : , : , ones(1 , 4), ones(1 , 2)) , S(: , : , : , ones(1 , 4), ones(1 , 2)) );
[Z , X] = sample_ghmm(K , PI , A , M , S , L);
%[Z , X] = sample_ghmm(K , PI(: , : , ones(1,L)) , A(: , : , ones(1,L)) , M(: , : , : , ones(1,L)) , S(: , : , : , ones(1,L)));
To compile
----------
mex -DranSHR3 -output sample_ghmm.dll sample_ghmm.c
Myself, I use Intel CPP compiler as :
mex -DranSHR3 -f mexopts_intel10amd.bat -output sample_ghmm.dll sample_ghmm.c
Ver 1.0 (03/16/05)
Author : S閎astien PARIS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -