Removed boost/random usage from linear and discrete directories
							parent
							
								
									8b201f07bb
								
							
						
					
					
						commit
						7d86b073e6
					
				|  | @ -23,13 +23,11 @@ | |||
| #include <gtsam/base/debug.h> | ||||
| 
 | ||||
| #include <boost/make_shared.hpp> | ||||
| #include <boost/random/mersenne_twister.hpp> | ||||
| #include <boost/random/uniform_real.hpp> | ||||
| #include <boost/random/variate_generator.hpp> | ||||
| 
 | ||||
| #include <vector> | ||||
| #include <algorithm> | ||||
| #include <random> | ||||
| #include <stdexcept> | ||||
| #include <vector> | ||||
| 
 | ||||
| using namespace std; | ||||
| 
 | ||||
|  | @ -176,8 +174,7 @@ size_t DiscreteConditional::solve(const Values& parentsValues) const { | |||
| /* ******************************************************************************** */ | ||||
| size_t DiscreteConditional::sample(const Values& parentsValues) const { | ||||
| 
 | ||||
|   using boost::uniform_real; | ||||
|   static boost::mt19937 gen(2); // random number generator
 | ||||
|   static mt19937 rng(2); // random number generator
 | ||||
| 
 | ||||
|   bool debug = ISDEBUG("DiscreteConditional::sample"); | ||||
| 
 | ||||
|  | @ -209,9 +206,8 @@ size_t DiscreteConditional::sample(const Values& parentsValues) const { | |||
|   } | ||||
| 
 | ||||
|   // inspired by http://www.boost.org/doc/libs/1_46_1/doc/html/boost_random/tutorial.html
 | ||||
|   uniform_real<> dist(0, cdf.back()); | ||||
|   boost::variate_generator<boost::mt19937&, uniform_real<> > die(gen, dist); | ||||
|   size_t sampled = lower_bound(cdf.begin(), cdf.end(), die()) - cdf.begin(); | ||||
|   uniform_real_distribution<double> dist(0, cdf.back()); | ||||
|   size_t sampled = lower_bound(cdf.begin(), cdf.end(), dist(rng)) - cdf.begin(); | ||||
|   if (debug) | ||||
|     cout << "-> " << sampled << endl; | ||||
| 
 | ||||
|  |  | |||
|  | @ -21,15 +21,13 @@ | |||
| 
 | ||||
| #include <boost/format.hpp> | ||||
| #include <boost/make_shared.hpp> | ||||
| #include <boost/random/linear_congruential.hpp> | ||||
| #include <boost/random/normal_distribution.hpp> | ||||
| #include <boost/random/variate_generator.hpp> | ||||
| 
 | ||||
| #include <limits> | ||||
| #include <iostream> | ||||
| #include <typeinfo> | ||||
| #include <stdexcept> | ||||
| #include <cmath> | ||||
| #include <iostream> | ||||
| #include <limits> | ||||
| #include <random> | ||||
| #include <stdexcept> | ||||
| #include <typeinfo> | ||||
| 
 | ||||
| using namespace std; | ||||
| 
 | ||||
|  |  | |||
|  | @ -46,10 +46,9 @@ Vector Sampler::sampleDiagonal(const Vector& sigmas) { | |||
|     if (sigma == 0.0) { | ||||
|       result(i) = 0.0; | ||||
|     } else { | ||||
|       typedef boost::normal_distribution<double> Normal; | ||||
|       typedef std::normal_distribution<double> Normal; | ||||
|       Normal dist(0.0, sigma); | ||||
|       boost::variate_generator<boost::mt19937_64&, Normal> norm(generator_, dist); | ||||
|       result(i) = norm(); | ||||
|       result(i) = dist(generator_); | ||||
|     } | ||||
|   } | ||||
|   return result; | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ | |||
| 
 | ||||
| #include <gtsam/linear/NoiseModel.h> | ||||
| 
 | ||||
| #include <boost/random.hpp> | ||||
| #include <random> | ||||
| 
 | ||||
| namespace gtsam { | ||||
| 
 | ||||
|  | @ -37,7 +37,7 @@ protected: | |||
|   noiseModel::Diagonal::shared_ptr model_; | ||||
| 
 | ||||
|   /** generator */ | ||||
|   boost::mt19937_64 generator_; | ||||
|   std::mt19937_64 generator_; | ||||
| 
 | ||||
| public: | ||||
|   typedef boost::shared_ptr<Sampler> shared_ptr; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue