mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
Deprecate LocalParameterizations
Add [[deprecate]] notices to everything LocalParameterization related. Make sure that Ceres can be compiled without triggering deprecation warnings. Update the documentation: a. Add deprecation notices. b. Document interaction between LocalParameterization and Manifold coexisting in the Problem. c. Add documentation for Manifold(s) Change-Id: Ie4ad48963c83fded86e533c8c60561af402fbaff
This commit is contained in:
@@ -41,6 +41,9 @@
|
||||
|
||||
namespace ceres {
|
||||
|
||||
// WARNING: LocalParameterizations are deprecated. They will be removed from
|
||||
// Ceres Solver in version 2.2.0. Please use Manifolds instead.
|
||||
|
||||
// Purpose: Sometimes parameter blocks x can overparameterize a problem
|
||||
//
|
||||
// min f(x)
|
||||
@@ -111,7 +114,10 @@ namespace ceres {
|
||||
//
|
||||
// The class LocalParameterization defines the function Plus and its
|
||||
// Jacobian which is needed to compute the Jacobian of f w.r.t delta.
|
||||
class CERES_EXPORT LocalParameterization {
|
||||
class [[deprecated(
|
||||
"LocalParameterizations will be removed from the Ceres Solver API in "
|
||||
"version 2.2.0. Use Manifolds instead.")]] CERES_EXPORT
|
||||
LocalParameterization {
|
||||
public:
|
||||
virtual ~LocalParameterization();
|
||||
|
||||
@@ -120,9 +126,9 @@ class CERES_EXPORT LocalParameterization {
|
||||
// x_plus_delta = Plus(x, delta)
|
||||
//
|
||||
// with the condition that Plus(x, 0) = x.
|
||||
virtual bool Plus(const double* x,
|
||||
const double* delta,
|
||||
double* x_plus_delta) const = 0;
|
||||
//
|
||||
virtual bool Plus(const double* x, const double* delta, double* x_plus_delta)
|
||||
const = 0;
|
||||
|
||||
// The jacobian of Plus(x, delta) w.r.t delta at delta = 0.
|
||||
//
|
||||
@@ -152,12 +158,13 @@ class CERES_EXPORT LocalParameterization {
|
||||
// Some basic parameterizations
|
||||
|
||||
// Identity Parameterization: Plus(x, delta) = x + delta
|
||||
class CERES_EXPORT IdentityParameterization : public LocalParameterization {
|
||||
class [[deprecated(
|
||||
"Use EuclideanManifold instead.")]] CERES_EXPORT IdentityParameterization
|
||||
: public LocalParameterization {
|
||||
public:
|
||||
explicit IdentityParameterization(int size);
|
||||
bool Plus(const double* x,
|
||||
const double* delta,
|
||||
double* x_plus_delta) const override;
|
||||
bool Plus(const double* x, const double* delta, double* x_plus_delta)
|
||||
const override;
|
||||
bool ComputeJacobian(const double* x, double* jacobian) const override;
|
||||
bool MultiplyByJacobian(const double* x,
|
||||
const int num_cols,
|
||||
@@ -171,13 +178,14 @@ class CERES_EXPORT IdentityParameterization : public LocalParameterization {
|
||||
};
|
||||
|
||||
// Hold a subset of the parameters inside a parameter block constant.
|
||||
class CERES_EXPORT SubsetParameterization : public LocalParameterization {
|
||||
class [[deprecated(
|
||||
"Use SubsetManifold instead.")]] CERES_EXPORT SubsetParameterization
|
||||
: public LocalParameterization {
|
||||
public:
|
||||
explicit SubsetParameterization(int size,
|
||||
const std::vector<int>& constant_parameters);
|
||||
bool Plus(const double* x,
|
||||
const double* delta,
|
||||
double* x_plus_delta) const override;
|
||||
bool Plus(const double* x, const double* delta, double* x_plus_delta)
|
||||
const override;
|
||||
bool ComputeJacobian(const double* x, double* jacobian) const override;
|
||||
bool MultiplyByJacobian(const double* x,
|
||||
const int num_cols,
|
||||
@@ -197,11 +205,12 @@ class CERES_EXPORT SubsetParameterization : public LocalParameterization {
|
||||
// with * being the quaternion multiplication operator. Here we assume
|
||||
// that the first element of the quaternion vector is the real (cos
|
||||
// theta) part.
|
||||
class CERES_EXPORT QuaternionParameterization : public LocalParameterization {
|
||||
class [[deprecated(
|
||||
"Use QuaternionManifold instead.")]] CERES_EXPORT QuaternionParameterization
|
||||
: public LocalParameterization {
|
||||
public:
|
||||
bool Plus(const double* x,
|
||||
const double* delta,
|
||||
double* x_plus_delta) const override;
|
||||
bool Plus(const double* x, const double* delta, double* x_plus_delta)
|
||||
const override;
|
||||
bool ComputeJacobian(const double* x, double* jacobian) const override;
|
||||
int GlobalSize() const override { return 4; }
|
||||
int LocalSize() const override { return 3; }
|
||||
@@ -218,37 +227,36 @@ class CERES_EXPORT QuaternionParameterization : public LocalParameterization {
|
||||
//
|
||||
// Plus(x, delta) = [sin(|delta|) delta / |delta|, cos(|delta|)] * x
|
||||
// with * being the quaternion multiplication operator.
|
||||
class CERES_EXPORT EigenQuaternionParameterization
|
||||
: public ceres::LocalParameterization {
|
||||
class [[deprecated("Use EigenQuaternionManifold instead.")]] CERES_EXPORT
|
||||
EigenQuaternionParameterization : public ceres::LocalParameterization {
|
||||
public:
|
||||
bool Plus(const double* x,
|
||||
const double* delta,
|
||||
double* x_plus_delta) const override;
|
||||
bool Plus(const double* x, const double* delta, double* x_plus_delta)
|
||||
const override;
|
||||
bool ComputeJacobian(const double* x, double* jacobian) const override;
|
||||
int GlobalSize() const override { return 4; }
|
||||
int LocalSize() const override { return 3; }
|
||||
};
|
||||
|
||||
// This provides a parameterization for homogeneous vectors which are commonly
|
||||
// used in Structure for Motion problems. One example where they are used is
|
||||
// in representing points whose triangulation is ill-conditioned. Here
|
||||
// it is advantageous to use an over-parameterization since homogeneous vectors
|
||||
// can represent points at infinity.
|
||||
// used in Structure from Motion problems. One example where they are used is
|
||||
// in representing points whose triangulation is ill-conditioned. Here it is
|
||||
// advantageous to use an over-parameterization since homogeneous vectors can
|
||||
// represent points at infinity.
|
||||
//
|
||||
// The plus operator is defined as
|
||||
// Plus(x, delta) =
|
||||
// [sin(0.5 * |delta|) * delta / |delta|, cos(0.5 * |delta|)] * x
|
||||
//
|
||||
// with * defined as an operator which applies the update orthogonal to x to
|
||||
// remain on the sphere. We assume that the last element of x is the scalar
|
||||
// component. The size of the homogeneous vector is required to be greater than
|
||||
// 1.
|
||||
class CERES_EXPORT HomogeneousVectorParameterization
|
||||
: public LocalParameterization {
|
||||
class [[deprecated("Use SphereManifold instead.")]] CERES_EXPORT
|
||||
HomogeneousVectorParameterization : public LocalParameterization {
|
||||
public:
|
||||
explicit HomogeneousVectorParameterization(int size);
|
||||
bool Plus(const double* x,
|
||||
const double* delta,
|
||||
double* x_plus_delta) const override;
|
||||
bool Plus(const double* x, const double* delta, double* x_plus_delta)
|
||||
const override;
|
||||
bool ComputeJacobian(const double* x, double* jacobian) const override;
|
||||
int GlobalSize() const override { return size_; }
|
||||
int LocalSize() const override { return size_ - 1; }
|
||||
@@ -271,14 +279,14 @@ class CERES_EXPORT HomogeneousVectorParameterization
|
||||
// manifold (see https://en.wikipedia.org/wiki/Affine_Grassmannian_(manifold))
|
||||
// for the case Graff_1(R^n).
|
||||
template <int AmbientSpaceDimension>
|
||||
class LineParameterization : public LocalParameterization {
|
||||
class [[deprecated("Use LineManifold instead.")]] LineParameterization
|
||||
: public LocalParameterization {
|
||||
public:
|
||||
static_assert(AmbientSpaceDimension >= 2,
|
||||
"The ambient space must be at least 2");
|
||||
|
||||
bool Plus(const double* x,
|
||||
const double* delta,
|
||||
double* x_plus_delta) const override;
|
||||
bool Plus(const double* x, const double* delta, double* x_plus_delta)
|
||||
const override;
|
||||
bool ComputeJacobian(const double* x, double* jacobian) const override;
|
||||
int GlobalSize() const override { return 2 * AmbientSpaceDimension; }
|
||||
int LocalSize() const override { return 2 * (AmbientSpaceDimension - 1); }
|
||||
@@ -297,7 +305,10 @@ class LineParameterization : public LocalParameterization {
|
||||
//
|
||||
// is the local parameterization for a rigid transformation, where the
|
||||
// rotation is represented using a quaternion.
|
||||
class CERES_EXPORT ProductParameterization : public LocalParameterization {
|
||||
//
|
||||
class [[deprecated(
|
||||
"Use ProductManifold instead.")]] CERES_EXPORT ProductParameterization
|
||||
: public LocalParameterization {
|
||||
public:
|
||||
ProductParameterization(const ProductParameterization&) = delete;
|
||||
ProductParameterization& operator=(const ProductParameterization&) = delete;
|
||||
@@ -306,7 +317,7 @@ class CERES_EXPORT ProductParameterization : public LocalParameterization {
|
||||
// parameterizations.
|
||||
//
|
||||
template <typename... LocalParams>
|
||||
ProductParameterization(LocalParams*... local_params)
|
||||
ProductParameterization(LocalParams * ... local_params)
|
||||
: local_params_(sizeof...(LocalParams)),
|
||||
local_size_{0},
|
||||
global_size_{0},
|
||||
@@ -333,11 +344,9 @@ class CERES_EXPORT ProductParameterization : public LocalParameterization {
|
||||
}
|
||||
}
|
||||
|
||||
bool Plus(const double* x,
|
||||
const double* delta,
|
||||
double* x_plus_delta) const override;
|
||||
bool ComputeJacobian(const double* x,
|
||||
double* jacobian) const override;
|
||||
bool Plus(const double* x, const double* delta, double* x_plus_delta)
|
||||
const override;
|
||||
bool ComputeJacobian(const double* x, double* jacobian) const override;
|
||||
int GlobalSize() const override { return global_size_; }
|
||||
int LocalSize() const override { return local_size_; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user