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
1d5cc280
Commit
1d5cc280
authored
3 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add matfaust PALM4MSA 2016/2020 unit tests.
parent
bb39efc2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc/test/src/Matlab/FaustFactoryTest.m
+80
-12
80 additions, 12 deletions
misc/test/src/Matlab/FaustFactoryTest.m
with
80 additions
and
12 deletions
misc/test/src/Matlab/FaustFactoryTest.m
+
80
−
12
View file @
1d5cc280
...
...
@@ -82,16 +82,40 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
this
.
verifyEqual
(
norm
(
E
,
'fro'
)/
norm
(
M
,
'fro'
),
0.2710
,
'AbsTol'
,
0.0001
)
end
function
test_palm4msaCplxDeftInitFacts
(
this
)
disp
(
'Test matfaust.fact.palm4msaCplx()'
)
import
matfaust
.
factparams
.*
num_facts
=
2
;
is_update_way_R2L
=
false
;
init_lambda
=
1.0
;
%M = rand(500, 32)
load
([
this
.
faust_paths
{
1
},
'../../../misc/data/mat/config_compared_palm2.mat'
]);
% data matrix is loaded from file
M
=
data
+
j
*
data
;
cons
=
cell
(
2
,
1
);
cons
{
1
}
=
ConstraintInt
(
ConstraintName
(
ConstraintName
.
SPLIN
),
500
,
32
,
5
);
cons
{
2
}
=
ConstraintReal
(
ConstraintName
(
ConstraintName
.
NORMCOL
),
32
,
32
,
1.0
);
stop_crit
=
StoppingCriterion
(
200
);
params
=
ParamsPalm4MSA
(
cons
,
stop_crit
,
'is_update_way_R2L'
,
is_update_way_R2L
,
'init_lambda'
,
init_lambda
);
F
=
matfaust
.
fact
.
palm4msa
(
M
,
params
)
this
.
verifyEqual
(
size
(
F
),
size
(
M
))
%disp('norm F: ')
%norm(F, 'fro')
E
=
full
(
F
)
-
M
;
disp
(
'err: '
)
norm
(
E
,
'fro'
)/
norm
(
M
,
'fro'
)
this
.
verifyEqual
(
norm
(
E
,
'fro'
)/
norm
(
M
,
'fro'
),
0.272814
,
'AbsTol'
,
0.0001
)
end
function
test_palm4msaCplx
(
this
)
disp
(
'Test matfaust.fact.palm4msaCplx()'
)
import
matfaust
.*
import
matfaust
.
factparams
.*
num_facts
=
2
;
is_update_way_R2L
=
false
;
init_lambda
=
1.0
;
init_facts
=
cell
(
2
,
1
);
init_facts
{
1
}
=
zeros
(
500
,
32
)
;
init_facts
{
2
}
=
eye
(
32
);
init_facts
{
1
}
=
complex
(
zeros
(
500
,
32
)
);
% type consistency with M is verified by palm4msa
init_facts
{
2
}
=
complex
(
eye
(
32
)
)
;
%M = rand(500, 32)
load
([
this
.
faust_paths
{
1
},
'../../../misc/data/mat/config_compared_palm2.mat'
]);
% data matrix is loaded from file
...
...
@@ -100,7 +124,7 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
cons
{
1
}
=
ConstraintInt
(
ConstraintName
(
ConstraintName
.
SPLIN
),
500
,
32
,
5
);
cons
{
2
}
=
ConstraintReal
(
ConstraintName
(
ConstraintName
.
NORMCOL
),
32
,
32
,
1.0
);
stop_crit
=
StoppingCriterion
(
200
);
params
=
ParamsPalm4MSA
(
cons
,
stop_crit
,
'is_update_way_R2L'
,
is_update_way_R2L
,
'init_lambda'
,
init_lambda
);
params
=
ParamsPalm4MSA
(
cons
,
stop_crit
,
'is_update_way_R2L'
,
is_update_way_R2L
,
'init_lambda'
,
init_lambda
,
'init_facts'
,
init_facts
);
F
=
matfaust
.
fact
.
palm4msa
(
M
,
params
)
this
.
verifyEqual
(
size
(
F
),
size
(
M
))
%disp('norm F: ')
...
...
@@ -111,9 +135,60 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
this
.
verifyEqual
(
norm
(
E
,
'fro'
)/
norm
(
M
,
'fro'
),
0.272814
,
'AbsTol'
,
0.0001
)
end
function
test_palm4msa2020Cplx
(
this
)
disp
(
'Test matfaust.fact.palm4msaCplx()'
)
import
matfaust
.
factparams
.*
num_facts
=
2
;
is_update_way_R2L
=
false
;
init_lambda
=
1.0
;
init_facts
=
cell
(
2
,
1
);
init_facts
{
1
}
=
complex
(
zeros
(
500
,
32
));
% type consistency with M is verified by palm4msa
init_facts
{
2
}
=
complex
(
eye
(
32
));
%M = rand(500, 32)
load
([
this
.
faust_paths
{
1
},
'../../../misc/data/mat/config_compared_palm2.mat'
]);
% data matrix is loaded from file
M
=
data
+
j
*
data
;
cons
=
cell
(
2
,
1
);
cons
{
1
}
=
ConstraintInt
(
ConstraintName
(
ConstraintName
.
SPLIN
),
500
,
32
,
5
);
cons
{
2
}
=
ConstraintReal
(
ConstraintName
(
ConstraintName
.
NORMCOL
),
32
,
32
,
1.0
);
stop_crit
=
StoppingCriterion
(
200
);
params
=
ParamsPalm4MSA
(
cons
,
stop_crit
,
'is_update_way_R2L'
,
is_update_way_R2L
,
'init_lambda'
,
init_lambda
,
'init_facts'
,
init_facts
);
F
=
matfaust
.
fact
.
palm4msa
(
M
,
params
,
'backend'
,
2020
)
this
.
verifyEqual
(
size
(
F
),
size
(
M
))
%disp('norm F: ')
%norm(F, 'fro')
E
=
full
(
F
)
-
M
;
disp
(
'err: '
)
norm
(
E
,
'fro'
)/
norm
(
M
,
'fro'
)
this
.
verifyEqual
(
norm
(
E
,
'fro'
)/
norm
(
M
,
'fro'
),
0.272814
,
'AbsTol'
,
0.0001
)
end
function
test_palm4msa2020CplxDeftInitFacts
(
this
)
disp
(
'Test matfaust.fact.palm4msaCplx()'
)
import
matfaust
.
factparams
.*
num_facts
=
2
;
is_update_way_R2L
=
false
;
init_lambda
=
1.0
;
load
([
this
.
faust_paths
{
1
},
'../../../misc/data/mat/config_compared_palm2.mat'
]);
% data matrix is loaded from file
M
=
data
+
j
*
data
;
cons
=
cell
(
2
,
1
);
cons
{
1
}
=
ConstraintInt
(
ConstraintName
(
ConstraintName
.
SPLIN
),
500
,
32
,
5
);
cons
{
2
}
=
ConstraintReal
(
ConstraintName
(
ConstraintName
.
NORMCOL
),
32
,
32
,
1.0
);
stop_crit
=
StoppingCriterion
(
200
);
params
=
ParamsPalm4MSA
(
cons
,
stop_crit
,
'is_update_way_R2L'
,
is_update_way_R2L
,
'init_lambda'
,
init_lambda
);
F
=
matfaust
.
fact
.
palm4msa
(
M
,
params
,
'backend'
,
2020
)
this
.
verifyEqual
(
size
(
F
),
size
(
M
))
%disp('norm F: ')
%norm(F, 'fro')
E
=
full
(
F
)
-
M
;
disp
(
'err: '
)
norm
(
E
,
'fro'
)/
norm
(
M
,
'fro'
)
this
.
verifyEqual
(
norm
(
E
,
'fro'
)/
norm
(
M
,
'fro'
),
0.272814
,
'AbsTol'
,
0.0001
)
end
function
test_hierarchical
(
this
)
disp
(
'Test matfaust.fact.hierarchical()'
)
import
matfaust
.*
import
matfaust
.
factparams
.*
num_facts
=
4
;
is_update_way_R2L
=
false
;
...
...
@@ -152,7 +227,6 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
function
test_hierarchical2020
(
this
)
disp
(
'Test matfaust.fact.hierarchical()'
)
import
matfaust
.*
import
matfaust
.
factparams
.*
num_facts
=
4
;
is_update_way_R2L
=
false
;
...
...
@@ -191,7 +265,6 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
function
test_hierarchicalCplx
(
this
)
disp
(
'Test matfaust.fact.hierarchicalCplx()'
)
import
matfaust
.*
import
matfaust
.
factparams
.*
num_facts
=
4
;
is_update_way_R2L
=
false
;
...
...
@@ -231,7 +304,6 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
function
test_fgft_givens
(
this
)
disp
(
'Test matfaust.fact.fgft_givens()'
)
import
matfaust
.*
load
([
this
.
faust_paths
{
1
}
'../../../misc/data/mat/test_GivensDiag_Lap_U_J.mat'
])
% Lap and J available
[
F
,
D
]
=
matfaust
.
fact
.
eigtj
(
Lap
,
'nGivens'
,
J
,
'enable_large_Faust'
,
true
,
'nGivens_per_fac'
,
1
);
%, 0, 'verbosity', 1);
...
...
@@ -251,7 +323,6 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
function
test_fgft_givens_sparse
(
this
)
disp
(
'Test matfaust.fact.fgft_givens()'
)
import
matfaust
.*
load
([
this
.
faust_paths
{
1
}
'../../../misc/data/mat/test_GivensDiag_Lap_U_J.mat'
])
% Lap and J available
[
F
,
D
]
=
matfaust
.
fact
.
eigtj
(
sparse
(
Lap
),
'nGivens'
,
J
,
'enable_large_Faust'
,
true
,
'nGivens_per_fac'
,
1
);
%, 0, 'verbosity', 1);
...
...
@@ -271,7 +342,6 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
function
test_fgft_givens_parallel
(
this
)
disp
(
'Test matfaust.fact.fgft_givens() -- parallel'
)
import
matfaust
.*
load
([
this
.
faust_paths
{
1
}
'../../../misc/data/mat/test_GivensDiag_Lap_U_J.mat'
])
% Lap and J available
t
=
size
(
Lap
,
1
)/
2
;
...
...
@@ -292,7 +362,6 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
function
test_fgft_givens_parallel_sparse
(
this
)
disp
(
'Test matfaust.fact.fgft_givens_sparse() -- parallel'
)
import
matfaust
.*
load
([
this
.
faust_paths
{
1
}
'../../../misc/data/mat/test_GivensDiag_Lap_U_J.mat'
])
% Lap and J available
t
=
size
(
Lap
,
1
)/
2
;
...
...
@@ -313,7 +382,6 @@ classdef FaustFactoryTest < matlab.unittest.TestCase
function
test_fgft_palm
(
this
)
disp
(
'Test matfaust.fact.fgft_palm()'
)
import
matfaust
.*
import
matfaust
.
factparams
.*
num_facts
=
4
;
is_update_way_R2L
=
false
;
...
...
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