Add IterationSummary::gradient_norm.

Iteration summary now reports the 2-norm of the gradient also.

Change-Id: I1ed7f1456ee4f546c9b42423d7a4ec3079ec078f
diff --git a/internal/ceres/line_search_minimizer.cc b/internal/ceres/line_search_minimizer.cc
index 6ee514a..b7e96c8 100644
--- a/internal/ceres/line_search_minimizer.cc
+++ b/internal/ceres/line_search_minimizer.cc
@@ -119,6 +119,7 @@
   iteration_summary.step_is_successful = false;
   iteration_summary.cost_change = 0.0;
   iteration_summary.gradient_max_norm = 0.0;
+  iteration_summary.gradient_norm = 0.0;
   iteration_summary.step_norm = 0.0;
   iteration_summary.linear_solver_iterations = 0;
   iteration_summary.step_solver_time_in_seconds = 0;
@@ -135,6 +136,7 @@
   iteration_summary.cost = current_state.cost + summary->fixed_cost;
 
   iteration_summary.gradient_max_norm = current_state.gradient_max_norm;
+  iteration_summary.gradient_norm = sqrt(current_state.gradient_squared_norm);
 
   // The initial gradient max_norm is bounded from below so that we do
   // not divide by zero.
@@ -331,6 +333,8 @@
     }
 
     iteration_summary.gradient_max_norm = current_state.gradient_max_norm;
+    iteration_summary.gradient_norm = sqrt(current_state.gradient_squared_norm);
+
     if (iteration_summary.gradient_max_norm <= absolute_gradient_tolerance) {
       VLOG_IF(1, is_not_silent)
           << "Terminating: Gradient tolerance reached."