📄 testjns.m
字号:
% A quick test of the Jade/Shibbs codeclearn = 5 ;T = 10000 ;% Removing the sample mean is necessary for the sake of% this particular testS =rand(n,T)-0.5 ; S =S - mean(S')' * ones(1,T);A = randn(n);X = A*S ;% Note: there are weird assignments below to work around % some `smartnesses' of the matlab interpreter.fprintf('%======= checking Jade =============== %\n');% The matlab estimateXs = X ;Xs = Xs'; Xs = Xs' ;Bm = MatlabjadeR(Xs) ;%Bm*A%fprintf('Matlab functions do not change the input arguments:');%changes = [ norm(X-Xs,'fro'), norm(Bm*X-Xs, 'fro') ]% The C estimateXs = X ;Xs = Xs'; Xs = Xs' ;Bc = JadeR(Xs) ;% Bc*A%fprintf('This C function does change the input arguments:');%changes = [ norm(X-Xs,'fro'), norm(Bc*X-Xs, 'fro') ]% Checking that C and Matlab agree (up to errors due to possibly% different diagonalization thresholds.The_same = Bc*inv(Bm)fprintf('%======= checking Shibbs =============== %\n');% The matlab estimateBm = MatlabshibbsR(X) ;% The C estimateXt = X; % saving X because the C code updates it Bc = ShibbsR(Xt) ;% Checking consistency: should be close to diag*perm% Bc*A% Checking that the mex file does also update the *input* argument% i.e. it, after execution, the input data vector Xt *is* the% estimated IC data matrix% norm( Bc*X - Xt, 'fro') % Checking that C and Matlab agree (up to errors due to possibly% different diagonalization thresholds.The_same = Bc*inv(Bm)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -