Add the ability to normalize BALProblem.

Refactor some of the perturbation code so that the
normalization and perturbation code can share the
camera decomposition code.

Change-Id: I084064976804a92f9240d8f5e10d1bb23dcb5ff2
diff --git a/examples/bundle_adjuster.cc b/examples/bundle_adjuster.cc
index 1ef0766..530bda3 100644
--- a/examples/bundle_adjuster.cc
+++ b/examples/bundle_adjuster.cc
@@ -347,6 +347,7 @@
   Problem problem;
 
   SetRandomState(FLAGS_random_seed);
+  bal_problem.Normalize();
   bal_problem.Perturb(FLAGS_rotation_sigma,
                       FLAGS_translation_sigma,
                       FLAGS_point_sigma);
@@ -355,6 +356,8 @@
   Solver::Options options;
   SetSolverOptionsFromFlags(&bal_problem, &options);
   options.solver_log = FLAGS_solver_log;
+  options.gradient_tolerance *= 1e-3;
+
   Solver::Summary summary;
   Solve(options, &problem, &summary);
   std::cout << summary.FullReport() << "\n";