32 for (int _j=0; _j<NBTRIES; ++_j) { \ 34 for (int _k=0; _k<REPEAT; ++_k) { \ 64 cs* cs_sorted_multiply(
const cs*
a,
const cs*
b)
68 cs*
A = cs_transpose(a, 1);
69 cs*
B = cs_transpose(b, 1);
70 cs*
D = cs_multiply(B,A);
74 cs*
C = cs_transpose (D, 1) ;
83 cs* cs_sorted_multiply2(
const cs*
a,
const cs*
b)
85 cs*
D = cs_multiply(
a,b);
86 cs*
E = cs_transpose(D,1);
88 cs*
C = cs_transpose(E,1);
96 int main(
int argc,
char *argv[])
104 EigenSparseMatrix sm1(rows,cols), sm2(rows,cols), sm3(rows,cols), sm4(rows,cols);
107 for (
int nnzPerCol =
NNZPERCOL; nnzPerCol>1; nnzPerCol/=1.1)
118 std::cout <<
"Eigen Dense\t" << nnzPerCol <<
"%\n";
125 for (
int k=0; k<
REPEAT; ++k)
128 std::cout <<
" a * b:\t" << timer.
value() << endl;
132 for (
int k=0; k<
REPEAT; ++k)
133 m3 =
m1.transpose() *
m2;
135 std::cout <<
" a' * b:\t" << timer.
value() << endl;
139 for (
int k=0; k<
REPEAT; ++k)
140 m3 =
m1.transpose() *
m2.transpose();
142 std::cout <<
" a' * b':\t" << timer.
value() << endl;
146 for (
int k=0; k<
REPEAT; ++k)
147 m3 =
m1 *
m2.transpose();
149 std::cout <<
" a * b':\t" << timer.
value() << endl;
155 std::cout <<
"Eigen sparse\t" << sm1.nonZeros()/(
float(sm1.rows())*
float(sm1.cols()))*100 <<
"% * " 156 << sm2.nonZeros()/(
float(sm2.rows())*
float(sm2.cols()))*100 <<
"%\n";
158 BENCH(sm3 = sm1 * sm2; )
159 std::cout <<
" a * b:\t" << timer.
value() << endl;
227 std::cout <<
"CSparse \t" << nnzPerCol <<
"%\n";
229 eiToCSparse(sm1, m1);
230 eiToCSparse(sm2, m2);
234 m3 = cs_sorted_multiply(m1, m2);
237 std::cerr <<
"cs_multiply failed\n";
244 std::cout <<
" a * b:\t" << timer.
value() << endl;
253 std::cout <<
"ublas\t" << nnzPerCol <<
"%\n";
259 std::cout <<
" a * b:\t" << timer.
value() << endl;
266 std::cout <<
"GMM++ sparse\t" << nnzPerCol <<
"%\n";
273 std::cout <<
" a * b:\t" << timer.
value() << endl;
297 std::cout <<
"MTL4\t" << nnzPerCol <<
"%\n";
303 std::cout <<
" a * b:\t" << timer.
value() << endl;
Matrix< Scalar, Dynamic, Dynamic > DenseMatrix
void eiToMtl(const EigenSparseMatrix &src, MtlSparse &dst)
int main(int argc, char *argv[])
Matrix< SCALARB, Dynamic, Dynamic > B
void fillMatrix2(int nnzPerCol, int rows, int cols, EigenSparseMatrix &dst)
void eiToDense(const EigenSparseMatrix &src, DenseMatrix &dst)
void eiToUblas(const EigenSparseMatrix &src, UBlasSparse &dst)
mtl::compressed2D< Scalar, mtl::matrix::parameters< mtl::tag::col_major > > MtlSparse
EIGEN_DONT_INLINE void prod(const Lhs &a, const Rhs &b, Res &c)
gmm::csc_matrix< Scalar > GmmSparse
Matrix< Scalar, Dynamic, Dynamic > C
double value(int TIMER=CPU_TIMER) const
boost::numeric::ublas::compressed_matrix< Scalar, boost::numeric::ublas::column_major > UBlasSparse
gmm::col_matrix< gmm::wsvector< Scalar > > GmmDynSparse
void eiToGmm(const EigenSparseMatrix &src, GmmSparse &dst)