mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
Remove spurious conversion from doubles to Jets.
Binary operations between Jets and doubles are well defined and should not require an explicit conversion to Jets to work. This was an oversight earlier and lead to overzealous conversions all over our in our example code. Change-Id: I1799770818e136edfc0a5802d86037ce9aec4923
This commit is contained in:
@@ -223,7 +223,7 @@ the corresponding accessors. This information will be verified by the
|
||||
|
||||
template <typename T>
|
||||
bool operator()(const T* const x , const T* const y, T* e) const {
|
||||
e[0] = T(k_) - x[0] * y[0] - x[1] * y[1];
|
||||
e[0] = k_ - x[0] * y[0] - x[1] * y[1];
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -281,12 +281,6 @@ the corresponding accessors. This information will be verified by the
|
||||
independent variables, and there is no limit on the dimensionality
|
||||
of each of them.
|
||||
|
||||
**WARNING 1** Since the functor will get instantiated with
|
||||
different types for ``T``, you must convert from other numeric
|
||||
types to ``T`` before mixing computations with other variables
|
||||
of type ``T``. In the example above, this is seen where instead of
|
||||
using ``k_`` directly, ``k_`` is wrapped with ``T(k_)``.
|
||||
|
||||
**WARNING 2** A common beginner's error when first using
|
||||
:class:`AutoDiffCostFunction` is to get the sizing wrong. In particular,
|
||||
there is a tendency to set the template parameters to (dimension of
|
||||
@@ -1420,7 +1414,7 @@ Instances
|
||||
delta[0] * delta[0] + delta[1] * delta[1] + delta[2] * delta[2];
|
||||
|
||||
T q_delta[4];
|
||||
if (squared_norm_delta > T(0.0)) {
|
||||
if (squared_norm_delta > 0.0) {
|
||||
T norm_delta = sqrt(squared_norm_delta);
|
||||
const T sin_delta_by_delta = sin(norm_delta) / norm_delta;
|
||||
q_delta[0] = cos(norm_delta);
|
||||
@@ -1454,12 +1448,6 @@ Instances
|
||||
Global Size ---------------+ |
|
||||
Local Size -------------------+
|
||||
|
||||
**WARNING:** Since the functor will get instantiated with different
|
||||
types for ``T``, you must to convert from other numeric types to
|
||||
``T`` before mixing computations with other variables of type
|
||||
``T``. In the example above, this is seen where instead of using
|
||||
``k_`` directly, ``k_`` is wrapped with ``T(k_)``.
|
||||
|
||||
|
||||
:class:`Problem`
|
||||
================
|
||||
|
||||
Reference in New Issue
Block a user