Mentions légales du service

Skip to content
Snippets Groups Projects
Commit c42a0e41 authored by hhakim's avatar hhakim
Browse files

Add a unit test for MatButterfly-MatSparse multiplication.

parent 310da14c
No related branches found
No related tags found
No related merge requests found
...@@ -35,32 +35,35 @@ int main(int argc, char** argv) ...@@ -35,32 +35,35 @@ int main(int argc, char** argv)
std::cout << "butterfly-vector product OK" << std::endl; std::cout << "butterfly-vector product OK" << std::endl;
// // test multiplying a MatDense // test multiplying a MatDense
// auto X = MatDense<FPP, Cpu>::randMat(size, size); auto X = MatDense<FPP, Cpu>::randMat(size, size);
// // X->setOnes(); MatDense<FPP, Cpu> refY(*X);
// MatDense<FPP, Cpu> testY(*X);
// auto refY = spButterflyMat.multiply(*X);
// auto testY = butterflyMat.multiply(*X); spButterflyMat.multiply(refY, 'N');
// butterflyMat.multiply(testY, 'N');
//
// auto errY = testY;
// errY -= refY; auto errY = testY;
// assert(errY.norm() <= 1e-6); errY -= refY;
// assert(errY.norm() <= 1e-6);
// std::cout << "Faust-dense matrix product OK" << std::endl;
// std::cout << "Faust-dense matrix product OK" << std::endl;
// // test multiplying a MatSparse
// auto spX = MatSparse<FPP, Cpu>::randMat(size, size, .2); // test multiplying a MatSparse
// // X->setOnes(); auto spX = MatSparse<FPP, Cpu>::randMat(size, size, .2);
// MatSparse<FPP, Cpu> refYsp(*spX);
// auto refYsp = spButterflyMat.multiply(*spX); MatSparse<FPP, Cpu> testYsp(*spX);
// auto testYsp = butterflyMat.multiply(*spX, 'N'); // X->setOnes();
//
// auto errYsp = testYsp; spButterflyMat.multiply(refYsp, 'N');
// errYsp -= refYsp; butterflyMat.multiply(testYsp, 'N');
// assert(errYsp.norm() <= 1e-6);
// MatDense<FPP, Cpu> errYsp = testYsp;
// std::cout << "Faust-sparse matrix product OK" << std::endl; errYsp -= refYsp;
assert(errYsp.norm() <= 1e-6);
std::cout << "Faust-sparse matrix product OK" << std::endl;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment