21 #define MINDENSITY 0.0004 30 for (int _j=0; _j<NBTRIES; ++_j) { \ 32 for (int _k=0; _k<REPEAT; ++_k) { \ 38 cs* cs_sorted_multiply(
const cs*
a,
const cs*
b)
40 cs*
A = cs_transpose (a, 1) ;
41 cs*
B = cs_transpose (b, 1) ;
42 cs*
D = cs_multiply (B,A) ;
46 cs*
C = cs_transpose (D, 1) ;
52 int main(
int argc,
char *argv[])
71 std::cout <<
"Eigen Dense\t" << density*100 <<
"%\n";
77 for (
int k=0; k<
REPEAT; ++k)
80 std::cout <<
" a * v:\t" << timer.
best() <<
" " << double(REPEAT)/timer.
best() <<
" * / sec " << endl;
84 for (
int k=0; k<
REPEAT; ++k)
85 v2 = m1.transpose() *
v1;
87 std::cout <<
" a' * v:\t" << timer.
best() << endl;
95 BENCH(
asm(
"#myc"); v2 = sm1 *
v1;
asm(
"#myd");)
101 std::cout <<
" a' * v:\t" << timer.
best()/
REPEAT << endl;
118 std::cout <<
"GMM++ sparse\t" << density*100 <<
"%\n";
123 std::vector<Scalar> gmmV1(cols), gmmV2(cols);
127 BENCH(
asm(
"#myx"); gmm::mult(m1, gmmV1, gmmV2);
asm(
"#myy"); )
128 std::cout <<
" a * v:\t" << timer.
value() << endl;
130 BENCH( gmm::mult(gmm::transposed(m1), gmmV1, gmmV2); )
131 std::cout <<
" a' * v:\t" << timer.
value() << endl;
137 std::cout <<
"ublas sparse\t" << density*100 <<
"%\n";
141 boost::numeric::ublas::vector<Scalar> uv1, uv2;
150 std::cout <<
" a * v:\t" << timer.
value() << endl;
160 std::cout <<
"MTL4\t" << density*100 <<
"%\n";
163 mtl::dense_vector<Scalar> mtlV1(cols, 1.0);
164 mtl::dense_vector<Scalar> mtlV2(cols, 1.0);
168 for (
int k=0; k<
REPEAT; ++k)
171 std::cout <<
" a * v:\t" << timer.
value() << endl;
175 for (
int k=0; k<
REPEAT; ++k)
176 mtlV2 =
trans(m1) * mtlV1;
178 std::cout <<
" a' * v:\t" << timer.
value() << endl;
Matrix< Scalar, Dynamic, Dynamic > DenseMatrix
void eiToMtl(const EigenSparseMatrix &src, MtlSparse &dst)
A matrix or vector expression mapping an existing array of data.
int main(int argc, char *argv[])
void eiToUblasVec(const EigenType &src, UblasType &dst)
Matrix< SCALARB, Dynamic, Dynamic > B
void fillMatrix2(int nnzPerCol, int rows, int cols, EigenSparseMatrix &dst)
Matrix< Scalar, Dynamic, 1 > DenseVector
void eiToDense(const EigenSparseMatrix &src, DenseMatrix &dst)
void eiToUblas(const EigenSparseMatrix &src, UBlasSparse &dst)
TransposeReturnType transpose()
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
double best(int TIMER=CPU_TIMER) const
boost::numeric::ublas::compressed_matrix< Scalar, boost::numeric::ublas::column_major > UBlasSparse
void eiToGmm(const EigenSparseMatrix &src, GmmSparse &dst)