Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.4.
Show more breadcrumbs
faust group
faust
Commits
bff69e68
Commit
bff69e68
authored
8 years ago
by
Nicolas Bellot
Committed by
hhakim
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[wrapper matlab] generate_Faust_config with various density
parent
fe2d51a5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
misc/test/CMakeLists.txt
+6
-6
6 additions, 6 deletions
misc/test/CMakeLists.txt
misc/test/src/generate_Faust_config.m
+36
-5
36 additions, 5 deletions
misc/test/src/generate_Faust_config.m
misc/test/src/test_matlab_faust.m
+11
-6
11 additions, 6 deletions
misc/test/src/test_matlab_faust.m
with
53 additions
and
17 deletions
misc/test/CMakeLists.txt
+
6
−
6
View file @
bff69e68
...
...
@@ -82,20 +82,20 @@ if(BUILD_WRAPPER_MATLAB)
# 1st factor sparse size 10x3,
# 2nd factor dense size 3x2,
# 3rd factor sparse size 2x5
add_test
(
NAME MATLAB_FAUST_CONFIG_REAL1 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([10,3,2,5],{'real.sparse','real.dense','real.sparse'});test_matlab_faust(factors,prod,30,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
add_test
(
NAME MATLAB_FAUST_CONFIG_REAL1 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([10,3,2,5],{'real.sparse','real.dense','real.sparse'}
,0.5
);test_matlab_faust(factors,prod,30,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
#test Faust with 3 real factors :
# 1st factor sparse size 5x2,
# 2nd factor dense size 2x3,
# 3rd factor sparse size 3x10
add_test
(
NAME MATLAB_FAUST_CONFIG_REAL2 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([5,2,3,10],{'real.dense','real.sparse','real.dense'});test_matlab_faust(factors,prod,30,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
add_test
(
NAME MATLAB_FAUST_CONFIG_REAL2 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([5,2,3,10],{'real.dense','real.sparse','real.dense'}
,0.5
);test_matlab_faust(factors,prod,30,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
#test Faust with 1 real factor :
# 1st factor dense size 10x3,
add_test
(
NAME MATLAB_FAUST_CONFIG_REAL3 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([100,10],{'real.dense'});test_matlab_faust(factors,prod,30,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
add_test
(
NAME MATLAB_FAUST_CONFIG_REAL3 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([100,10],{'real.dense'}
,1.0
);test_matlab_faust(factors,prod,30,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
#test Faust with 1 real factor :
# 1st factor sparse size 10x3,
add_test
(
NAME MATLAB_FAUST_CONFIG_REAL4 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([100,10],{'real.sparse'});test_matlab_faust(factors,prod,1000,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
add_test
(
NAME MATLAB_FAUST_CONFIG_REAL4 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([100,10],{'real.sparse'}
,0.1
);test_matlab_faust(factors,prod,1000,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
...
...
@@ -103,13 +103,13 @@ if(BUILD_WRAPPER_MATLAB)
# 1st factor real dense size 10x3,
# 2nd factor complex dense size 3x2,
# 3rd factor complex dense size 2x5
add_test
(
NAME MATLAB_FAUST_CONFIG_CPLX1 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([10,3,2,5],{'real.dense','complex.dense','complex.dense'});test_matlab_faust(factors,prod,30,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
add_test
(
NAME MATLAB_FAUST_CONFIG_CPLX1 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([10,3,2,5],{'real.dense','complex.dense','complex.dense'}
,0.5
);test_matlab_faust(factors,prod,30,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
#test Faust with 3 factors :
# 1st factor real sparse size 10x3,
# 2nd factor complex dense size 3x2,
# 3rd factor complex sparse size 2x5
add_test
(
NAME MATLAB_FAUST_CONFIG_CPLX2 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([10,3,2,5],{'real.sparse','complex.dense','complex.sparse'});test_matlab_faust(factors,prod,30,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
add_test
(
NAME MATLAB_FAUST_CONFIG_CPLX2 COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;[factors,prod]=generate_Faust_config([10,3,2,5],{'real.sparse','complex.dense','complex.sparse'}
,0.5
);test_matlab_faust(factors,prod,30,0);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
## test the matlab Faust class methods with incorrect parameter
...
...
This diff is collapsed.
Click to expand it.
misc/test/src/generate_Faust_config.m
+
36
−
5
View file @
bff69e68
...
...
@@ -65,7 +65,7 @@
% Topics in Signal Processing, 2016.
% <https://hal.archives-ouvertes.fr/hal-01167948v1>
%%
function
[
factors
,
dense
]
=
generate_Faust_config
(
list_dim
,
type_factor
)
function
[
factors
,
dense
]
=
generate_Faust_config
(
list_dim
,
type_factor
,
density
)
int_max
=
100
;
nb_fact
=
length
(
type_factor
);
if
(
length
(
list_dim
)
-
1
)
~=
nb_fact
...
...
@@ -78,27 +78,55 @@ int_max = 100;
factors
=
cell
(
1
,
nb_fact
);
dense
=
eye
(
list_dim
(
1
));
nbr_coeff_faust
=
0
;
for
i
=
1
:
nb_fact
nbr_coeff_faust
=
nbr_coeff_faust
+
prod
(
list_dim
(
i
:
i
+
1
));
end
nbr_coeff_dense_matrix
=
list_dim
(
1
)
*
list_dim
(
end
);
density_per_fact
=
density
*
nbr_coeff_dense_matrix
/
nbr_coeff_faust
;
for
i
=
1
:
nb_fact
nb_row
=
list_dim
(
i
);
nb_col
=
list_dim
(
i
+
1
);
nnz_fact
=
round
(
density_per_fact
*
nb_row
*
nb_col
);
if
(
nnz_fact
==
0
)
error
(
'factor with 0 non zeros coefficent '
);
else
if
(
nnz_fact
>
nb_row
*
nb_col
)
error
(
'too much element per factor'
);
end
end
type_current_fact
=
type_factor
{
i
};
celltype_current_fact
=
strsplit
(
type_current_fact
,
'.'
);
scalarType
=
celltype_current_fact
{
1
};
sparsityType
=
celltype_current_fact
{
2
};
fact_values
=
double
(
randi
(
int_max
,[
1
,
nnz_fact
]));
switch
scalarType
case
'real'
current_fact
=
double
(
randi
(
int_max
,
nb_row
,
nb_col
));
case
'complex'
current_fact
=
double
(
randi
(
int_max
,
nb_row
,
nb_col
)
+
1
i
*
randi
(
int_max
,
nb_row
,
nb_col
)
);
fact_values
=
fact_values
+
1
i
*
randi
(
int_max
,
[
1
,
nnz_fact
]
);
otherwise
error
(
'invalid scalar type'
);
end
dense
=
dense
*
current_fact
;
id_1D
=
randperm
(
nb_row
*
nb_col
,
nnz_fact
);
fact_id_row
=
mod
(
id_1D
-
1
,
nb_row
)
+
1
;
fact_id_col
=
floor
((
id_1D
-
1
)/
nb_row
)
+
1
;
current_fact
=
sparse
(
fact_id_row
,
fact_id_col
,
fact_values
,
nb_row
,
nb_col
,
nnz_fact
);
switch
sparsityType
case
'dense'
current_fact
=
full
(
current_fact
);
...
...
@@ -106,6 +134,9 @@ int_max = 100;
current_fact
=
sparse
(
current_fact
);
end
dense
=
dense
*
full
(
current_fact
);
factors
{
i
}
=
current_fact
;
end
...
...
This diff is collapsed.
Click to expand it.
misc/test/src/test_matlab_faust.m
+
11
−
6
View file @
bff69e68
...
...
@@ -59,7 +59,7 @@
function
test_matlab_faust
(
factors
,
expected_F_dense
,
dim3
,
copyOptimized
)
%function test_matlab_faust(dim1,dim2,dim3,nb_fact)
int_max
=
100
;
threshold
=
10
^
(
-
1
)
;
threshold
=
0.2
;
nb_fact
=
length
(
factors
);
...
...
@@ -83,11 +83,20 @@ else
scalarType
=
'real'
;
end
expected_nz
=
0
;
for
i
=
1
:
nb_fact
expected_nz
=
expected_nz
+
nnz
(
factors
{
i
});
end
expected_density
=
expected_nz
/(
dim1
*
dim2
);
disp
(
'****** TEST MATLAB_FAUST ******* '
);
disp
([
' CONFIG OF THE '
scalarType
' scalar FAUST '
]);
disp
([
'number of row of the Faust : '
int2str
(
dim1
)]);
disp
([
'number of column of the Faust : '
int2str
(
dim2
)]);
disp
([
'number of factor of the Faust : '
int2str
(
nb_fact
)]);
disp
([
'density of the Faust : '
num2str
(
expected_density
)]);
disp
(
''
);
disp
([
'number of column of the matrix that will be multiplied by the Faust : '
int2str
(
dim3
)]);
disp
(
''
);
...
...
@@ -190,10 +199,7 @@ disp('Ok');
%% full test
disp
(
'TEST NNZ : '
);
expected_nz
=
0
;
for
i
=
1
:
nb_fact
expected_nz
=
expected_nz
+
nnz
(
factors
{
i
});
end
nz
=
nnz
(
F
);
...
...
@@ -228,7 +234,6 @@ disp('Ok');
disp
(
'TEST DENSITY : '
);
expected_density
=
expected_nz
/
(
dim1
*
dim2
);
dens
=
density
(
F
);
if
(
dens
~=
expected_density
)
error
(
'density : invalid value'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment