clear all
close all

%%
load signals_diff_map.mat


%%
Signal = ori_signals;
T = size(Signal, 2); 
d = size(Signal, 1);
Signal = Signal + randn(d,T);
w = 200;
Pre_mean = zeros(d,1); % the mean vector before the change-point
Gamma = 10000;
s=100;
%% Choose the threshold
% b_GLR = Threshold_normal_mean('GLR', T, d, Pre_mean, Gamma, w);
% % b_SRRS = Threshold_normal_mean('SRRS', T, d, Pre_mean, Gamma, w);
% % b_ACM = Threshold_normal_mean('ACM', T, d, Pre_mean, Gamma, w); 
% b_WLCUSUM = Threshold_normal_mean('WLCUSUM', T, d, Pre_mean, Gamma, w);
% b_CUSUM = Threshold_normal_mean('CUSUM', T, d, Pre_mean, Gamma, w);
% b_WLGLR = Threshold_normal_mean('WLGLR', T, d, Pre_mean, Gamma, w,s);
% b_WLSRRS = Threshold_normal_mean('WLSRRS', T, d, Pre_mean, Gamma, w,s);
% b_WLACM = Threshold_normal_mean('WLACM', T, d, Pre_mean, Gamma, w,s); 
% b_WLSRRS_L1 = Threshold_normal_mean('WLSRRS_L1', 100, d, Pre_mean, Gamma, w,s);
% b_WLACM_L1 = Threshold_normal_mean('WLACM_L1', 100, d, Pre_mean, Gamma, w,s); 

%%
b_CUSUM = 0; 
b_WLACM = 0;
b_WLGLR = 137;
b_WLSRRS = 0;
b_WLSRRS_L1 = 0;
b_WLACM_L1 = 0;



%% Compute the Detection delay

EDD_CUSUM = EDD_normal_mean_rust('CUSUM', T, d, Pre_mean, Signal, b_CUSUM, w,s);
disp(mean(EDD_CUSUM));
disp(std(EDD_CUSUM));
% EDD_GLR = EDD_normal_mean('GLR', Len, d, Post_mean, b_GLR, w);
% EDD_SRRS = EDD_normal_mean('SRRS', Len, d, Post_mean, b_SRRS, w);
% EDD_ACM = EDD_normal_mean('ACM', Len, d, Post_mean, b_ACM, w);
% EDD_WLCUSUM = EDD_normal_mean('WLCUSUM', Len, d, Post_mean, b_WLCUSUM, w);
EDD_WLGLR = EDD_normal_mean_rust('WLGLR', T, d, Pre_mean, Signal, b_WLGLR, w,s);
disp(mean(EDD_WLGLR));
disp(std(EDD_WLGLR));
EDD_WLSRRS = EDD_normal_mean_rust('WLSRRS', T, d, Pre_mean, Signal, b_WLSRRS, w,s);
disp(mean(EDD_WLSRRS));
disp(std(EDD_WLSRRS));
EDD_WLACM = EDD_normal_mean_rust('WLACM', T, d, Pre_mean, Signal, b_WLACM, w,s);
disp(mean(EDD_WLACM));
disp(std(EDD_WLACM));
EDD_WLSRRS_L1 = EDD_normal_mean_rust('WLSRRS_L1', T, d, Pre_mean, Signal, b_WLSRRS_L1, w,s);
disp(mean(EDD_WLSRRS_L1))
disp(std(EDD_WLSRRS_L1));
EDD_WLACM_L1 = EDD_normal_mean_rust('WLACM_L1', T, d, Pre_mean, Signal, b_WLACM_L1, w,s);
disp(mean(EDD_WLACM_L1));
disp(std(EDD_WLACM_L1));
%%
%figure;
%imagesc(A(:,:,1));

