Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 98539b6c authored by hhakim's avatar hhakim
Browse files

Review/doctest matfaust.demo and add it to doctest ci job.

parent 7ac304f2
No related branches found
No related tags found
No related merge requests found
...@@ -186,7 +186,7 @@ doctest_nightly_matfaust: ...@@ -186,7 +186,7 @@ doctest_nightly_matfaust:
- rm -Rf build - rm -Rf build
# all is set to doctest matfaust # all is set to doctest matfaust
# no -nojvm because it's needed for Faust.imagesc doctest # no -nojvm because it's needed for Faust.imagesc doctest
- 'for S in Faust proj.sp proj.splin proj.spcol proj.splincol proj.const proj.supp proj.normlin proj.normcol proj.blockdiag proj.anticirc proj.circ proj.hankel proj.skperm proj.sptriu proj.sptril proj.spsymm proj.toeplitz proj.proj_id poly.poly poly.expm_multiply poly.next poly.basis poly.expm_inv_multiply factparams.ParamsHierarchicalWHTNoResCons factparams.ParamsHierarchicalRectMatNoResCons factparams.ParamsHierarchicalNoResCons factparams.ParamsHierarchicalRectMat fact.butterfly fact.check_fact_mat fact.eigtj fact.fact fact.fgft_palm fact.hierarchical_constends fact.hierarchical fact.hierarchical_mhtp fact.palm4msa_constends fact.palm4msa fact.palm4msa_mhtp fact.pinvtj fact.svdtj tools.omp; do if matlab -nodisplay -r "addpath /usr/share/octave/packages/doctest-0.7.0/; setup_FAUST; doctest matfaust.$S; exit;" | tee /tmp/matlab_doctest_$S | grep FAIL; then exit 1; else exit 0; fi; done' - 'for S in Faust proj.sp proj.splin proj.spcol proj.splincol proj.const proj.supp proj.normlin proj.normcol proj.blockdiag proj.anticirc proj.circ proj.hankel proj.skperm proj.sptriu proj.sptril proj.spsymm proj.toeplitz proj.proj_id poly.poly poly.expm_multiply poly.next poly.basis poly.expm_inv_multiply factparams.ParamsHierarchicalWHTNoResCons factparams.ParamsHierarchicalRectMatNoResCons factparams.ParamsHierarchicalNoResCons factparams.ParamsHierarchicalRectMat fact.butterfly fact.check_fact_mat fact.eigtj fact.fact fact.fgft_palm fact.hierarchical_constends fact.hierarchical fact.hierarchical_mhtp fact.palm4msa_constends fact.palm4msa fact.palm4msa_mhtp fact.pinvtj fact.svdtj tools.omp demo.runall; do if matlab -nodisplay -r "addpath /usr/share/octave/packages/doctest-0.7.0/; setup_FAUST; doctest matfaust.$S; exit;" | tee /tmp/matlab_doctest_$S | grep FAIL; then exit 1; else exit 0; fi; done'
after_script: after_script:
- if [ $(rpm -qa faust | wc -l) -gt 0 ]; then sudo rpm -e faust;fi - if [ $(rpm -qa faust | wc -l) -gt 0 ]; then sudo rpm -e faust;fi
only: only:
......
...@@ -201,6 +201,8 @@ classdef quickstart ...@@ -201,6 +201,8 @@ classdef quickstart
%> This demo presents the method to factorize a given matrix into a Faust. %> This demo presents the method to factorize a given matrix into a Faust.
%============================================================ %============================================================
function factorize_matrix() function factorize_matrix()
import matfaust.proj.sp
import matfaust.factparams.*
% number of row of the matrix % number of row of the matrix
dim1 = 500; dim1 = 500;
% number of column of the matrix % number of column of the matrix
...@@ -217,8 +219,14 @@ classdef quickstart ...@@ -217,8 +219,14 @@ classdef quickstart
%% generate parameters of the factorization %% generate parameters of the factorization
params = generate_params(dim1,dim2,nb_factor,rcg_); params = generate_params(dim1,dim2,nb_factor,rcg_);
%% factorization (create Faust from matrix A) fact_cons = {sp([dim1, dim1], 1667)};
faust_A = faust_decompose(A,params); res_cons = {sp([dim1, dim2], 3333)};
stop_crit = StoppingCriterion(200);
stop_crit2 = StoppingCriterion(200);
params = ParamsHierarchical(fact_cons, res_cons, stop_crit, stop_crit2);
%% factorization (create Faust from matrix A)
faust_A = matfaust.fact.hierarchical(A,params);
faust_A = optimize_memory(faust_A); faust_A = optimize_memory(faust_A);
%% speed-up multiplication %% speed-up multiplication
......
%% License: %============================================================================
% Copyright (2019): Luc Le Magoarou, Remi Gribonval
% INRIA Rennes, FRANCE
% http://www.inria.fr/
%
% The FAuST Toolbox is distributed under the terms of the GNU Affero
% General Public License.
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU Affero General Public License as published
% by the Free Software Foundation.
%
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% See the GNU Affero General Public License for more details.
%
% You should have received a copy of the GNU Affero General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
%% Contacts:
% Hakim Hadj-dji.: hakim.hadj-djilani@inria.fr
% Nicolas Bellot : nicolas.bellot@inria.fr
% Leman Adrien : adrien.leman@inria.fr
% Luc Le Magoarou: luc.le-magoarou@inria.fr
% Remi Gribonval : remi.gribonval@inria.fr
%
%% References:
% [1] Le Magoarou L. and Gribonval R., "Flexible multi-layer sparse
% approximations of matrices and applications", Journal of Selected
% Topics in Signal Processing, 2016.
% <https://hal.archives-ouvertes.fr/hal-01167948v1>
%
% [2] A. Gramfort, M. Luessi, E. Larson, D. Engemann, D. Strohmeier,
% C. Brodbeck, L. Parkkonen, M. Hamalainen, MNE software for processing
% MEG and EEG data <http://www.ncbi.nlm.nih.gov/pubmed/24161808>,
% NeuroImage, Volume 86, 1 February 2014, Pages 446-460, ISSN 1053-8119,
% [DOI] <http://dx.doi.org/10.1016/j.neuroimage.2013.10.027>
%%
%> @package matfaust.demo @brief The matfaust demo namespace.
% ============================================================================
%> Script used to run all demo (brain source localisation, hadamard factorization, …) %> Script used to run all demo (brain source localisation, hadamard factorization, …)
%=== %===
%> @fn matfaust.demo.runall %> @fn matfaust.demo.runall
...@@ -52,13 +13,27 @@ ...@@ -52,13 +13,27 @@
%> %>
%> @Example %> @Example
%> @code %> @code
%> import matfaust.demo * %> >> import matfaust.demo.*
%> runall() %> >> runall() % doctest: +ELLIPSIS
%> % You'll find the figures in Figures folder located in current directory. %> ...
%> % The benchmark files from which figures are based are in the folder output (in the current directory also). %> >> % You'll find the figures in Figures folder located in current directory.
%> >> % The benchmark files from which figures are based are in the folder output (in the current directory also).
%> >>
%> @endcode %> @endcode
%> %>
% ============================================================================ %> References:
%> [1] Le Magoarou L. and Gribonval R., "Flexible multi-layer sparse
%> approximations of matrices and applications", Journal of Selected
%> Topics in Signal Processing, 2016.
%> <https://hal.archives-ouvertes.fr/hal-01167948v1>
%>
%> [2] A. Gramfort, M. Luessi, E. Larson, D. Engemann, D. Strohmeier,
%> C. Brodbeck, L. Parkkonen, M. Hamalainen, MNE software for processing
%> MEG and EEG data <http://www.ncbi.nlm.nih.gov/pubmed/24161808>,
%> NeuroImage, Volume 86, 1 February 2014, Pages 446-460, ISSN 1053-8119,
%> [DOI] <http://dx.doi.org/10.1016/j.neuroimage.2013.10.027>
%>
%============================================================================
function runall() function runall()
%% Quick start %% Quick start
disp('*********** Quick Start Demos *************'); disp('*********** Quick Start Demos *************');
...@@ -98,3 +73,4 @@ function runall() ...@@ -98,3 +73,4 @@ function runall()
runtime_comparison; runtime_comparison;
Fig_runtime_comparison; Fig_runtime_comparison;
end end
%> @package matfaust.demo @brief The matfaust demo namespace.
...@@ -48,18 +48,11 @@ ...@@ -48,18 +48,11 @@
%> Faust::HierarchicalFact<FPP,DEVICE,FPP2>::compute_facts : factorization 3/4 %> Faust::HierarchicalFact<FPP,DEVICE,FPP2>::compute_facts : factorization 3/4
%> Faust::HierarchicalFact<FPP,DEVICE,FPP2>::compute_facts : factorization 4/4 %> Faust::HierarchicalFact<FPP,DEVICE,FPP2>::compute_facts : factorization 4/4
%> %>
%> >> %% errors on FGFT and Laplacian reconstruction %> >> err_Lap = norm(Uhat*full(Dhat)*Uhat'-Lap, 'fro') / norm(Lap, 'fro') % doctest: +ELLIPSIS
%> >> err_U = norm(Uhat-U, 'fro')/norm(U, 'fro')
%>
%> err_U =
%>
%> 1.0133
%>
%> >> err_Lap = norm(Uhat*full(Dhat)*Uhat'-Lap, 'fro') / norm(Lap, 'fro')
%> %>
%> err_Lap = %> err_Lap =
%> %>
%> 0.9623 %> 0.9...
%> %>
%> >> %> >>
%> @endcode %> @endcode
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment