4 #define EIGEN_GOOGLEHASH_SUPPORT 1 7 #include <ext/hash_map> 8 #include <google/dense_hash_map> 9 #include <google/sparse_hash_map> 26 #define MINDENSITY 0.0004 35 for (int _j=0; _j<NBTRIES; ++_j) { \ 37 for (int _k=0; _k<REPEAT; ++_k) { \ 45 template<
typename SetterType>
52 SetterType* set1 =
new SetterType(sm1);
55 (*set1)(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)) += 1;
57 std::cout <<
"std::map => \t" << t.
value()-
rtime 58 <<
" nnz=" << set1->nonZeros() << std::flush;
63 std::cout <<
" back: \t" << t.
value() <<
"\n";
66 int main(
int argc,
char *argv[])
76 std::cout <<
"n = " <<
nentries <<
"\n";
82 dummy = internal::random<int>(0,rows-1) + internal::random<int>(0,cols-1);
85 std::cout <<
"rtime = " <<
rtime <<
" (" << dummy <<
")\n\n";
89 dostuff<RandomSetter<EigenSparseMatrix,StdMapTraits,Bits> >(
"std::map ", sm1);
90 dostuff<RandomSetter<EigenSparseMatrix,GnuHashMapTraits,Bits> >(
"gnu::hash_map", sm1);
91 dostuff<RandomSetter<EigenSparseMatrix,GoogleDenseHashMapTraits,Bits> >(
"google::dense", sm1);
92 dostuff<RandomSetter<EigenSparseMatrix,GoogleSparseHashMapTraits,Bits> >(
"google::sparse", sm1);
void dostuff(const char *name, EigenSparseMatrix &sm1)
double value(int TIMER=CPU_TIMER) const
int main(int argc, char *argv[])
Annotation for function names.