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
319d600e
Commit
319d600e
authored
2 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add a unit test for (faust_prod_opt) dynprog_multiply C++ function.
parent
99ef5d23
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/CMakeLists.txt
+1
-1
1 addition, 1 deletion
misc/test/CMakeLists.txt
misc/test/src/C++/test_dynprog_mul_cpu.cpp.in
+36
-0
36 additions, 0 deletions
misc/test/src/C++/test_dynprog_mul_cpu.cpp.in
with
37 additions
and
1 deletion
misc/test/CMakeLists.txt
+
1
−
1
View file @
319d600e
...
...
@@ -193,7 +193,7 @@ if(MATIO_LIB_FILE AND MATIO_INC_DIR AND BUILD_READ_MAT_FILE AND NOT NOCPPTESTS)
# faust_multiplication : time comparison between Faust-vector product and Dense matrix-vector product
list
(
APPEND tests hierarchicalFactorization hierarchicalFactorizationFFT test_palm4MSA test_palm4MSAFFT faust_multiplication faust_matdense_conjugate GivensFGFT GivensFGFTSparse GivensFGFTParallel GivensFGFTParallelSparse test_MatDiag faust_matsparse_mul faust_matsparse_index_op GivensFGFTComplex GivensFGFTComplexSparse GivensFGFTParallelComplex faust_toeplitz faust_circ faust_hankel faust_sparse_prox_sp palm4msa_2020 hierarchical2020 hierarchical2020Hadamard hierarchicalFactorizationHadamard hierarchicalFactorizationButterfly hierarchicalFactorizationButterflyBalanced test_MatBSR
)
list
(
APPEND tests hierarchicalFactorization hierarchicalFactorizationFFT test_palm4MSA test_palm4MSAFFT faust_multiplication faust_matdense_conjugate GivensFGFT GivensFGFTSparse GivensFGFTParallel GivensFGFTParallelSparse test_MatDiag faust_matsparse_mul faust_matsparse_index_op GivensFGFTComplex GivensFGFTComplexSparse GivensFGFTParallelComplex faust_toeplitz faust_circ faust_hankel faust_sparse_prox_sp palm4msa_2020 hierarchical2020 hierarchical2020Hadamard hierarchicalFactorizationHadamard hierarchicalFactorizationButterfly hierarchicalFactorizationButterflyBalanced test_MatBSR
test_dynprog_mul_cpu
)
if
(
FAUST_TORCH
)
list
(
APPEND tests faust_torch
)
...
...
This diff is collapsed.
Click to expand it.
misc/test/src/C++/test_dynprog_mul_cpu.cpp.in
0 → 100644
+
36
−
0
View file @
319d600e
#include "faust_TransformHelper.h"
#include "faust_prod_opt.h"
#include <cstdlib>
#include <ctime>
typedef @TEST_FPP@ FPP;
using namespace Faust;
int main()
{
srand(time(NULL));
unsigned int min_num_factors = 2;
unsigned int max_num_factors = 10;
unsigned int min_dim_size = 10;
unsigned int max_dim_size = 1024;
float density = .5f;
bool per_row = true;
auto F = TransformHelper<FPP, Cpu>::randFaust(MIXED, min_num_factors, max_num_factors, min_dim_size, max_dim_size, density, per_row);
//TODO: fix always two factors
F->display();
// convert the Faust to a vector of matrices
std::vector<MatGeneric<FPP, Cpu>*> data(F->begin(), F->end());
// for(auto f: data)
// f->Display();
// MatDense<FPP, Cpu> dynprog_multiply(std::vector<MatGeneric<FPP, Cpu>*>& factors, const char op/*='N'*/, const MatGeneric<FPP, Cpu>* A/*=nullptr*/)
auto res_mat = dynprog_multiply(data);
auto ref_mat = F->get_product();
auto test_mat = ref_mat;
test_mat -= res_mat;
auto re = test_mat.norm() / ref_mat.norm();
std::cout << "rel. err of test_mat vs ref_mat: " << re << std::endl;
assert(re < 1e-4);
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