Remove conversions from a double to a Jet.

There are overloaded operators supporting operations between a double and a Jet, so there
is no need to convert a double to a Jet.

Change-Id: I9cfcefb32c6b1a5ad716496b620d578871f0ff03
This commit is contained in:
Kuang Fangjun
2018-09-23 11:56:28 +08:00
parent 86b27228bf
commit b040970cb8
+4 -4
View File
@@ -78,7 +78,7 @@ function :math:`f(x) = 10 - x`:
struct CostFunctor {
template <typename T>
bool operator()(const T* const x, T* residual) const {
residual[0] = T(10.0) - x[0];
residual[0] = 10.0 - x[0];
return true;
}
};
@@ -338,7 +338,7 @@ in the objective functor. Here is the code for evaluating
struct F4 {
template <typename T>
bool operator()(const T* const x1, const T* const x4, T* residual) const {
residual[0] = T(sqrt(10.0)) * (x1[0] - x4[0]) * (x1[0] - x4[0]);
residual[0] = sqrt(10.0) * (x1[0] - x4[0]) * (x1[0] - x4[0]);
return true;
}
};
@@ -471,7 +471,7 @@ residual. There will be a residual for each observation.
template <typename T>
bool operator()(const T* const m, const T* const c, T* residual) const {
residual[0] = T(y_) - exp(m[0] * T(x_) + c[0]);
residual[0] = y_ - exp(m[0] * x_ + c[0]);
return true;
}
@@ -653,7 +653,7 @@ The details of this camera model can be found the `Bundler homepage
const T& l1 = camera[7];
const T& l2 = camera[8];
T r2 = xp*xp + yp*yp;
T distortion = T(1.0) + r2 * (l1 + l2 * r2);
T distortion = 1.0 + r2 * (l1 + l2 * r2);
// Compute final projected point position.
const T& focal = camera[6];