Bugzilla – Attachment 565 Details for
Bug 650
noalias += Row Major Sparse Matrix multiplication
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
unit test
650.cpp (text/x-c++src), 2.67 KB, created by
Jan van Dijk
on 2015-04-26 15:38:10 UTC
(
hide
)
Description:
unit test
Filename:
MIME Type:
Creator:
Jan van Dijk
Created:
2015-04-26 15:38:10 UTC
Size:
2.67 KB
patch
obsolete
>// This can be compiled as a stand-alone program for the moment, >// but has been written such that it will be easy to adopt it >// as a new unit test by removing the next few lines and replacing >// the main() function at the end of this file. >#include <iostream> >unsigned nerrors=0; >#define VERIFY_IS_APPROX(a,b) do { if ((a)!=(b)) { ++nerrors; std::cout << "TEST FAILED." << std::endl;} } while (0) > > >#include "Eigen/SparseCore" > >// #define TEST_NO_ALIAS to 1 to reproduce the compilation problems >// that are outlined in the comment trail of bug #650. >// Once resolved, it will test the correctness issues that were >// initially outlined in that report. > >#define TEST_NO_ALIAS 0 > >#if TEST_NO_ALIAS==1 >#define DOT_NOALIAS .noalias() >#else >#define DOT_NOALIAS >#endif > >// tests: >// R.noalias() += M1 >// R.noalias() += M1*M2 >// R.noalias() += M2*M1 >template <typename R, typename M1, typename M2> >int bug650_part() >{ > R res(1,1); > M1 m1(1,1); m1.setIdentity(); m1 *= 2; > M2 m2(1,1); m2.setIdentity(); m2 *= 3; > > res.setOnes(); > res DOT_NOALIAS += m1; > VERIFY_IS_APPROX(res(0,0), typename R::Scalar(3)); > > res.setOnes(); > res DOT_NOALIAS += m1 * m2; > VERIFY_IS_APPROX(res(0,0), typename R::Scalar(7)); > > res.setOnes(); > res DOT_NOALIAS += m2 * m1; > VERIFY_IS_APPROX(res(0,0), typename R::Scalar(7)); >} > >template <typename Scalar> >int bug650() >{ > using namespace Eigen; > typedef Matrix<Scalar, Dynamic, Dynamic, RowMajor> DenseRowMatrix; > typedef Matrix<Scalar, Dynamic, Dynamic, ColMajor> DenseColMatrix; > typedef SparseMatrix<Scalar,RowMajor> SparseRowMatrix; > typedef SparseMatrix<Scalar,ColMajor> SparseColMatrix; > > bug650_part<DenseRowMatrix,SparseRowMatrix,DenseRowMatrix>(); > bug650_part<DenseRowMatrix,SparseRowMatrix,DenseColMatrix>(); > bug650_part<DenseRowMatrix,SparseRowMatrix,SparseRowMatrix>(); > bug650_part<DenseRowMatrix,SparseRowMatrix,SparseColMatrix>(); > > bug650_part<DenseRowMatrix,SparseColMatrix,DenseRowMatrix>(); > bug650_part<DenseRowMatrix,SparseColMatrix,DenseColMatrix>(); > bug650_part<DenseRowMatrix,SparseColMatrix,SparseRowMatrix>(); > bug650_part<DenseRowMatrix,SparseColMatrix,SparseColMatrix>(); > > bug650_part<DenseColMatrix,SparseRowMatrix,DenseRowMatrix>(); > bug650_part<DenseColMatrix,SparseRowMatrix,DenseColMatrix>(); > bug650_part<DenseColMatrix,SparseRowMatrix,SparseRowMatrix>(); > bug650_part<DenseColMatrix,SparseRowMatrix,SparseColMatrix>(); > > bug650_part<DenseColMatrix,SparseColMatrix,DenseRowMatrix>(); > bug650_part<DenseColMatrix,SparseColMatrix,DenseColMatrix>(); > bug650_part<DenseColMatrix,SparseColMatrix,SparseRowMatrix>(); > bug650_part<DenseColMatrix,SparseColMatrix,SparseColMatrix>(); >} > > >int main() >{ > bug650<double>(); > std::cout << "number of errors: " << nerrors << std::endl; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 650
: 565