diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-06-24 23:21:48 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-06-24 23:21:48 +0000 |
commit | ebbc6f0639383356c23a6b32c9f8c748451d4ba2 (patch) | |
tree | 5230ad85b3245a1883c68778dc5ebf79abd99d2a | |
parent | 1c910fb89ee11f47c3ab22e3e6c66546accabc86 (diff) |
cygwin compile
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@24 ec762483-ff6d-05da-a07a-a48fb63a330f
-rw-r--r-- | decoder/sampler.h | 9 | ||||
-rw-r--r-- | gi/clda/src/timer.h | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/decoder/sampler.h b/decoder/sampler.h index 4d0b2e64..cc13229b 100644 --- a/decoder/sampler.h +++ b/decoder/sampler.h @@ -7,6 +7,7 @@ #include <iostream> #include <fstream> #include <vector> +#include <ctime> #include <boost/random/mersenne_twister.hpp> #include <boost/random/uniform_real.hpp> @@ -28,7 +29,7 @@ struct RandomNumberGenerator { } if (r.fail() || !r) { std::cerr << "Warning: could not read from /dev/urandom. Seeding from clock" << std::endl; - seed = time(NULL); + seed = std::time(NULL); } std::cerr << "Seeding random number sequence to " << seed << std::endl; return seed; @@ -113,7 +114,7 @@ size_t RandomNumberGenerator<RNG>::SelectSample(const SampleSet& ss, double T) { } //for (size_t i = 0; i < ss.m_scores.size(); ++i) std::cerr << ss.m_scores[i] << ","; //std::cerr << std::endl; - + prob_t random(this->next()); // random number between 0 and 1 random *= sum; // scale with normalization factor //std::cerr << "Random number " << random << std::endl; @@ -123,10 +124,10 @@ size_t RandomNumberGenerator<RNG>::SelectSample(const SampleSet& ss, double T) { sum = ss.m_scores[0]; if (anneal) { sum.poweq(annealing_factor); - for (; position < ss.m_scores.size() && sum < random; ++position) + for (; position < ss.m_scores.size() && sum < random; ++position) sum += ss.m_scores[position].pow(annealing_factor); } else { - for (; position < ss.m_scores.size() && sum < random; ++position) + for (; position < ss.m_scores.size() && sum < random; ++position) sum += ss.m_scores[position]; } //std::cout << "random: " << random << " sample: " << position << std::endl; diff --git a/gi/clda/src/timer.h b/gi/clda/src/timer.h index ca26b304..123d9a94 100644 --- a/gi/clda/src/timer.h +++ b/gi/clda/src/timer.h @@ -1,6 +1,8 @@ #ifndef _TIMER_STATS_H_ #define _TIMER_STATS_H_ +#include <ctime> + struct Timer { Timer() { Reset(); } void Reset() { @@ -12,7 +14,7 @@ struct Timer { return elapsed; } private: - clock_t start_t; + std::clock_t start_t; }; #endif |