Fix a MSVC type deduction bug in ComputeHouseholderVector

A recent change made this function templated and MSVC 16 has trouble
doing automatic argument deduction, so the type of the template is
simplified and all callsites are explicitly annotated with the type
of the arguments.

Change-Id: I83cd0269e6e82c4a8f4e391f5fc03b92c942f74d
diff --git a/include/ceres/internal/householder_vector.h b/include/ceres/internal/householder_vector.h
index 051a88d..55f68e5 100644
--- a/include/ceres/internal/householder_vector.h
+++ b/include/ceres/internal/householder_vector.h
@@ -42,8 +42,11 @@
 // vector as pivot instead of first. This computes the vector v with v(n) = 1
 // and beta such that H = I - beta * v * v^T is orthogonal and
 // H * x = ||x||_2 * e_n.
-template <typename Derived, typename Scalar, int N>
-void ComputeHouseholderVector(const Eigen::DenseBase<Derived>& x,
+//
+// NOTE: Some versions of MSVC have trouble deducing the type of v if
+// you do not specify all the template arguments explicitly.
+template <typename XVectorType, typename Scalar, int N>
+void ComputeHouseholderVector(const XVectorType& x,
                               Eigen::Matrix<Scalar, N, 1>* v,
                               Scalar* beta) {
   CHECK(beta != nullptr);
diff --git a/include/ceres/internal/line_parameterization.h b/include/ceres/internal/line_parameterization.h
index b2ec9e1..eda3901 100644
--- a/include/ceres/internal/line_parameterization.h
+++ b/include/ceres/internal/line_parameterization.h
@@ -53,8 +53,8 @@
   //   d* = Plus_d(d, delta_d)
   //   o* = Plus_o(o, d, delta_o)
   //
-  // The direction update function Plus_d is the same as for the homogeneous vector
-  // parameterization:
+  // The direction update function Plus_d is the same as for the homogeneous
+  // vector parameterization:
   //
   //   d* = H_{v(d)} [0.5 sinc(0.5 |delta_d|) delta_d, cos(0.5 |delta_d|)]^T
   //
@@ -70,11 +70,11 @@
   static constexpr int kDim = AmbientSpaceDimension;
   using AmbientVector = Eigen::Matrix<double, kDim, 1>;
   using AmbientVectorRef = Eigen::Map<Eigen::Matrix<double, kDim, 1>>;
-  using ConstAmbientVectorRef = Eigen::Map<const Eigen::Matrix<double, kDim, 1>>;
+  using ConstAmbientVectorRef =
+      Eigen::Map<const Eigen::Matrix<double, kDim, 1>>;
   using ConstTangentVectorRef =
       Eigen::Map<const Eigen::Matrix<double, kDim - 1, 1>>;
-  
-  
+
   ConstAmbientVectorRef o(x_ptr);
   ConstAmbientVectorRef d(x_ptr + kDim);
 
@@ -99,7 +99,12 @@
   // Calculate the householder transformation which is needed for f_d and f_o.
   AmbientVector v;
   double beta;
-  internal::ComputeHouseholderVector(d, &v, &beta);
+
+  // NOTE: The explicit template arguments are needed here because
+  // ComputeHouseholderVector is templated and some versions of MSVC
+  // have trouble deducing the type of v automatically.
+  internal::ComputeHouseholderVector<ConstAmbientVectorRef, double, kDim>(
+      d, &v, &beta);
 
   if (norm_delta_d != 0.0) {
     // Map the delta from the minimum representation to the over parameterized
@@ -139,7 +144,8 @@
     const double* x_ptr, double* jacobian_ptr) const {
   static constexpr int kDim = AmbientSpaceDimension;
   using AmbientVector = Eigen::Matrix<double, kDim, 1>;
-  using ConstAmbientVectorRef = Eigen::Map<const Eigen::Matrix<double, kDim, 1>>;  
+  using ConstAmbientVectorRef =
+      Eigen::Map<const Eigen::Matrix<double, kDim, 1>>;
   using MatrixRef = Eigen::Map<
       Eigen::Matrix<double, 2 * kDim, 2 * (kDim - 1), Eigen::RowMajor>>;
 
@@ -151,7 +157,12 @@
 
   AmbientVector v;
   double beta;
-  internal::ComputeHouseholderVector(d, &v, &beta);
+
+  // NOTE: The explicit template arguments are needed here because
+  // ComputeHouseholderVector is templated and some versions of MSVC
+  // have trouble deducing the type of v automatically.
+  internal::ComputeHouseholderVector<ConstAmbientVectorRef, double, kDim>(
+      d, &v, &beta);
 
   // The Jacobian is equal to J = 0.5 * H.leftCols(kDim - 1) where H is
   // the Householder matrix (H = I - beta * v * v') for the origin point. For