Changes from William Rucklidge

Change-Id: Ia5d724edef947870fe13050a71aa1cba878352a8
diff --git a/docs/source/nnls_solving.rst b/docs/source/nnls_solving.rst
index db87619..18d7aec 100644
--- a/docs/source/nnls_solving.rst
+++ b/docs/source/nnls_solving.rst
@@ -2156,7 +2156,7 @@
 
 .. member:: std::string Solver::Summary::schur_structure_given
 
-    For Schur type linear solvers, this string describes, the template
+    For Schur type linear solvers, this string describes the template
     specialization which was detected in the problem and should be
     used.
 
diff --git a/include/ceres/solver.h b/include/ceres/solver.h
index 45a7c69..96391ba 100644
--- a/include/ceres/solver.h
+++ b/include/ceres/solver.h
@@ -953,8 +953,9 @@
     // parameter blocks.
     std::vector<int> linear_solver_ordering_used;
 
-    // For Schur type linear solvers, this string describes, the
-    // template specialization which was detected in the problem and should be used.
+    // For Schur type linear solvers, this string describes the
+    // template specialization which was detected in the problem and
+    // should be used.
     std::string schur_structure_given;
 
     // This is the Schur template specialization that was actually
diff --git a/internal/ceres/generate_template_specializations.py b/internal/ceres/generate_template_specializations.py
index cbfcb71..50c2b58 100644
--- a/internal/ceres/generate_template_specializations.py
+++ b/internal/ceres/generate_template_specializations.py
@@ -35,20 +35,23 @@
 # compilation into separate compilation unit rather than one large cc
 # file which takes 2+GB of RAM to compile.
 #
-# This script creates two sets of files.
+# This script creates three sets of files.
 #
-# 1. schur_eliminator_x_x_x.cc
+# 1. schur_eliminator_x_x_x.cc and partitioned_matrix_view_x_x_x.cc
 # where, the x indicates the template parameters and
 #
-# 2. schur_eliminator.cc
+# 2. schur_eliminator.cc & partitioned_matrix_view.cc
 #
 # that contains a factory function for instantiating these classes
 # based on runtime parameters.
 #
-# The list of tuples, specializations indicates the set of
+# 3. schur_templates.cc
+#
+# that contains a function which can be queried to determine what
+# template specializations are available.
+#
+# The following list of tuples, specializations indicates the set of
 # specializations that is generated.
-
-# Set of template specializations to generate
 SPECIALIZATIONS = [(2, 2, 2),
                    (2, 2, 3),
                    (2, 2, 4),
@@ -96,42 +99,35 @@
   if (len(conditionals) == 1):
     return " if " + conditionals[0] + "{\n  %s\n }\n"
 
-  return " if (" + " &&\n  ".join(conditionals) + ") {\n  %s\n }\n"
+  return " if (" + " &&\n     ".join(conditionals) + ") {\n  %s\n }\n"
 
 def Specialize(name, data):
   """
   Generate specialization code and the conditionals to instantiate it.
   """
-  f = open(name + ".cc", "w")
-  f.write(data["HEADER"])
-  f.write(data["FACTORY_FILE_HEADER"])
 
+  # Specialization files
   for row_block_size, e_block_size, f_block_size in SPECIALIZATIONS:
-    output = SpecializationFilename("generated/" + name,
-                                    row_block_size,
-                                    e_block_size,
-                                    f_block_size) + ".cc"
-    fptr = open(output, "w")
-    fptr.write(data["HEADER"])
+      output = SpecializationFilename("generated/" + name,
+                                      row_block_size,
+                                      e_block_size,
+                                      f_block_size) + ".cc"
 
-    template = data["SPECIALIZATION_FILE"]
-    if (row_block_size == "Eigen::Dynamic" and
-        e_block_size == "Eigen::Dynamic" and
-        f_block_size == "Eigen::Dynamic"):
-      template = data["DYNAMIC_FILE"]
+      with open(output, "w") as f:
+        f.write(data["HEADER"])
+        f.write(data["SPECIALIZATION_FILE"] %
+                  (row_block_size, e_block_size, f_block_size))
 
-    fptr.write(template % (row_block_size, e_block_size, f_block_size))
-    fptr.close()
-
-    FACTORY_CONDITIONAL =
-    GenerateFactoryConditional(row_block_size, e_block_size, f_block_size)
-    f.write(FACTORY_CONDITIONAL % data["FACTORY"] %
-              (row_block_size, e_block_size, f_block_size));
-
-  f.write(data["FACTORY_FOOTER"])
-  f.close()
-
-
+  # Factory
+  with open(name + ".cc", "w") as f:
+    f.write(data["HEADER"])
+    f.write(data["FACTORY_FILE_HEADER"])
+    for row_block_size, e_block_size, f_block_size in SPECIALIZATIONS:
+        factory_conditional = GenerateFactoryConditional(
+            row_block_size, e_block_size, f_block_size)
+        factory = data["FACTORY"] % (row_block_size, e_block_size, f_block_size)
+        f.write(factory_conditional % factory);
+    f.write(data["FACTORY_FOOTER"])
 
 QUERY_HEADER = """// Ceres Solver - A fast non-linear least squares minimizer
 // Copyright 2017 Google Inc. All rights reserved.
@@ -204,28 +200,30 @@
 }  // namespace ceres
 """
 
-QUERY_ACTION = """*row_block_size = %s;
-  *e_block_size = %s;
-  *f_block_size = %s;
+QUERY_ACTION = """ *row_block_size = %s;
+   *e_block_size = %s;
+   *f_block_size = %s;
   return;"""
 
 def GenerateQueryFile():
   """
-  Generate specialization code and the conditionals to instantiate it.
+  Generate file that allows querying for available template specializations.
   """
-  f = open("schur_templates.cc", "w")
-  f.write(QUERY_HEADER)
-  f.write(QUERY_FILE_HEADER)
 
-  for row_block_size, e_block_size, f_block_size in SPECIALIZATIONS:
-    FACTORY_CONDITIONAL = GenerateFactoryConditional(row_block_size, e_block_size, f_block_size)
-    f.write(FACTORY_CONDITIONAL % QUERY_ACTION % (row_block_size, e_block_size, f_block_size));
-
-  f.write(QUERY_FOOTER)
-  f.close()
+  with open("schur_templates.cc", "w") as f:
+    f.write(QUERY_HEADER)
+    f.write(QUERY_FILE_HEADER)
+    for row_block_size, e_block_size, f_block_size in SPECIALIZATIONS:
+      factory_conditional = GenerateFactoryConditional(
+        row_block_size, e_block_size, f_block_size)
+      action = QUERY_ACTION % (row_block_size, e_block_size, f_block_size)
+      f.write(factory_conditional % action)
+    f.write(QUERY_FOOTER)
 
 
 if __name__ == "__main__":
-  Specialize("schur_eliminator", schur_eliminator_template.__dict__)
-  Specialize("partitioned_matrix_view", partitioned_matrix_view_template.__dict__)
+  Specialize("schur_eliminator",
+               schur_eliminator_template.__dict__)
+  Specialize("partitioned_matrix_view",
+               partitioned_matrix_view_template.__dict__)
   GenerateQueryFile()
diff --git a/internal/ceres/partitioned_matrix_view.cc b/internal/ceres/partitioned_matrix_view.cc
index 210eff1..23927a7 100644
--- a/internal/ceres/partitioned_matrix_view.cc
+++ b/internal/ceres/partitioned_matrix_view.cc
@@ -51,93 +51,93 @@
                                   const BlockSparseMatrix& matrix) {
 #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2) &&
-  (options.f_block_size == 2)) {
-  return new PartitionedMatrixView<2, 2, 2>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 2) &&
+     (options.f_block_size == 2)) {
+   return new PartitionedMatrixView<2, 2, 2>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2) &&
-  (options.f_block_size == 3)) {
-  return new PartitionedMatrixView<2, 2, 3>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 2) &&
+     (options.f_block_size == 3)) {
+   return new PartitionedMatrixView<2, 2, 3>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2) &&
-  (options.f_block_size == 4)) {
-  return new PartitionedMatrixView<2, 2, 4>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 2) &&
+     (options.f_block_size == 4)) {
+   return new PartitionedMatrixView<2, 2, 4>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2)) {
-  return new PartitionedMatrixView<2, 2, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 2)) {
+   return new PartitionedMatrixView<2, 2, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 3)) {
-  return new PartitionedMatrixView<2, 3, 3>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 3)) {
+   return new PartitionedMatrixView<2, 3, 3>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 4)) {
-  return new PartitionedMatrixView<2, 3, 4>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 4)) {
+   return new PartitionedMatrixView<2, 3, 4>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 6)) {
-  return new PartitionedMatrixView<2, 3, 6>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 6)) {
+   return new PartitionedMatrixView<2, 3, 6>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 9)) {
-  return new PartitionedMatrixView<2, 3, 9>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 9)) {
+   return new PartitionedMatrixView<2, 3, 9>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3)) {
-  return new PartitionedMatrixView<2, 3, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 3)) {
+   return new PartitionedMatrixView<2, 3, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 3)) {
-  return new PartitionedMatrixView<2, 4, 3>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 3)) {
+   return new PartitionedMatrixView<2, 4, 3>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 4)) {
-  return new PartitionedMatrixView<2, 4, 4>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 4)) {
+   return new PartitionedMatrixView<2, 4, 4>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 8)) {
-  return new PartitionedMatrixView<2, 4, 8>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 8)) {
+   return new PartitionedMatrixView<2, 4, 8>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 9)) {
-  return new PartitionedMatrixView<2, 4, 9>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 9)) {
+   return new PartitionedMatrixView<2, 4, 9>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4)) {
-  return new PartitionedMatrixView<2, 4, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 4)) {
+   return new PartitionedMatrixView<2, 4, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
  }
  if (options.row_block_size == 2){
-  return new PartitionedMatrixView<2, Eigen::Dynamic, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
+   return new PartitionedMatrixView<2, Eigen::Dynamic, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 2)) {
-  return new PartitionedMatrixView<4, 4, 2>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 2)) {
+   return new PartitionedMatrixView<4, 4, 2>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 3)) {
-  return new PartitionedMatrixView<4, 4, 3>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 3)) {
+   return new PartitionedMatrixView<4, 4, 3>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 4)) {
-  return new PartitionedMatrixView<4, 4, 4>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 4)) {
+   return new PartitionedMatrixView<4, 4, 4>(matrix, options.elimination_groups[0]);
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4)) {
-  return new PartitionedMatrixView<4, 4, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
+     (options.e_block_size == 4)) {
+   return new PartitionedMatrixView<4, 4, Eigen::Dynamic>(matrix, options.elimination_groups[0]);
  }
 
 #endif
diff --git a/internal/ceres/partitioned_matrix_view_template.py b/internal/ceres/partitioned_matrix_view_template.py
index f610833..7894523 100644
--- a/internal/ceres/partitioned_matrix_view_template.py
+++ b/internal/ceres/partitioned_matrix_view_template.py
@@ -135,7 +135,7 @@
                                   const BlockSparseMatrix& matrix) {
 #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
 """
-FACTORY = """return new PartitionedMatrixView<%s, %s, %s>(matrix, options.elimination_groups[0]);"""
+FACTORY = """ return new PartitionedMatrixView<%s, %s, %s>(matrix, options.elimination_groups[0]);"""
 
 FACTORY_FOOTER = """
 #endif
diff --git a/internal/ceres/schur_eliminator.cc b/internal/ceres/schur_eliminator.cc
index 0def9f0..a1fc504 100644
--- a/internal/ceres/schur_eliminator.cc
+++ b/internal/ceres/schur_eliminator.cc
@@ -50,93 +50,93 @@
 SchurEliminatorBase::Create(const LinearSolver::Options& options) {
 #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2) &&
-  (options.f_block_size == 2)) {
-  return new SchurEliminator<2, 2, 2>(options);
+     (options.e_block_size == 2) &&
+     (options.f_block_size == 2)) {
+   return new SchurEliminator<2, 2, 2>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2) &&
-  (options.f_block_size == 3)) {
-  return new SchurEliminator<2, 2, 3>(options);
+     (options.e_block_size == 2) &&
+     (options.f_block_size == 3)) {
+   return new SchurEliminator<2, 2, 3>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2) &&
-  (options.f_block_size == 4)) {
-  return new SchurEliminator<2, 2, 4>(options);
+     (options.e_block_size == 2) &&
+     (options.f_block_size == 4)) {
+   return new SchurEliminator<2, 2, 4>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2)) {
-  return new SchurEliminator<2, 2, Eigen::Dynamic>(options);
+     (options.e_block_size == 2)) {
+   return new SchurEliminator<2, 2, Eigen::Dynamic>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 3)) {
-  return new SchurEliminator<2, 3, 3>(options);
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 3)) {
+   return new SchurEliminator<2, 3, 3>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 4)) {
-  return new SchurEliminator<2, 3, 4>(options);
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 4)) {
+   return new SchurEliminator<2, 3, 4>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 6)) {
-  return new SchurEliminator<2, 3, 6>(options);
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 6)) {
+   return new SchurEliminator<2, 3, 6>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 9)) {
-  return new SchurEliminator<2, 3, 9>(options);
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 9)) {
+   return new SchurEliminator<2, 3, 9>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3)) {
-  return new SchurEliminator<2, 3, Eigen::Dynamic>(options);
+     (options.e_block_size == 3)) {
+   return new SchurEliminator<2, 3, Eigen::Dynamic>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 3)) {
-  return new SchurEliminator<2, 4, 3>(options);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 3)) {
+   return new SchurEliminator<2, 4, 3>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 4)) {
-  return new SchurEliminator<2, 4, 4>(options);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 4)) {
+   return new SchurEliminator<2, 4, 4>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 8)) {
-  return new SchurEliminator<2, 4, 8>(options);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 8)) {
+   return new SchurEliminator<2, 4, 8>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 9)) {
-  return new SchurEliminator<2, 4, 9>(options);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 9)) {
+   return new SchurEliminator<2, 4, 9>(options);
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4)) {
-  return new SchurEliminator<2, 4, Eigen::Dynamic>(options);
+     (options.e_block_size == 4)) {
+   return new SchurEliminator<2, 4, Eigen::Dynamic>(options);
  }
  if (options.row_block_size == 2){
-  return new SchurEliminator<2, Eigen::Dynamic, Eigen::Dynamic>(options);
+   return new SchurEliminator<2, Eigen::Dynamic, Eigen::Dynamic>(options);
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 2)) {
-  return new SchurEliminator<4, 4, 2>(options);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 2)) {
+   return new SchurEliminator<4, 4, 2>(options);
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 3)) {
-  return new SchurEliminator<4, 4, 3>(options);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 3)) {
+   return new SchurEliminator<4, 4, 3>(options);
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 4)) {
-  return new SchurEliminator<4, 4, 4>(options);
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 4)) {
+   return new SchurEliminator<4, 4, 4>(options);
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4)) {
-  return new SchurEliminator<4, 4, Eigen::Dynamic>(options);
+     (options.e_block_size == 4)) {
+   return new SchurEliminator<4, 4, Eigen::Dynamic>(options);
  }
 
 #endif
diff --git a/internal/ceres/schur_eliminator_template.py b/internal/ceres/schur_eliminator_template.py
index 979ef25..2f38cf5 100644
--- a/internal/ceres/schur_eliminator_template.py
+++ b/internal/ceres/schur_eliminator_template.py
@@ -139,7 +139,7 @@
 #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
 """
 
-FACTORY = """return new SchurEliminator<%s, %s, %s>(options);"""
+FACTORY = """ return new SchurEliminator<%s, %s, %s>(options);"""
 
 FACTORY_FOOTER = """
 #endif
diff --git a/internal/ceres/schur_templates.cc b/internal/ceres/schur_templates.cc
index 60f4291..610b349 100644
--- a/internal/ceres/schur_templates.cc
+++ b/internal/ceres/schur_templates.cc
@@ -57,149 +57,149 @@
   *f_block_size = Eigen::Dynamic;
 #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2) &&
-  (options.f_block_size == 2)) {
-  *row_block_size = 2;
-  *e_block_size = 2;
-  *f_block_size = 2;
+     (options.e_block_size == 2) &&
+     (options.f_block_size == 2)) {
+   *row_block_size = 2;
+   *e_block_size = 2;
+   *f_block_size = 2;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2) &&
-  (options.f_block_size == 3)) {
-  *row_block_size = 2;
-  *e_block_size = 2;
-  *f_block_size = 3;
+     (options.e_block_size == 2) &&
+     (options.f_block_size == 3)) {
+   *row_block_size = 2;
+   *e_block_size = 2;
+   *f_block_size = 3;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2) &&
-  (options.f_block_size == 4)) {
-  *row_block_size = 2;
-  *e_block_size = 2;
-  *f_block_size = 4;
+     (options.e_block_size == 2) &&
+     (options.f_block_size == 4)) {
+   *row_block_size = 2;
+   *e_block_size = 2;
+   *f_block_size = 4;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 2)) {
-  *row_block_size = 2;
-  *e_block_size = 2;
-  *f_block_size = Eigen::Dynamic;
+     (options.e_block_size == 2)) {
+   *row_block_size = 2;
+   *e_block_size = 2;
+   *f_block_size = Eigen::Dynamic;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 3)) {
-  *row_block_size = 2;
-  *e_block_size = 3;
-  *f_block_size = 3;
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 3)) {
+   *row_block_size = 2;
+   *e_block_size = 3;
+   *f_block_size = 3;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 4)) {
-  *row_block_size = 2;
-  *e_block_size = 3;
-  *f_block_size = 4;
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 4)) {
+   *row_block_size = 2;
+   *e_block_size = 3;
+   *f_block_size = 4;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 6)) {
-  *row_block_size = 2;
-  *e_block_size = 3;
-  *f_block_size = 6;
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 6)) {
+   *row_block_size = 2;
+   *e_block_size = 3;
+   *f_block_size = 6;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3) &&
-  (options.f_block_size == 9)) {
-  *row_block_size = 2;
-  *e_block_size = 3;
-  *f_block_size = 9;
+     (options.e_block_size == 3) &&
+     (options.f_block_size == 9)) {
+   *row_block_size = 2;
+   *e_block_size = 3;
+   *f_block_size = 9;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 3)) {
-  *row_block_size = 2;
-  *e_block_size = 3;
-  *f_block_size = Eigen::Dynamic;
+     (options.e_block_size == 3)) {
+   *row_block_size = 2;
+   *e_block_size = 3;
+   *f_block_size = Eigen::Dynamic;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 3)) {
-  *row_block_size = 2;
-  *e_block_size = 4;
-  *f_block_size = 3;
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 3)) {
+   *row_block_size = 2;
+   *e_block_size = 4;
+   *f_block_size = 3;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 4)) {
-  *row_block_size = 2;
-  *e_block_size = 4;
-  *f_block_size = 4;
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 4)) {
+   *row_block_size = 2;
+   *e_block_size = 4;
+   *f_block_size = 4;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 8)) {
-  *row_block_size = 2;
-  *e_block_size = 4;
-  *f_block_size = 8;
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 8)) {
+   *row_block_size = 2;
+   *e_block_size = 4;
+   *f_block_size = 8;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 9)) {
-  *row_block_size = 2;
-  *e_block_size = 4;
-  *f_block_size = 9;
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 9)) {
+   *row_block_size = 2;
+   *e_block_size = 4;
+   *f_block_size = 9;
   return;
  }
  if ((options.row_block_size == 2) &&
-  (options.e_block_size == 4)) {
-  *row_block_size = 2;
-  *e_block_size = 4;
-  *f_block_size = Eigen::Dynamic;
+     (options.e_block_size == 4)) {
+   *row_block_size = 2;
+   *e_block_size = 4;
+   *f_block_size = Eigen::Dynamic;
   return;
  }
  if (options.row_block_size == 2){
-  *row_block_size = 2;
-  *e_block_size = Eigen::Dynamic;
-  *f_block_size = Eigen::Dynamic;
+   *row_block_size = 2;
+   *e_block_size = Eigen::Dynamic;
+   *f_block_size = Eigen::Dynamic;
   return;
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 2)) {
-  *row_block_size = 4;
-  *e_block_size = 4;
-  *f_block_size = 2;
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 2)) {
+   *row_block_size = 4;
+   *e_block_size = 4;
+   *f_block_size = 2;
   return;
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 3)) {
-  *row_block_size = 4;
-  *e_block_size = 4;
-  *f_block_size = 3;
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 3)) {
+   *row_block_size = 4;
+   *e_block_size = 4;
+   *f_block_size = 3;
   return;
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4) &&
-  (options.f_block_size == 4)) {
-  *row_block_size = 4;
-  *e_block_size = 4;
-  *f_block_size = 4;
+     (options.e_block_size == 4) &&
+     (options.f_block_size == 4)) {
+   *row_block_size = 4;
+   *e_block_size = 4;
+   *f_block_size = 4;
   return;
  }
  if ((options.row_block_size == 4) &&
-  (options.e_block_size == 4)) {
-  *row_block_size = 4;
-  *e_block_size = 4;
-  *f_block_size = Eigen::Dynamic;
+     (options.e_block_size == 4)) {
+   *row_block_size = 4;
+   *e_block_size = 4;
+   *f_block_size = Eigen::Dynamic;
   return;
  }
 
diff --git a/internal/ceres/solver.cc b/internal/ceres/solver.cc
index 8d9fc08..716307a 100644
--- a/internal/ceres/solver.cc
+++ b/internal/ceres/solver.cc
@@ -463,7 +463,7 @@
       (f_block_size == Eigen::Dynamic)
       ? "d" : internal::StringPrintf("%d", f_block_size);
 
-  return internal::StringPrintf("%s,%s,%s",row.c_str(), e.c_str(), f.c_str());
+  return internal::StringPrintf("%s,%s,%s", row.c_str(), e.c_str(), f.c_str());
 }
 
 }  // namespace