Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 88a597e3 authored by hhakim's avatar hhakim
Browse files

Minor fixes in omp.m.

Doc: If the doxygen @package tag is in the first lines of the .m the inline documentation of the function is not displayed after a 'help omp'.
Output: hiding internal outputs.
parent 3ebe1b21
No related branches found
No related tags found
No related merge requests found
Pipeline #833802 skipped
%> @package matfaust.tools @brief The matfaust tools namespace
%=============================================================================== %===============================================================================
%> Runs the greedy OMP algorithm optimized by Cholesky decomposition. %> Runs the greedy OMP algorithm optimized by Cholesky decomposition.
%=== %===
...@@ -27,40 +25,40 @@ ...@@ -27,40 +25,40 @@
function x = omp(y, D, varargin) function x = omp(y, D, varargin)
argc = length(varargin); argc = length(varargin);
% set parameter default values % set parameter default values
maxiter = length(y) maxiter = length(y);
tol = 0 tol = 0;
relerr = true relerr = true;
verbose = false verbose = false;
if(argc > 0) if(argc > 0)
for i=1:argc for i=1:argc
switch(varargin{i}) switch(varargin{i})
case 'maxiter' case 'maxiter'
if(argc == i || ~ isscalar(varargin{i+1})) if(argc == i || ~ isscalar(varargin{i+1}))
error('maxiter keyword arg. is not followed by a number') error('maxiter keyword arg. is not followed by a number');
else else
maxiter = real(floor((varargin{i+1}))) % real in case of cplx num maxiter = real(floor((varargin{i+1}))); % real in case of cplx num
end end
case 'tol' case 'tol'
if(argc == i || ~ isscalar(varargin{i+1})) if(argc == i || ~ isscalar(varargin{i+1}))
error('tol keyword arg. is not followed by a number') error('tol keyword arg. is not followed by a number');
else else
tol = real(varargin{i+1}) % real in case of cplx num tol = real(varargin{i+1}); % real in case of cplx num
end end
case 'relerr' case 'relerr'
if(argc == i || ~ islogical(varargin{i+1})) if(argc == i || ~ islogical(varargin{i+1}))
error('relerr keyword argument is not followed by a logical') error('relerr keyword argument is not followed by a logical');
else else
relerr = varargin{i+1} relerr = varargin{i+1};
end end
case 'verbose' case 'verbose'
if(argc == i || ~ islogical(varargin{i+1})) if(argc == i || ~ islogical(varargin{i+1}))
error('verbose keyword argument is not followed by a logical') error('verbose keyword argument is not followed by a logical');
else else
verbose = varargin{i+1} verbose = varargin{i+1};
end end
otherwise otherwise
if(isstr(varargin{i})) if(isstr(varargin{i}))
error([ varargin{i} ' unrecognized argument']) error([ varargin{i} ' unrecognized argument']);
end end
end end
end end
...@@ -69,9 +67,9 @@ function x = omp(y, D, varargin) ...@@ -69,9 +67,9 @@ function x = omp(y, D, varargin)
tol tol
if(relerr) if(relerr)
if(size(y,1) == 1) if(size(y,1) == 1)
y_sqr_norm = y*y' y_sqr_norm = y*y';
else else
y_sqr_norm = y'*y y_sqr_norm = y'*y;
end end
x = greed_omp_chol(y, D, size(D,2), 'stopCrit', 'mse', 'stopTol', tol*y_sqr_norm/length(y), 'verbose', verbose); x = greed_omp_chol(y, D, size(D,2), 'stopCrit', 'mse', 'stopTol', tol*y_sqr_norm/length(y), 'verbose', verbose);
else % absolute error else % absolute error
...@@ -79,6 +77,9 @@ function x = omp(y, D, varargin) ...@@ -79,6 +77,9 @@ function x = omp(y, D, varargin)
end end
else else
% maxiter % maxiter
x = greed_omp_chol(y, D, size(D,2), 'stopCrit', 'M', 'stopTol', maxiter, 'verbose', verbose) x = greed_omp_chol(y, D, size(D,2), 'stopCrit', 'M', 'stopTol', maxiter, 'verbose', verbose);
end end
end end
%> @package matfaust.tools @brief The matfaust tools namespace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment