Mentions légales du service

Skip to content
Snippets Groups Projects
Commit c39148ed authored by testcdash Nicolas Bellot's avatar testcdash Nicolas Bellot Committed by hhakim
Browse files

new find matlab 4 windows

parent 1e7ee422
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,18 @@ mkdir faust_test
mkdir faust_test_build
mkdir faust_output
set "find_exe=matlab.exe"
(where matlab.exe) > logPath.txt
(where /R "C:\\Program Files\\MATLAB" matlab.exe) >> logPath.txt
(where /R "C:\\Program Files (x86)\\MATLAB" matlab.exe) >> logPath.txt
set MATLAB_EXE_DIR_TMP=
set /p MATLAB_EXE_DIR_TMP=<logPath.txt
REM for /f "delims=" %%i in ('type logPath.txt') do (set MATLAB_DIR_TMP=%%i && echo %%i)
echo environment variable is defined for matlab Path : %MATLAB_EXE_DIR_TMP%
REM # launch ctest file
ctest -VV -C Release -S faustTest.cmake
REM #ctest -VV -C Release -S faustTestContinuous.cmake
......@@ -76,11 +76,8 @@ load([BSL_data_pathName 'X_meg.mat' ]);
load ([BSL_data_pathName 'curv.mat']);
points2 = points;
points = points(points_used_idx,:);
X = X_fixed;
%X = randn(size(X_fixed));
%X_norm = X;
X_norm = X./repmat(sqrt(sum(X.^2,1)),size(X,1),1);
X_norm = normalizeCol(X_fixed);
disp(['MEG size : ' int2str(size(X_norm))]);
%% Loading of the MEG matrix approximations
% wrapper C++ faust
MEG_faustS=cell(1,nb_approx_MEG);% store the different wrapper faust objet
......@@ -97,27 +94,22 @@ for i=1:nb_approx_MEG
RCG_approxS_MEG(i);
load([BSL_data_pathName 'M_' int2str(RCG_approxS_MEG(i)) ]);
facts{1}=lambda*facts{1};
X_approx =dvp(facts);
X_approx = X_approx'; X_approx(:,sum(X_approx.^2,1)==0)=1;
X_norm_approx = X_approx./repmat(sqrt(sum(X_approx.^2,1)),size(X_approx,1),1);
MEG_approxS_norm{i}=X_norm_approx;
disp(['fact size : ' int2str(size(facts{1},1)) ' ' int2str(size(facts{end},2))]);
%% structure faust
facts{1}=facts{1}./repmat(sqrt(sum(X_approx.^2,1)),size(X_approx,1),1)';% normalisation of the row dvp(facts)
sp_facts_trans = make_sparse(facts);
sp_facts = faust_transpose(sp_facts_trans);
trans_fc=Faust(facts);
fc=transpose(trans_fc);
facts = normalizeCol(facts,lambda);
fc=Faust(facts);
trans_fc=fc';
trans_facts=faust_transpose(facts);
% matlab faust (no C++ Faust Toolbox code is running)
matlab_trans_faustS_mult{i}=@(x) f_mult(sp_facts_trans,x); % function handle
matlab_faustS_mult{i}=@(x) f_mult(sp_facts,x); % function handle
matlab_trans_faustS_mult{i}=@(x) f_mult(trans_facts,x); % function handle
matlab_faustS_mult{i}=@(x) f_mult(facts,x); % function handle
% wrapper C++ faust
trans_faustS_mult{i}=@(x) mtimes_trans(fc,x,1);% function handle
faustS_mult{i}=@(x) mtimes_trans(fc,x,0); % function handle
MEG_faustS{i}=fc; % store the different faust approximations
MEG_Faust_list{i}=fc; % store the different faust approximations
end
M=size(X_norm,2);
......@@ -147,7 +139,6 @@ compute_Times_matlab = zeros(nb_approx_MEG+1,numel(dist_paliers)-1,Ntraining);
h = waitbar(0,['Brain Source Localization : MEG matrix and its faust approximations with ' solver_choice ' solver']);
nb_palier=numel(dist_paliers)-1;
for k=1:nb_palier;
%disp(['k=' num2str(k) '/' num2str(numel(dist_paliers)-1)])
%Parameters settings
Gamma = zeros(size(X_norm,2),Ntraining);
for ii=1:Ntraining
......@@ -213,7 +204,7 @@ for k=1:nb_palier;
compute_Times_matlab(1,k,i)=tdense;
for ll=1:nb_approx_MEG
X_approx_norm = MEG_approxS_norm{ll};
MEG_Faust = MEG_Faust_list{ll};
%% objet faust
......@@ -225,7 +216,7 @@ for k=1:nb_palier;
t_cpp=toc;
else
tic
[sol_solver_hat(:,i), err_mse_solver_hat, iter_time_solver_hat]=greed_omp_chol(Data(:,i),MEG_faustS{ll},M,'stopTol',1*Sparsity,'verbose',false);
[sol_solver_hat(:,i), err_mse_solver_hat, iter_time_solver_hat]=greed_omp_chol(Data(:,i),MEG_Faust,M,'stopTol',1*Sparsity,'verbose',false);
t_cpp=toc;
end
elseif strcmp(solver_choice,'iht')
......@@ -236,14 +227,14 @@ for k=1:nb_palier;
t_cpp=toc;
else
tic
[sol_solver_hat(:,i), err_mse_solver, iter_time_solver]=hard_l0_Mterm(Data(:,i),MEG_faustS{ll},M,1*Sparsity,'verbose',false,'maxIter',1000);
[sol_solver_hat(:,i), err_mse_solver, iter_time_solver]=hard_l0_Mterm(Data(:,i),MEG_Faust,M,1*Sparsity,'verbose',false,'maxIter',1000);
t_cpp=toc;
end
else
error('invalid solver choice: must be omp or iht');
end
err_solver_hat(1,i) = norm(X_norm*Gamma(:,i)-X_approx_norm*sol_solver_hat(:,i))/norm(X_norm*Gamma(:,i));
err_solver_hat(1,i) = norm(X_norm*Gamma(:,i)-MEG_Faust*sol_solver_hat(:,i))/norm(X_norm*Gamma(:,i));
err_solver_hat(2,i) = isequal(find(Gamma(:,i)),find(sol_solver_hat(:,i)>1e-4));
idx_solver = find(sol_solver_hat(:,i));
resDist(ll+1,k,1,i) = min(norm(points(idx(1)) - points(idx_solver(1))),norm(points(idx(1)) - points(idx_solver(2))));
......@@ -265,7 +256,7 @@ for k=1:nb_palier;
else
error('invalid solver choice : must be omp or iht');
end
err_solver_hat(1,i) = norm(X_norm*Gamma(:,i)-X_approx_norm*sol_solver_hat(:,i))/norm(X_norm*Gamma(:,i));
err_solver_hat(1,i) = norm(X_norm*Gamma(:,i)-MEG_Faust*sol_solver_hat(:,i))/norm(X_norm*Gamma(:,i));
err_solver_hat(2,i) = isequal(find(Gamma(:,i)),find(sol_solver_hat(:,i)>1e-4));
idx_solver = find(sol_solver_hat(:,i));
resDist_matlab(ll+1,k,1,i) = min(norm(points(idx(1)) - points(idx_solver(1))),norm(points(idx(1)) - points(idx_solver(2))));
......@@ -284,3 +275,4 @@ save(matfile,'resDist','params','resDist_matlab','RCG_approxS_MEG','nb_approx_ME
......@@ -71,7 +71,7 @@ test2 = 100*[squeeze(d1);zeros(1,Ntest);squeeze(d2);zeros(1,Ntest);squeeze(d3)];
f=figure('color',[1 1 1]);
T = bplot(test2','linewidth',1.5);
legend(T)
legend(T);
ylabel('Distance between true and estimated sources (cm)')
box on
......@@ -125,7 +125,7 @@ test2 = 100*[squeeze(d1);zeros(1,Ntest);squeeze(d2);zeros(1,Ntest);squeeze(d3)];
f=figure('color',[1 1 1]);
title('MATLAB');
T = bplot(test2','linewidth',1.5);
legend(T)
legend(T);
ylabel('Distance between true and estimated sources (cm)')
box on
......@@ -178,7 +178,7 @@ timeS(:,1)=[];% twice the time of the MEG matrix solver
f=figure('color',[1 1 1]);
T = bplot(timeS,'linewidth',1.5);
legend(T)
legend(T);
ylabel('Computed Time (ms)')
box on
ax = gca;
......@@ -221,7 +221,7 @@ mean_Times_matlab=mean(timeS_matlab);
dense_matrix_time=mean_Times(1);
real_RCG=dense_matrix_time./mean_Times;
real_RCG_matlab=dense_matrix_time./mean_Times_matlab;
f=figure,
f=figure;
ax = gca;
set(ax,'xticklabel', [])
......@@ -247,3 +247,4 @@ figure_name = [figure_dir filesep 'BSL-speed_up_' solver_choice ' solver'];
print(figure_name, format_fig);
......@@ -27,4 +27,6 @@ else
end
end
end
Ddvp = full(Ddvp);
end
\ No newline at end of file
function A_normalize = normalizeCol(A,varargin)
nb_input=length(varargin);
if (nb_input == 1)
lambda=varargin{1};
else
lambda=1;
end
if(iscell(A))
X =lambda*dvp(A);
else
X = A;
end
X(:,sum(X.^2,1)==0)=1;% null column are fixed to 1
if (iscell(A))
A_normalize=A;
A_normalize{end}=A_normalize{end}./repmat(sqrt(sum(X.^2,1)),size(X,1),1);
else
A_normalize = A./repmat(sqrt(sum(X.^2,1)),size(X,1),1);
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment