mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Removed CERES_USE_CXX11
Remove the special handling for tr1::shared_ptr. Change-Id: Ic405dcfe881dd6560d236956f84bfb8911d0bcbb
This commit is contained in:
@@ -443,7 +443,6 @@ set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
# Set the Ceres option for C++11.
|
||||
# TODO(alex): Remove when #defines are removed from source & config.h
|
||||
list(APPEND CERES_COMPILE_OPTIONS CERES_STD_UNORDERED_MAP)
|
||||
list(APPEND CERES_COMPILE_OPTIONS CERES_USE_CXX11)
|
||||
|
||||
if (TBB)
|
||||
find_package(TBB QUIET)
|
||||
|
||||
@@ -80,8 +80,6 @@ function(ceres_compile_options_to_components CURRENT_CERES_COMPILE_OPTIONS CERES
|
||||
CERES_NO_CXSPARSE "CXSparse;SparseLinearAlgebraLibrary")
|
||||
add_to_output_if_not_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
|
||||
CERES_RESTRICT_SCHUR_SPECIALIZATION "SchurSpecializations")
|
||||
add_to_output_if_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
|
||||
CERES_USE_CXX11 "C++11")
|
||||
add_to_output_if_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
|
||||
CERES_USE_OPENMP "OpenMP;Multithreading")
|
||||
add_to_output_if_found(CURRENT_CERES_COMPILE_OPTIONS ${CERES_COMPONENTS_VAR}
|
||||
|
||||
@@ -60,9 +60,6 @@
|
||||
// routines.
|
||||
@CERES_NO_CUSTOM_BLAS@
|
||||
|
||||
// If defined, Ceres was compiled with C++11.
|
||||
@CERES_USE_CXX11@
|
||||
|
||||
// If defined, Ceres was compiled without multithreading support.
|
||||
@CERES_NO_THREADS@
|
||||
// If defined Ceres was compiled with OpenMP multithreading support.
|
||||
|
||||
@@ -64,12 +64,6 @@
|
||||
|
||||
namespace ceres {
|
||||
|
||||
#if defined(CERES_TR1_SHARED_PTR)
|
||||
using std::tr1::shared_ptr;
|
||||
#else
|
||||
using std::shared_ptr;
|
||||
#endif
|
||||
|
||||
// We allocate some Eigen objects on the stack and other places they
|
||||
// might not be aligned to X(=16 [SSE], 32 [AVX] etc)-byte boundaries. If we
|
||||
// have C++11, we can specify their alignment (which is desirable, as it means
|
||||
@@ -79,7 +73,6 @@ using std::shared_ptr;
|
||||
// on some platforms, in which case even if using C++11, on these platforms
|
||||
// we should not attempt to align to X-byte boundaries. If using < C++11,
|
||||
// we cannot specify the alignment.
|
||||
#ifdef CERES_USE_CXX11
|
||||
namespace port_constants {
|
||||
static constexpr size_t kMaxAlignBytes =
|
||||
// Work around a GCC 4.8 bug
|
||||
@@ -91,7 +84,6 @@ static constexpr size_t kMaxAlignBytes =
|
||||
alignof(std::max_align_t);
|
||||
#endif
|
||||
} // namespace port_constants
|
||||
#endif
|
||||
|
||||
} // namespace ceres
|
||||
|
||||
|
||||
+1
-7
@@ -258,7 +258,7 @@ struct Jet {
|
||||
// supported is < 16, in which case we do not specify an alignment, as this
|
||||
// implies the host is not a modern x86 machine. If using < C++11, we cannot
|
||||
// specify alignment.
|
||||
#if !defined(CERES_USE_CXX11) || defined(EIGEN_DONT_VECTORIZE)
|
||||
#if defined(EIGEN_DONT_VECTORIZE)
|
||||
// Without >= C++11, we cannot specify the alignment so fall back to safe,
|
||||
// unvectorised version.
|
||||
Eigen::Matrix<T, N, 1, Eigen::DontAlign> v;
|
||||
@@ -445,16 +445,12 @@ inline double floor (double x) { return std::floor(x); }
|
||||
inline double ceil (double x) { return std::ceil(x); }
|
||||
inline double pow (double x, double y) { return std::pow(x, y); }
|
||||
inline double atan2(double y, double x) { return std::atan2(y, x); }
|
||||
|
||||
#ifdef CERES_USE_CXX11
|
||||
// Some new additions to C++11:
|
||||
inline double cbrt (double x) { return std::cbrt(x); }
|
||||
inline double exp2 (double x) { return std::exp2(x); }
|
||||
inline double log2 (double x) { return std::log2(x); }
|
||||
inline double hypot(double x, double y) { return std::hypot(x, y); }
|
||||
inline double fmax(double x, double y) { return std::fmax(x, y); }
|
||||
inline double fmin(double x, double y) { return std::fmin(x, y); }
|
||||
#endif
|
||||
|
||||
// In general, f(a + h) ~= f(a) + f'(a) h, via the chain rule.
|
||||
|
||||
@@ -565,7 +561,6 @@ Jet<T, N> ceil(const Jet<T, N>& f) {
|
||||
return Jet<T, N>(ceil(f.a));
|
||||
}
|
||||
|
||||
#ifdef CERES_USE_CXX11
|
||||
// Some new additions to C++11:
|
||||
|
||||
// cbrt(a + h) ~= cbrt(a) + h / (3 a ^ (2/3))
|
||||
@@ -614,7 +609,6 @@ template <typename T, int N> inline
|
||||
const Jet<T, N>& fmin(const Jet<T, N>& x, const Jet<T, N>& y) {
|
||||
return y < x ? y : x;
|
||||
}
|
||||
#endif // CERES_USE_CXX11
|
||||
|
||||
// Bessel functions of the first kind with integer order equal to 0, 1, n.
|
||||
//
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#define CERES_PUBLIC_SOLVER_H_
|
||||
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "ceres/crs_matrix.h"
|
||||
@@ -500,7 +501,7 @@ class CERES_EXPORT Solver {
|
||||
// the parameter blocks into two groups, one for the points and one
|
||||
// for the cameras, where the group containing the points has an id
|
||||
// smaller than the group containing cameras.
|
||||
shared_ptr<ParameterBlockOrdering> linear_solver_ordering;
|
||||
std::shared_ptr<ParameterBlockOrdering> linear_solver_ordering;
|
||||
|
||||
// Use an explicitly computed Schur complement matrix with
|
||||
// ITERATIVE_SCHUR.
|
||||
@@ -631,7 +632,7 @@ class CERES_EXPORT Solver {
|
||||
// the lower numbered groups are optimized before the higher
|
||||
// number groups. Each group must be an independent set. Not
|
||||
// all parameter blocks need to be present in the ordering.
|
||||
shared_ptr<ParameterBlockOrdering> inner_iteration_ordering;
|
||||
std::shared_ptr<ParameterBlockOrdering> inner_iteration_ordering;
|
||||
|
||||
// Generally speaking, inner iterations make significant progress
|
||||
// in the early stages of the solve and then their contribution
|
||||
|
||||
@@ -567,7 +567,6 @@ TEST(Jet, Jet) {
|
||||
EXPECT_EQ(expected, b);
|
||||
}
|
||||
|
||||
#ifdef CERES_USE_CXX11
|
||||
{ // Check that cbrt(x * x * x) == x.
|
||||
J z = x * x * x;
|
||||
J w = cbrt(z);
|
||||
@@ -696,7 +695,6 @@ TEST(Jet, Jet) {
|
||||
ExpectJetsClose(y, z);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(Jet, JetsInEigenMatrices) {
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#ifndef CERES_INTERNAL_MINIMIZER_H_
|
||||
#define CERES_INTERNAL_MINIMIZER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "ceres/internal/port.h"
|
||||
@@ -167,19 +168,19 @@ class Minimizer {
|
||||
|
||||
// Object responsible for evaluating the cost, residuals and
|
||||
// Jacobian matrix.
|
||||
shared_ptr<Evaluator> evaluator;
|
||||
std::shared_ptr<Evaluator> evaluator;
|
||||
|
||||
// Object responsible for actually computing the trust region
|
||||
// step, and sizing the trust region radius.
|
||||
shared_ptr<TrustRegionStrategy> trust_region_strategy;
|
||||
std::shared_ptr<TrustRegionStrategy> trust_region_strategy;
|
||||
|
||||
// Object holding the Jacobian matrix. It is assumed that the
|
||||
// sparsity structure of the matrix has already been initialized
|
||||
// and will remain constant for the life time of the
|
||||
// optimization.
|
||||
shared_ptr<SparseMatrix> jacobian;
|
||||
std::shared_ptr<SparseMatrix> jacobian;
|
||||
|
||||
shared_ptr<CoordinateDescentMinimizer> inner_iteration_minimizer;
|
||||
std::shared_ptr<CoordinateDescentMinimizer> inner_iteration_minimizer;
|
||||
};
|
||||
|
||||
static Minimizer* Create(MinimizerType minimizer_type);
|
||||
|
||||
@@ -182,11 +182,11 @@ void ParallelFor(ContextImpl* context,
|
||||
return;
|
||||
}
|
||||
|
||||
// We use a shared_ptr because the main thread can finish all the work before
|
||||
// the tasks have been popped off the queue. So the shared state needs to
|
||||
// exist for the duration of all the tasks.
|
||||
// We use a std::shared_ptr because the main thread can finish all
|
||||
// the work before the tasks have been popped off the queue. So the
|
||||
// shared state needs to exist for the duration of all the tasks.
|
||||
const int num_work_items = std::min((end - start), num_threads);
|
||||
shared_ptr<SharedState> shared_state(
|
||||
std::shared_ptr<SharedState> shared_state(
|
||||
new SharedState(start, end, num_work_items));
|
||||
|
||||
// A function which tries to perform a chunk of work. This returns false if
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#ifndef CERES_INTERNAL_PREPROCESSOR_H_
|
||||
#define CERES_INTERNAL_PREPROCESSOR_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -97,8 +98,8 @@ struct PreprocessedProblem {
|
||||
scoped_ptr<IterationCallback> logging_callback;
|
||||
scoped_ptr<IterationCallback> state_updating_callback;
|
||||
|
||||
shared_ptr<Evaluator> evaluator;
|
||||
shared_ptr<CoordinateDescentMinimizer> inner_iteration_minimizer;
|
||||
std::shared_ptr<Evaluator> evaluator;
|
||||
std::shared_ptr<CoordinateDescentMinimizer> inner_iteration_minimizer;
|
||||
|
||||
std::vector<double*> removed_parameter_blocks;
|
||||
Vector reduced_parameters;
|
||||
|
||||
Reference in New Issue
Block a user