6 #include <ext/hash_map> 7 #include <google/dense_hash_map> 8 #include <google/sparse_hash_map> 25 #define MINDENSITY 0.0004 34 for (int _j=0; _j<NBTRIES; ++_j) { \ 36 for (int _k=0; _k<REPEAT; ++_k) { \ 44 template<
typename SetterType>
51 SetterType* set1 =
new SetterType(sm1);
54 (*set1)(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)) += 1;
56 std::cout <<
"std::map => \t" << t.
value()-
rtime 57 <<
" nnz=" << set1->nonZeros() << std::flush;
62 std::cout <<
" back: \t" << t.
value() <<
"\n";
65 int main(
int argc,
char *argv[])
75 std::cout <<
"n = " <<
nentries <<
"\n";
81 dummy = internal::random<int>(0,rows-1) + internal::random<int>(0,cols-1);
84 std::cout <<
"rtime = " <<
rtime <<
" (" << dummy <<
")\n\n";
88 dostuff<RandomSetter<EigenSparseMatrix,StdMapTraits,Bits> >(
"std::map ", sm1);
89 dostuff<RandomSetter<EigenSparseMatrix,GnuHashMapTraits,Bits> >(
"gnu::hash_map", sm1);
90 dostuff<RandomSetter<EigenSparseMatrix,GoogleDenseHashMapTraits,Bits> >(
"google::dense", sm1);
91 dostuff<RandomSetter<EigenSparseMatrix,GoogleSparseHashMapTraits,Bits> >(
"google::sparse", sm1);
void dostuff(const char *name, EigenSparseMatrix &sm1)
int main(int argc, char *argv[])
double value(int TIMER=CPU_TIMER) const
Annotation for function names.