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
420c548b
Commit
420c548b
authored
2 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add unit test for MatButterfly::transpose and refactor clone unit test in its own function.
parent
22149efa
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/C++/faust_butterfly_mat.cpp.in
+47
-14
47 additions, 14 deletions
misc/test/src/C++/faust_butterfly_mat.cpp.in
with
47 additions
and
14 deletions
misc/test/src/C++/faust_butterfly_mat.cpp.in
+
47
−
14
View file @
420c548b
...
...
@@ -6,6 +6,51 @@ typedef @TEST_FPP@ FPP;
using namespace Faust;
void testClone(MatButterfly<FPP, Cpu>& butterflyMat)
{
auto size = butterflyMat.getNbRow();
auto clone = butterflyMat.Clone();
auto X = MatDense<FPP, Cpu>::randMat(size, size);
MatDense<FPP, Cpu> refY_(*X);
MatDense<FPP, Cpu> testY_(*X);
butterflyMat.multiply(refY_, 'N');
clone->multiply(testY_, 'N');
auto errY_ = testY_;
errY_ -= refY_;
assert(errY_.norm() <= 1e-6);
std::cout << "MatButterfly cloning OK" << std::endl;
delete X;
delete clone;
}
void testTranspose(MatButterfly<FPP, Cpu>& butterflyMat, MatSparse<FPP, Cpu>& spButterflyMat)
{
auto size = butterflyMat.getNbRow();
MatSparse<FPP, Cpu> trefsp(spButterflyMat);
trefsp.transpose();
MatButterfly<FPP, Cpu> ttest(butterflyMat);
ttest.transpose();
auto X = MatDense<FPP, Cpu>::randMat(size, size);
MatDense<FPP, Cpu> refY_(*X);
MatDense<FPP, Cpu> testY_(*X);
trefsp.multiply(refY_, 'N');
ttest.multiply(testY_, 'N');
auto errY_ = testY_;
errY_ -= refY_;
assert(errY_.norm() <= 1e-6);
std::cout << "MatButterfly transpose OK" << std::endl;
delete X;
}
int main(int argc, char** argv)
{
int log2size = 4;
...
...
@@ -65,21 +110,9 @@ int main(int argc, char** argv)
std::cout << "Faust-sparse matrix product OK" << std::endl;
// test Clone
auto clone = butterflyMat.Clone();
auto X_ = MatDense<FPP, Cpu>::randMat(size, size);
MatDense<FPP, Cpu> refY_(*X);
MatDense<FPP, Cpu> testY_(*X);
butterflyMat.multiply(refY_, 'N');
clone->multiply(testY_, 'N');
testClone(butterflyMat);
auto errY_ = testY_;
errY_ -= refY_;
assert(errY_.norm() <= 1e-6);
std::cout << "MatButterfly cloning OK" << std::endl;
testTranspose(butterflyMat, spButterflyMat);
return EXIT_SUCCESS;
}
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