Two changes to TinySolver

1. Change the ordering from NUM_PARAMETERS, NUM_RESIDUALS to
NUM_RESIDUALS, NUM_PARAMETERS in docs and in code.
2. TinySolver::solve -> TinySolver::Solve

Change-Id: I4dca87b971fd9168f1200b53c362669cffc82c1b
diff --git a/include/ceres/tiny_solver.h b/include/ceres/tiny_solver.h
index efe12d5..4d40ee8 100644
--- a/include/ceres/tiny_solver.h
+++ b/include/ceres/tiny_solver.h
@@ -69,15 +69,15 @@
 //   struct TinySolverCostFunctionTraits {
 //     typedef double Scalar;
 //     enum {
-//       NUM_PARAMETERS = <int> OR Eigen::Dynamic,
 //       NUM_RESIDUALS = <int> OR Eigen::Dynamic,
+//       NUM_PARAMETERS = <int> OR Eigen::Dynamic,
 //     };
 //     bool operator()(const double* parameters,
 //                     double* residuals,
 //                     double* jacobian) const;
 //
-//     int NumParameters(); -- Needed if NUM_PARAMETERS == Eigen::Dynamic.
 //     int NumResiduals();  -- Needed if NUM_RESIDUALS == Eigen::Dynamic.
+//     int NumParameters(); -- Needed if NUM_PARAMETERS == Eigen::Dynamic.
 //   }
 //
 // For operator(), the size of the objects is:
@@ -92,8 +92,8 @@
 //   struct MyCostFunctionExample {
 //     typedef double Scalar;
 //     enum {
-//       NUM_PARAMETERS = 3,
 //       NUM_RESIDUALS = 2,
+//       NUM_PARAMETERS = 3,
 //     };
 //     bool operator()(const double* parameters,
 //                     double* residuals,
@@ -110,20 +110,21 @@
 //         jacobian[2 * 2 + 0] = 4;   // Third column (z).
 //         jacobian[2 * 2 + 1] = y;
 //       }
-//       return EvaluateResidualsAndJacobians(parameters, residuals, jacobian);
+//       return true;
 //     }
 //   };
 //
 // The solver supports either statically or dynamically sized cost
-// functions. If the number of parameters is dynamic then the Function
+// functions. If the number of residuals is dynamic then the Function
 // must define:
 //
-//   int NumParameters() const;
-//
-// If the number of residuals is dynamic then the Function must define:
-//
 //   int NumResiduals() const;
 //
+// If the number of parameters is dynamic then the Function must
+// define:
+//
+//   int NumParameters() const;
+//
 template<typename Function,
          typename LinearSolver = Eigen::PartialPivLU<
            Eigen::Matrix<typename Function::Scalar,
@@ -192,8 +193,8 @@
     return RUNNING;
   }
 
-  Results solve(const Function& function, Parameters* x_and_min) {
-    Initialize<NUM_PARAMETERS, NUM_RESIDUALS>(function);
+  Results Solve(const Function& function, Parameters* x_and_min) {
+    Initialize<NUM_RESIDUALS, NUM_PARAMETERS>(function);
 
     assert(x_and_min);
     Parameters& x = *x_and_min;
@@ -270,34 +271,34 @@
   };
 
   // The number of parameters and residuals are dynamically sized.
-  template <int N, int M>
-  typename enable_if<(N == Eigen::Dynamic && M == Eigen::Dynamic), void>::type
+  template <int R, int P>
+  typename enable_if<(R == Eigen::Dynamic && P == Eigen::Dynamic), void>::type
   Initialize(const Function& function) {
-    Initialize(function.NumParameters(), function.NumResiduals());
+    Initialize(function.NumResiduals(), function.NumParameters());
   }
 
   // The number of parameters is dynamically sized and the number of
   // residuals is statically sized.
-  template <int N, int M>
-  typename enable_if<(N == Eigen::Dynamic && M != Eigen::Dynamic), void>::type
+  template <int R, int P>
+  typename enable_if<(R == Eigen::Dynamic && P != Eigen::Dynamic), void>::type
   Initialize(const Function& function) {
-    Initialize(function.NumParameters(), M);
+    Initialize(function.NumResiduals(), P);
   }
 
   // The number of parameters is statically sized and the number of
   // residuals is dynamically sized.
-  template <int N, int M>
-  typename enable_if<(N != Eigen::Dynamic && M == Eigen::Dynamic), void>::type
+  template <int R, int P>
+  typename enable_if<(R != Eigen::Dynamic && P == Eigen::Dynamic), void>::type
   Initialize(const Function& function) {
-    Initialize(N, function.NumResiduals());
+    Initialize(R, function.NumParameters());
   }
 
   // The number of parameters and residuals are statically sized.
-  template <int N, int M>
-  typename enable_if<(N != Eigen::Dynamic && M != Eigen::Dynamic), void>::type
+  template <int R, int P>
+  typename enable_if<(R != Eigen::Dynamic && P != Eigen::Dynamic), void>::type
   Initialize(const Function& /* function */) { }
 
-  void Initialize(int num_parameters, int num_residuals) {
+  void Initialize(int num_residuals, int num_parameters) {
     error_.resize(num_residuals);
     f_x_new_.resize(num_residuals);
     jacobian_.resize(num_residuals, num_parameters);
@@ -308,4 +309,4 @@
 
 }  // namespace ceres
 
-#endif  // CERES_PUBLIC_TINY_SOLVER_H_
\ No newline at end of file
+#endif  // CERES_PUBLIC_TINY_SOLVER_H_