Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 200eb5dd authored by hhakim's avatar hhakim
Browse files

Fix hierar_fact_test old test script/mex API (new constraint attributes needed...

Fix hierar_fact_test old test script/mex API (new constraint attributes needed -- pos and normalized).
parent e58ebd64
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ if(BUILD_WRAPPER_MATLAB)
# "@" means "," and "$" means ";"
# 2nd arg : the ouputfile that stores all the things that will be display in the matlab command window
add_test(NAME MATLAB_FACT_HIER_MEX COMMAND ${FAUST_SRC_TEST_TOOL_DIR}/windows_test_matlab.bat "addpath('${FAUST_BIN_TEST_BIN_DIR}'@'${FAUST_BIN_TEST_TOOLS_DIR}')$set_path$hier_fact_test('matrix_hierarchical_fact'@'config_hierarchical_fact'@9407@1@'MEX')$" "${FAUST_BIN_TEST_OUTPUT_DIR}/MATLAB_FACT_HIER_MEX")
add_test(NAME MATLAB_FACT_HIER_MEX COMMAND ${FAUST_SRC_TEST_TOOL_DIR}/windows_test_matlab.bat "addpath('${FAUST_BIN_TEST_BIN_DIR}'@'${FAUST_BIN_TEST_TOOLS_DIR}')$set_path$hier_fact_test('matrix_hierarchical_fact'@'config_hierarchical_fact'@9402@1@'MEX')$" "${FAUST_BIN_TEST_OUTPUT_DIR}/MATLAB_FACT_HIER_MEX")
if(${SLOW_TESTS})
......@@ -57,7 +57,7 @@ if(BUILD_WRAPPER_MATLAB)
else(WIN32 AND NOT UNIX)
add_test(NAME MATLAB_FACT_HIER_MEX COMMAND matlab -nojvm -r "try;testpass=0;addpath('${FAUST_BIN_TEST_BIN_DIR}','${FAUST_BIN_TEST_TOOLS_DIR}');set_path;hier_fact_test('matrix_hierarchical_fact','config_hierarchical_fact',9407,1,'MEX'); catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)" )
add_test(NAME MATLAB_FACT_HIER_MEX COMMAND matlab -nojvm -r "try;testpass=0;addpath('${FAUST_BIN_TEST_BIN_DIR}','${FAUST_BIN_TEST_TOOLS_DIR}');set_path;hier_fact_test('matrix_hierarchical_fact','config_hierarchical_fact',9402,10,'MEX'); catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)" ) # TODO: lambda is 9407 on macOS (why ?)
......
......@@ -81,6 +81,22 @@ end
disp('*** MEX FACTORISATION ***');
tic
%[lambda,fact]=mexHierarchical_fact(matrix,params);
% workaround to the old API (we shouldn't directly use mexHierarchical_factReal now
% so here normalized and pos constraint attributes are set manually
%TODO: probably other default configurations should be taken into account
for j=1:2
for i=1:length(params.cons)
c = params.cons{j, i};
if any(strcmp(c{1}, {'normcol', 'normlin'}))
c = { c{:} false false}; % normalized, pos default values
else
c = { c{:} true false}; % normalized, pos default values
end
params.cons{j, i} = c;
end
end
[lambda, core_obj] = mexHierarchical_factReal(matrix, params);
F = Faust(core_obj, isreal(matrix));
t=toc;
......@@ -105,7 +121,7 @@ if (abs(lambda - expectedLambda) > expectedLambdaPrecision)
end
relative_error = norm(matrix - full(F));
relative_error = norm(matrix - full(F))/norm(matrix);
disp(['relative error : ' num2str(relative_error)]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment