aboutsummaryrefslogtreecommitdiff
path: root/examples/bal_problem.cc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bal_problem.cc')
-rw-r--r--examples/bal_problem.cc20
1 files changed, 1 insertions, 19 deletions
diff --git a/examples/bal_problem.cc b/examples/bal_problem.cc
index c118f88..40d0fdf 100644
--- a/examples/bal_problem.cc
+++ b/examples/bal_problem.cc
@@ -37,6 +37,7 @@
#include "Eigen/Core"
#include "ceres/rotation.h"
#include "glog/logging.h"
+#include "random.h"
namespace ceres {
namespace examples {
@@ -44,25 +45,6 @@ namespace {
typedef Eigen::Map<Eigen::VectorXd> VectorRef;
typedef Eigen::Map<const Eigen::VectorXd> ConstVectorRef;
-inline double RandDouble() {
- double r = static_cast<double>(rand());
- return r / RAND_MAX;
-}
-
-// Box-Muller algorithm for normal random number generation.
-// http://en.wikipedia.org/wiki/Box-Muller_transform
-inline double RandNormal() {
- double x1, x2, w;
- do {
- x1 = 2.0 * RandDouble() - 1.0;
- x2 = 2.0 * RandDouble() - 1.0;
- w = x1 * x1 + x2 * x2;
- } while ( w >= 1.0 || w == 0.0 );
-
- w = sqrt((-2.0 * log(w)) / w);
- return x1 * w;
-}
-
template<typename T>
void FscanfOrDie(FILE* fptr, const char* format, T* value) {
int num_scanned = fscanf(fptr, format, value);