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
Show more breadcrumbs
faust group
faust
Commits
694ada4d
Commit
694ada4d
authored
2 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Impl. MatButterfly::norm() with its unit test.
parent
7493b1b4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
misc/test/src/C++/faust_butterfly_mat.cpp.in
+9
-1
9 additions, 1 deletion
misc/test/src/C++/faust_butterfly_mat.cpp.in
src/faust_linear_operator/CPU/faust_MatButterfly.hpp
+3
-3
3 additions, 3 deletions
src/faust_linear_operator/CPU/faust_MatButterfly.hpp
with
12 additions
and
4 deletions
misc/test/src/C++/faust_butterfly_mat.cpp.in
+
9
−
1
View file @
694ada4d
...
@@ -40,7 +40,6 @@ void testClone(MatButterfly<FPP, Cpu>& butterflyMat)
...
@@ -40,7 +40,6 @@ void testClone(MatButterfly<FPP, Cpu>& butterflyMat)
delete clone;
delete clone;
}
}
void testTranspose(MatButterfly<FPP, Cpu>& butterflyMat, MatSparse<FPP, Cpu>& spButterflyMat)
void testTranspose(MatButterfly<FPP, Cpu>& butterflyMat, MatSparse<FPP, Cpu>& spButterflyMat)
{
{
auto size = butterflyMat.getNbRow();
auto size = butterflyMat.getNbRow();
...
@@ -155,6 +154,14 @@ void testScalMul(const MatButterfly<FPP, Cpu>& butterflyMat, const MatSparse<FP
...
@@ -155,6 +154,14 @@ void testScalMul(const MatButterfly<FPP, Cpu>& butterflyMat, const MatSparse<FP
std::cout << "MatButterfly scal. mul OK" << std::endl;
std::cout << "MatButterfly scal. mul OK" << std::endl;
}
}
void testNorm2(const MatButterfly<FPP, Cpu>& butterflyMat, const MatSparse<FPP, Cpu>& spButterflyMat)
{
// cout << butterflyMat.norm() << endl;
// cout << spButterflyMat.norm() << endl;
assert(std::abs(butterflyMat.norm() - spButterflyMat.norm()) < 1e-6);
std::cout << "MatButterfly fro-norm OK" << std::endl;
}
int main(int argc, char** argv)
int main(int argc, char** argv)
{
{
int log2size = 4;
int log2size = 4;
...
@@ -220,5 +227,6 @@ int main(int argc, char** argv)
...
@@ -220,5 +227,6 @@ int main(int argc, char** argv)
testType(butterflyMat);
testType(butterflyMat);
testScalMul(butterflyMat, spButterflyMat);
testScalMul(butterflyMat, spButterflyMat);
testNorm2(butterflyMat, spButterflyMat);
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}
}
This diff is collapsed.
Click to expand it.
src/faust_linear_operator/CPU/faust_MatButterfly.hpp
+
3
−
3
View file @
694ada4d
...
@@ -292,8 +292,7 @@ namespace Faust
...
@@ -292,8 +292,7 @@ namespace Faust
template
<
typename
FPP
>
template
<
typename
FPP
>
matvar_t
*
MatButterfly
<
FPP
,
Cpu
>::
toMatIOVar
(
bool
transpose
,
bool
conjugate
,
const
char
*
var_name
)
const
matvar_t
*
MatButterfly
<
FPP
,
Cpu
>::
toMatIOVar
(
bool
transpose
,
bool
conjugate
,
const
char
*
var_name
)
const
{
{
//TODO
throw
std
::
runtime_error
(
"Saving MatButterfly to a .mat file is not supported."
);
}
}
template
<
typename
FPP
>
template
<
typename
FPP
>
...
@@ -305,7 +304,8 @@ namespace Faust
...
@@ -305,7 +304,8 @@ namespace Faust
template
<
typename
FPP
>
template
<
typename
FPP
>
Real
<
FPP
>
MatButterfly
<
FPP
,
Cpu
>::
norm
()
const
Real
<
FPP
>
MatButterfly
<
FPP
,
Cpu
>::
norm
()
const
{
{
//TODO
auto
s
=
(
D1
.
diagonal
().
array
()
*
D1
.
diagonal
().
conjugate
().
array
()
+
D2
.
diagonal
().
array
()
*
D2
.
diagonal
().
conjugate
().
array
()).
sum
();
return
Faust
::
fabs
(
std
::
sqrt
(
s
));
}
}
template
<
typename
FPP
>
template
<
typename
FPP
>
...
...
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