diff -r d8475431bbbb -r 8e85e6bbefdf src/benchmark/bench_tools.h --- a/src/benchmark/bench_tools.h Sat May 21 21:04:57 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -// -*- mode:C++ -*- -#ifndef LEMON_BENCH_TEST_H -#define LEMON_BENCH_TEST_H - -#include -#include - -#include - -///An experimental typedef factory -#define GRAPH_TYPEDEF_FACTORY(Graph) \ - typedef typename Graph:: Node Node;\ - typedef typename Graph:: NodeIt NodeIt;\ - typedef typename Graph:: Edge Edge;\ - typedef typename Graph:: EdgeIt EdgeIt;\ - typedef typename Graph:: InEdgeIt InEdgeIt;\ - typedef typename Graph::OutEdgeIt OutEdgeIt; - -#define GRAPH_TYPEDEF_FACTORY_NOTYPENAME(Graph) \ - typedef Graph:: Node Node;\ - typedef Graph:: NodeIt NodeIt;\ - typedef Graph:: Edge Edge;\ - typedef Graph:: EdgeIt EdgeIt;\ - typedef Graph:: InEdgeIt InEdgeIt;\ - typedef Graph::OutEdgeIt OutEdgeIt; - - -///A primitive primtest - -///\bug 2 is not a prime according to this function! -/// -///\bug This function should go out of header file. I'm making it -/// inline for now. -inline bool isPrim(int n) -{ - if(n%2) { - for(int k=3;n/k>=k;k+=2) - if(!(n%k)) return false; - return true; - } - return false; -} - -///Finds the smallest prime not less then \c n. - -///\bug This function should go out of header file. I'm making it -/// inline for now. -inline int nextPrim(int n) -{ - for(n+=!(n%2);!isPrim(n);n+=2) ; - return n; -} - - -/// Class to generate consecutive primes -class Primes -{ - std::vector primes; - int n; - - bool isPrime(int m) - { - for(int i=0;m -void addHiperCube(Graph &G,int dim,std::vector &nodes) -{ - GRAPH_TYPEDEF_FACTORY(Graph); - - std::vector bits(dim+1); - bits[0]=1; - for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1]; - - for(int i=0;i -void addBiDirHiperCube(Graph &G,int dim,std::vector&nodes) -{ - GRAPH_TYPEDEF_FACTORY(Graph); - - std::vector bits(dim+1); - bits[0]=1; - for(int i=1;i<=dim;i++) bits[i]=2*bits[i-1]; - - for(int i=0;i