Evaluate ResidualBlocks without LossFunction if needed.

1. Add the ability to evaluate the problem without loss function.
2. Remove static Evaluator::Evaluate
3. Refactor the common code from problem_test.cc and
   evaluator_test.cc into evaluator_test_utils.cc

Change-Id: I1aa841580afe91d288fbb65288b0ffdd1e43e827
diff --git a/include/ceres/problem.h b/include/ceres/problem.h
index bab3bfe..b1ccbab 100644
--- a/include/ceres/problem.h
+++ b/include/ceres/problem.h
@@ -331,7 +331,8 @@
   // Options struct to control Problem::Evaluate.
   struct EvaluateOptions {
     EvaluateOptions()
-        : num_threads(1) {
+        : apply_loss_function(true),
+          num_threads(1) {
     }
 
     // The set of parameter blocks for which evaluation should be
@@ -360,6 +361,15 @@
     // they were added to the problem. But, this may change if the
     // user removes any residual blocks from the problem.
     vector<ResidualBlockId> residual_blocks;
+
+    // Even though the residual blocks in the problem may contain loss
+    // functions, setting apply_loss_function to false will turn off
+    // the application of the loss function to the output of the cost
+    // function. This is of use for example if the user wishes to
+    // analyse the solution quality by studying the distribution of
+    // residuals before and after the solve.
+    bool apply_loss_function;
+
     int num_threads;
   };