Deprecate macros.h and fpclassify.h 1. Replace CERES_DISALLOW_* with explicitly deleted constructors. 2. Replace use of CERES_ARRAY_SIZE and stack allocated arrays with std::vector. 3. Move CERES_ALIGN_* macros into manual_constructor.h, which is the one place they are used and will be deprecated along with that file. 4. Introduce isnan,isnormal,isinf and isfinite for Jets. 5. Replace IsNormal,IsFinite,IsNaN and IsInfinite with corresponding c++11 function calls. Change-Id: I04f33a221aae77d247602150988b6d4aa4efeeab
diff --git a/include/ceres/context.h b/include/ceres/context.h index 63c0a16..cf7c436 100644 --- a/include/ceres/context.h +++ b/include/ceres/context.h
@@ -31,8 +31,6 @@ #ifndef CERES_PUBLIC_CONTEXT_H_ #define CERES_PUBLIC_CONTEXT_H_ -#include "ceres/internal/macros.h" - namespace ceres { // A global context for processing data in Ceres. This provides a mechanism to @@ -44,13 +42,13 @@ class Context { public: Context() {} + Context(const Context&) = delete; + void operator=(const Context&) = delete; + virtual ~Context() {} // Creates a context object and the caller takes ownership. static Context* Create(); - - private: - CERES_DISALLOW_COPY_AND_ASSIGN(Context); }; } // namespace ceres
diff --git a/include/ceres/cost_function.h b/include/ceres/cost_function.h index 94725d3..1e085d6 100644 --- a/include/ceres/cost_function.h +++ b/include/ceres/cost_function.h
@@ -45,7 +45,6 @@ #define CERES_PUBLIC_COST_FUNCTION_H_ #include <vector> -#include "ceres/internal/macros.h" #include "ceres/internal/port.h" #include "ceres/types.h" #include "ceres/internal/disable_warnings.h" @@ -64,6 +63,8 @@ class CERES_EXPORT CostFunction { public: CostFunction() : num_residuals_(0) {} + CostFunction(const CostFunction&) = delete; + void operator=(const CostFunction&) = delete; virtual ~CostFunction() {} @@ -137,7 +138,6 @@ // number of outputs (residuals). std::vector<int32> parameter_block_sizes_; int num_residuals_; - CERES_DISALLOW_COPY_AND_ASSIGN(CostFunction); }; } // namespace ceres
diff --git a/include/ceres/fpclassify.h b/include/ceres/fpclassify.h deleted file mode 100644 index bc2dc90..0000000 --- a/include/ceres/fpclassify.h +++ /dev/null
@@ -1,70 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2015 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Author: keir@google.com (Keir Mierle) -// -// Portable floating point classification. The names are picked such that they -// do not collide with macros. For example, "isnan" in C99 is a macro and hence -// does not respect namespaces. -// -// TODO(keir): Finish porting! - -#ifndef CERES_PUBLIC_FPCLASSIFY_H_ -#define CERES_PUBLIC_FPCLASSIFY_H_ - -#if defined(_MSC_VER) -#include <float.h> -#endif - -#include <limits> - -namespace ceres { - -#if defined(_MSC_VER) - -inline bool IsFinite (double x) { return _finite(x) != 0; } -inline bool IsInfinite(double x) { return _finite(x) == 0 && _isnan(x) == 0; } -inline bool IsNaN (double x) { return _isnan(x) != 0; } -inline bool IsNormal (double x) { // NOLINT - const int classification = _fpclass(x); - return (classification == _FPCLASS_NN || classification == _FPCLASS_PN); -} - -# else - -// These definitions are for the normal Unix suspects. -inline bool IsFinite (double x) { return std::isfinite(x); } -inline bool IsInfinite(double x) { return std::isinf(x); } -inline bool IsNaN (double x) { return std::isnan(x); } -inline bool IsNormal (double x) { return std::isnormal(x); } - -#endif - -} // namespace ceres - -#endif // CERES_PUBLIC_FPCLASSIFY_H_
diff --git a/include/ceres/gradient_checker.h b/include/ceres/gradient_checker.h index 48f7bc4..fbd018d 100644 --- a/include/ceres/gradient_checker.h +++ b/include/ceres/gradient_checker.h
@@ -42,7 +42,6 @@ #include "ceres/dynamic_numeric_diff_cost_function.h" #include "ceres/internal/eigen.h" #include "ceres/internal/fixed_array.h" -#include "ceres/internal/macros.h" #include "ceres/local_parameterization.h" #include "glog/logging.h" @@ -137,7 +136,9 @@ ProbeResults* results) const; private: - CERES_DISALLOW_IMPLICIT_CONSTRUCTORS(GradientChecker); + GradientChecker() = delete; + GradientChecker(const GradientChecker&) = delete; + void operator=(const GradientChecker&) = delete; std::vector<const LocalParameterization*> local_parameterizations_; const CostFunction* function_;
diff --git a/include/ceres/gradient_problem.h b/include/ceres/gradient_problem.h index 2a08c5d..6adcfd0 100644 --- a/include/ceres/gradient_problem.h +++ b/include/ceres/gradient_problem.h
@@ -32,7 +32,6 @@ #define CERES_PUBLIC_GRADIENT_PROBLEM_H_ #include <memory> -#include "ceres/internal/macros.h" #include "ceres/internal/port.h" #include "ceres/local_parameterization.h"
diff --git a/include/ceres/gradient_problem_solver.h b/include/ceres/gradient_problem_solver.h index 5bbc8ce..ef3bf42 100644 --- a/include/ceres/gradient_problem_solver.h +++ b/include/ceres/gradient_problem_solver.h
@@ -34,7 +34,6 @@ #include <cmath> #include <string> #include <vector> -#include "ceres/internal/macros.h" #include "ceres/internal/port.h" #include "ceres/iteration_callback.h" #include "ceres/types.h"
diff --git a/include/ceres/internal/fixed_array.h b/include/ceres/internal/fixed_array.h index 387298c..dbfa8d0 100644 --- a/include/ceres/internal/fixed_array.h +++ b/include/ceres/internal/fixed_array.h
@@ -34,7 +34,6 @@ #include <cstddef> #include "Eigen/Core" -#include "ceres/internal/macros.h" #include "ceres/internal/manual_constructor.h" #include "glog/logging.h"
diff --git a/include/ceres/internal/macros.h b/include/ceres/internal/macros.h deleted file mode 100644 index bebb965..0000000 --- a/include/ceres/internal/macros.h +++ /dev/null
@@ -1,170 +0,0 @@ -// Ceres Solver - A fast non-linear least squares minimizer -// Copyright 2015 Google Inc. All rights reserved. -// http://ceres-solver.org/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of Google Inc. nor the names of its contributors may be -// used to endorse or promote products derived from this software without -// specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// -// Various Google-specific macros. -// -// This code is compiled directly on many platforms, including client -// platforms like Windows, Mac, and embedded systems. Before making -// any changes here, make sure that you're not breaking any platforms. - -#ifndef CERES_PUBLIC_INTERNAL_MACROS_H_ -#define CERES_PUBLIC_INTERNAL_MACROS_H_ - -#include <cstddef> // For size_t. - -// A macro to disallow the copy constructor and operator= functions -// This should be used in the private: declarations for a class -// -// For disallowing only assign or copy, write the code directly, but declare -// the intend in a comment, for example: -// -// void operator=(const TypeName&); // _DISALLOW_ASSIGN - -// Note, that most uses of CERES_DISALLOW_ASSIGN and CERES_DISALLOW_COPY -// are broken semantically, one should either use disallow both or -// neither. Try to avoid these in new code. -#define CERES_DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - void operator=(const TypeName&) - -// A macro to disallow all the implicit constructors, namely the -// default constructor, copy constructor and operator= functions. -// -// This should be used in the private: declarations for a class -// that wants to prevent anyone from instantiating it. This is -// especially useful for classes containing only static methods. -#define CERES_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ - TypeName(); \ - CERES_DISALLOW_COPY_AND_ASSIGN(TypeName) - -// The arraysize(arr) macro returns the # of elements in an array arr. -// The expression is a compile-time constant, and therefore can be -// used in defining new arrays, for example. If you use arraysize on -// a pointer by mistake, you will get a compile-time error. -// -// One caveat is that arraysize() doesn't accept any array of an -// anonymous type or a type defined inside a function. In these rare -// cases, you have to use the unsafe ARRAYSIZE() macro below. This is -// due to a limitation in C++'s template system. The limitation might -// eventually be removed, but it hasn't happened yet. - -// This template function declaration is used in defining arraysize. -// Note that the function doesn't need an implementation, as we only -// use its type. -template <typename T, size_t N> -char (&ArraySizeHelper(T (&array)[N]))[N]; - -// That gcc wants both of these prototypes seems mysterious. VC, for -// its part, can't decide which to use (another mystery). Matching of -// template overloads: the final frontier. -#ifndef _WIN32 -template <typename T, size_t N> -char (&ArraySizeHelper(const T (&array)[N]))[N]; -#endif - -#define arraysize(array) (sizeof(ArraySizeHelper(array))) - -// ARRAYSIZE performs essentially the same calculation as arraysize, -// but can be used on anonymous types or types defined inside -// functions. It's less safe than arraysize as it accepts some -// (although not all) pointers. Therefore, you should use arraysize -// whenever possible. -// -// The expression ARRAYSIZE(a) is a compile-time constant of type -// size_t. -// -// ARRAYSIZE catches a few type errors. If you see a compiler error -// -// "warning: division by zero in ..." -// -// when using ARRAYSIZE, you are (wrongfully) giving it a pointer. -// You should only use ARRAYSIZE on statically allocated arrays. -// -// The following comments are on the implementation details, and can -// be ignored by the users. -// -// ARRAYSIZE(arr) works by inspecting sizeof(arr) (the # of bytes in -// the array) and sizeof(*(arr)) (the # of bytes in one array -// element). If the former is divisible by the latter, perhaps arr is -// indeed an array, in which case the division result is the # of -// elements in the array. Otherwise, arr cannot possibly be an array, -// and we generate a compiler error to prevent the code from -// compiling. -// -// Since the size of bool is implementation-defined, we need to cast -// !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final -// result has type size_t. -// -// This macro is not perfect as it wrongfully accepts certain -// pointers, namely where the pointer size is divisible by the pointee -// size. Since all our code has to go through a 32-bit compiler, -// where a pointer is 4 bytes, this means all pointers to a type whose -// size is 3 or greater than 4 will be (righteously) rejected. -// -// Kudos to Jorg Brown for this simple and elegant implementation. -// -// - wan 2005-11-16 -// -// Starting with Visual C++ 2005, WinNT.h includes ARRAYSIZE. However, -// the definition comes from the over-broad windows.h header that -// introduces a macro, ERROR, that conflicts with the logging framework -// that Ceres uses. Instead, rename ARRAYSIZE to CERES_ARRAYSIZE. -#define CERES_ARRAYSIZE(a) \ - ((sizeof(a) / sizeof(*(a))) / \ - static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) - -// Tell the compiler to warn about unused return values for functions -// declared with this macro. The macro should be used on function -// declarations following the argument list: -// -// Sprocket* AllocateSprocket() MUST_USE_RESULT; -// -#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) \ - && !defined(COMPILER_ICC) -#define CERES_MUST_USE_RESULT __attribute__ ((warn_unused_result)) -#else -#define CERES_MUST_USE_RESULT -#endif - -// Platform independent macros to get aligned memory allocations. -// For example -// -// MyFoo my_foo CERES_ALIGN_ATTRIBUTE(16); -// -// Gives us an instance of MyFoo which is aligned at a 16 byte -// boundary. -#if defined(_MSC_VER) -#define CERES_ALIGN_ATTRIBUTE(n) __declspec(align(n)) -#define CERES_ALIGN_OF(T) __alignof(T) -#elif defined(__GNUC__) -#define CERES_ALIGN_ATTRIBUTE(n) __attribute__((aligned(n))) -#define CERES_ALIGN_OF(T) __alignof(T) -#endif - -#endif // CERES_PUBLIC_INTERNAL_MACROS_H_
diff --git a/include/ceres/internal/manual_constructor.h b/include/ceres/internal/manual_constructor.h index 0d7633c..5568bdb 100644 --- a/include/ceres/internal/manual_constructor.h +++ b/include/ceres/internal/manual_constructor.h
@@ -47,6 +47,21 @@ // ------- Define CERES_ALIGNED_CHAR_ARRAY -------------------------------- +// Platform independent macros to get aligned memory allocations. +// For example +// +// MyFoo my_foo CERES_ALIGN_ATTRIBUTE(16); +// +// Gives us an instance of MyFoo which is aligned at a 16 byte +// boundary. +#if defined(_MSC_VER) +#define CERES_ALIGN_ATTRIBUTE(n) __declspec(align(n)) +#define CERES_ALIGN_OF(T) __alignof(T) +#elif defined(__GNUC__) +#define CERES_ALIGN_ATTRIBUTE(n) __attribute__((aligned(n))) +#define CERES_ALIGN_OF(T) __alignof(T) +#endif + #ifndef CERES_ALIGNED_CHAR_ARRAY // Because MSVC and older GCCs require that the argument to their alignment
diff --git a/include/ceres/jet.h b/include/ceres/jet.h index d3edeac..0d5c780 100644 --- a/include/ceres/jet.h +++ b/include/ceres/jet.h
@@ -163,7 +163,6 @@ #include <string> #include "Eigen/Core" -#include "ceres/fpclassify.h" #include "ceres/internal/port.h" namespace ceres { @@ -451,6 +450,16 @@ 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); } +inline double isfinite(double x) { return std::isfinite(x); } +inline double isinf(double x) { return std::isinf(x); } +inline double isnan(double x) { return std::isnan(x); } +inline double isnormal(double x) { return std::isnormal(x); } + +// Legacy names from pre-C++11 days. +inline bool IsFinite (double x) { return std::isfinite(x); } +inline bool IsInfinite(double x) { return std::isinf(x); } +inline bool IsNaN (double x) { return std::isnan(x); } +inline bool IsNormal (double x) { return std::isnormal(x); } // In general, f(a + h) ~= f(a) + f'(a) h, via the chain rule. @@ -669,7 +678,7 @@ } // Jet Classification. It is not clear what the appropriate semantics are for -// these classifications. This picks that IsFinite and isnormal are "all" +// these classifications. This picks that std::isfinite and std::isnormal are "all" // operations, i.e. all elements of the jet must be finite for the jet itself // to be finite (or normal). For IsNaN and IsInfinite, the answer is less // clear. This takes a "any" approach for IsNaN and IsInfinite such that if any @@ -680,40 +689,41 @@ // The jet is finite if all parts of the jet are finite. template <typename T, int N> inline -bool IsFinite(const Jet<T, N>& f) { - if (!IsFinite(f.a)) { +bool isfinite(const Jet<T, N>& f) { + if (!std::isfinite(f.a)) { return false; } for (int i = 0; i < N; ++i) { - if (!IsFinite(f.v[i])) { + if (!std::isfinite(f.v[i])) { return false; } } return true; } -// The jet is infinite if any part of the jet is infinite. +// The jet is infinite if any part of the Jet is infinite. template <typename T, int N> inline -bool IsInfinite(const Jet<T, N>& f) { - if (IsInfinite(f.a)) { +bool isinf(const Jet<T, N>& f) { + if (std::isinf(f.a)) { return true; } - for (int i = 0; i < N; i++) { - if (IsInfinite(f.v[i])) { + for (int i = 0; i < N; ++i) { + if (std::isinf(f.v[i])) { return true; } } return false; } + // The jet is NaN if any part of the jet is NaN. template <typename T, int N> inline -bool IsNaN(const Jet<T, N>& f) { - if (IsNaN(f.a)) { +bool isnan(const Jet<T, N>& f) { + if (std::isnan(f.a)) { return true; } for (int i = 0; i < N; ++i) { - if (IsNaN(f.v[i])) { + if (std::isnan(f.v[i])) { return true; } } @@ -722,18 +732,40 @@ // The jet is normal if all parts of the jet are normal. template <typename T, int N> inline -bool IsNormal(const Jet<T, N>& f) { - if (!IsNormal(f.a)) { +bool isnormal(const Jet<T, N>& f) { + if (!std::isnormal(f.a)) { return false; } for (int i = 0; i < N; ++i) { - if (!IsNormal(f.v[i])) { + if (!std::isnormal(f.v[i])) { return false; } } return true; } +// Legacy functions from the pre-C++11 days. +template <typename T, int N> +inline bool IsFinite(const Jet<T, N>& f) { + return isfinite(f); +} + +template <typename T, int N> +inline bool IsNaN(const Jet<T, N>& f) { + return isnan(f); +} + +template <typename T, int N> +inline bool IsNormal(const Jet<T, N>& f) { + return isnormal(f); +} + +// The jet is infinite if any part of the jet is infinite. +template <typename T, int N> inline +bool IsInfinite(const Jet<T, N>& f) { + return isinf(f); +} + // atan2(b + db, a + da) ~= atan2(b, a) + (- b da + a db) / (a^2 + b^2) // // In words: the rate of change of theta is 1/r times the rate of
diff --git a/include/ceres/loss_function.h b/include/ceres/loss_function.h index 1f057e6..078771e 100644 --- a/include/ceres/loss_function.h +++ b/include/ceres/loss_function.h
@@ -77,7 +77,6 @@ #include <memory> #include "glog/logging.h" -#include "ceres/internal/macros.h" #include "ceres/types.h" #include "ceres/internal/disable_warnings.h" @@ -331,6 +330,8 @@ // ownership parameter. ScaledLoss(const LossFunction* rho, double a, Ownership ownership) : rho_(rho), a_(a), ownership_(ownership) { } + ScaledLoss(const ScaledLoss&) = delete; + void operator=(const ScaledLoss&) = delete; virtual ~ScaledLoss() { if (ownership_ == DO_NOT_TAKE_OWNERSHIP) { @@ -343,7 +344,6 @@ std::unique_ptr<const LossFunction> rho_; const double a_; const Ownership ownership_; - CERES_DISALLOW_COPY_AND_ASSIGN(ScaledLoss); }; // Sometimes after the optimization problem has been constructed, we @@ -390,6 +390,9 @@ : rho_(rho), ownership_(ownership) { } + LossFunctionWrapper(const LossFunctionWrapper&) = delete; + void operator=(const LossFunctionWrapper&) = delete; + virtual ~LossFunctionWrapper() { if (ownership_ == DO_NOT_TAKE_OWNERSHIP) { rho_.release(); @@ -418,7 +421,6 @@ private: std::unique_ptr<const LossFunction> rho_; Ownership ownership_; - CERES_DISALLOW_COPY_AND_ASSIGN(LossFunctionWrapper); }; } // namespace ceres
diff --git a/include/ceres/problem.h b/include/ceres/problem.h index b63395a..e7b60f0 100644 --- a/include/ceres/problem.h +++ b/include/ceres/problem.h
@@ -42,7 +42,6 @@ #include "ceres/context.h" #include "ceres/internal/disable_warnings.h" -#include "ceres/internal/macros.h" #include "ceres/internal/port.h" #include "ceres/types.h" #include "glog/logging.h" @@ -171,6 +170,8 @@ // invocation Problem(Problem::Options()). Problem(); explicit Problem(const Options& options); + Problem(const Problem&) = delete; + void operator=(const Problem&) = delete; ~Problem(); @@ -473,7 +474,6 @@ friend class Solver; friend class Covariance; std::unique_ptr<internal::ProblemImpl> problem_impl_; - CERES_DISALLOW_COPY_AND_ASSIGN(Problem); }; } // namespace ceres
diff --git a/include/ceres/solver.h b/include/ceres/solver.h index 9fc9ec5..7abf735 100644 --- a/include/ceres/solver.h +++ b/include/ceres/solver.h
@@ -38,7 +38,6 @@ #include "ceres/crs_matrix.h" #include "ceres/evaluation_callback.h" #include "ceres/internal/disable_warnings.h" -#include "ceres/internal/macros.h" #include "ceres/internal/port.h" #include "ceres/iteration_callback.h" #include "ceres/ordered_groups.h"
diff --git a/internal/ceres/array_utils.cc b/internal/ceres/array_utils.cc index a165a1b..32459e6 100644 --- a/internal/ceres/array_utils.cc +++ b/internal/ceres/array_utils.cc
@@ -35,7 +35,6 @@ #include <cstddef> #include <string> #include <vector> -#include "ceres/fpclassify.h" #include "ceres/stringprintf.h" #include "ceres/types.h" namespace ceres { @@ -46,7 +45,7 @@ bool IsArrayValid(const int size, const double* x) { if (x != NULL) { for (int i = 0; i < size; ++i) { - if (!IsFinite(x[i]) || (x[i] == kImpossibleValue)) { + if (!std::isfinite(x[i]) || (x[i] == kImpossibleValue)) { return false; } } @@ -60,7 +59,7 @@ } for (int i = 0; i < size; ++i) { - if (!IsFinite(x[i]) || (x[i] == kImpossibleValue)) { + if (!std::isfinite(x[i]) || (x[i] == kImpossibleValue)) { return i; } }
diff --git a/internal/ceres/autodiff_local_parameterization_test.cc b/internal/ceres/autodiff_local_parameterization_test.cc index 2a0d2f0..f2396dc 100644 --- a/internal/ceres/autodiff_local_parameterization_test.cc +++ b/internal/ceres/autodiff_local_parameterization_test.cc
@@ -30,7 +30,6 @@ #include <cmath> #include "ceres/autodiff_local_parameterization.h" -#include "ceres/fpclassify.h" #include "ceres/local_parameterization.h" #include "ceres/rotation.h" #include "gtest/gtest.h" @@ -172,7 +171,7 @@ EXPECT_NEAR(x_plus_delta_norm, 1.0, kTolerance); for (int i = 0; i < 12; ++i) { - EXPECT_TRUE(IsFinite(jacobian[i])); + EXPECT_TRUE(std::isfinite(jacobian[i])); EXPECT_NEAR(jacobian[i], jacobian_ref[i], kTolerance) << "Jacobian mismatch: i = " << i << "\n Expected \n" << ConstMatrixRef(jacobian_ref, 4, 3)
diff --git a/internal/ceres/block_jacobi_preconditioner.h b/internal/ceres/block_jacobi_preconditioner.h index a67879a..a6d19e8 100644 --- a/internal/ceres/block_jacobi_preconditioner.h +++ b/internal/ceres/block_jacobi_preconditioner.h
@@ -55,6 +55,9 @@ public: // A must remain valid while the BlockJacobiPreconditioner is. explicit BlockJacobiPreconditioner(const BlockSparseMatrix& A); + BlockJacobiPreconditioner(const BlockJacobiPreconditioner&) = delete; + void operator=(const BlockJacobiPreconditioner&) = delete; + virtual ~BlockJacobiPreconditioner(); // Preconditioner interface
diff --git a/internal/ceres/block_random_access_dense_matrix.h b/internal/ceres/block_random_access_dense_matrix.h index 161dab2..e1dca84 100644 --- a/internal/ceres/block_random_access_dense_matrix.h +++ b/internal/ceres/block_random_access_dense_matrix.h
@@ -36,7 +36,6 @@ #include <memory> #include <vector> -#include "ceres/internal/macros.h" #include "ceres/internal/port.h" namespace ceres { @@ -57,6 +56,8 @@ // blocks is a vector of block sizes. The resulting matrix has // blocks.size() * blocks.size() cells. explicit BlockRandomAccessDenseMatrix(const std::vector<int>& blocks); + BlockRandomAccessDenseMatrix(const BlockRandomAccessDenseMatrix&) = delete; + void operator=(const BlockRandomAccessDenseMatrix&) = delete; // The destructor is not thread safe. It assumes that no one is // modifying any cells when the matrix is being destroyed. @@ -88,8 +89,6 @@ std::vector<int> block_layout_; std::unique_ptr<double[]> values_; std::unique_ptr<CellInfo[]> cell_infos_; - - CERES_DISALLOW_COPY_AND_ASSIGN(BlockRandomAccessDenseMatrix); }; } // namespace internal
diff --git a/internal/ceres/block_random_access_diagonal_matrix.h b/internal/ceres/block_random_access_diagonal_matrix.h index fd43eb0..1eba575 100644 --- a/internal/ceres/block_random_access_diagonal_matrix.h +++ b/internal/ceres/block_random_access_diagonal_matrix.h
@@ -38,7 +38,6 @@ #include "ceres/block_random_access_matrix.h" #include "ceres/integral_types.h" -#include "ceres/internal/macros.h" #include "ceres/internal/port.h" #include "ceres/triplet_sparse_matrix.h" #include "ceres/types.h" @@ -52,6 +51,8 @@ public: // blocks is an array of block sizes. explicit BlockRandomAccessDiagonalMatrix(const std::vector<int>& blocks); + BlockRandomAccessDiagonalMatrix(const BlockRandomAccessDiagonalMatrix&) = delete; + void operator=(const BlockRandomAccessDiagonalMatrix&) = delete; // The destructor is not thread safe. It assumes that no one is // modifying any cells when the matrix is being destroyed. @@ -91,7 +92,6 @@ std::unique_ptr<TripletSparseMatrix> tsm_; friend class BlockRandomAccessDiagonalMatrixTest; - CERES_DISALLOW_COPY_AND_ASSIGN(BlockRandomAccessDiagonalMatrix); }; } // namespace internal
diff --git a/internal/ceres/block_random_access_sparse_matrix.h b/internal/ceres/block_random_access_sparse_matrix.h index 5520d49..b05096c 100644 --- a/internal/ceres/block_random_access_sparse_matrix.h +++ b/internal/ceres/block_random_access_sparse_matrix.h
@@ -40,7 +40,6 @@ #include "ceres/block_random_access_matrix.h" #include "ceres/triplet_sparse_matrix.h" #include "ceres/integral_types.h" -#include "ceres/internal/macros.h" #include "ceres/internal/port.h" #include "ceres/types.h" #include "ceres/small_blas.h" @@ -60,6 +59,8 @@ BlockRandomAccessSparseMatrix( const std::vector<int>& blocks, const std::set<std::pair<int, int>>& block_pairs); + BlockRandomAccessSparseMatrix(const BlockRandomAccessSparseMatrix&) = delete; + void operator=(const BlockRandomAccessSparseMatrix&) = delete; // The destructor is not thread safe. It assumes that no one is // modifying any cells when the matrix is being destroyed. @@ -120,7 +121,6 @@ std::unique_ptr<TripletSparseMatrix> tsm_; friend class BlockRandomAccessSparseMatrixTest; - CERES_DISALLOW_COPY_AND_ASSIGN(BlockRandomAccessSparseMatrix); }; } // namespace internal
diff --git a/internal/ceres/block_sparse_matrix.h b/internal/ceres/block_sparse_matrix.h index aa74cfa..366ef87 100644 --- a/internal/ceres/block_sparse_matrix.h +++ b/internal/ceres/block_sparse_matrix.h
@@ -38,7 +38,6 @@ #include "ceres/block_structure.h" #include "ceres/sparse_matrix.h" #include "ceres/internal/eigen.h" -#include "ceres/internal/macros.h" namespace ceres { namespace internal { @@ -64,6 +63,9 @@ explicit BlockSparseMatrix(CompressedRowBlockStructure* block_structure); BlockSparseMatrix(); + BlockSparseMatrix(const BlockSparseMatrix&) = delete; + void operator=(const BlockSparseMatrix&) = delete; + virtual ~BlockSparseMatrix(); // Implementation of SparseMatrix interface. @@ -129,7 +131,6 @@ int max_num_nonzeros_; std::unique_ptr<double[]> values_; std::unique_ptr<CompressedRowBlockStructure> block_structure_; - CERES_DISALLOW_COPY_AND_ASSIGN(BlockSparseMatrix); }; } // namespace internal
diff --git a/internal/ceres/canonical_views_clustering.cc b/internal/ceres/canonical_views_clustering.cc index ca8dff5..95fc36e 100644 --- a/internal/ceres/canonical_views_clustering.cc +++ b/internal/ceres/canonical_views_clustering.cc
@@ -35,7 +35,6 @@ #include <unordered_map> #include "ceres/graph.h" -#include "ceres/internal/macros.h" #include "ceres/map_util.h" #include "glog/logging.h" @@ -79,7 +78,6 @@ IntMap view_to_canonical_view_; // Maps a view to its similarity to its current cluster center. std::unordered_map<int, double> view_to_canonical_view_similarity_; - CERES_DISALLOW_COPY_AND_ASSIGN(CanonicalViewsClustering); }; void ComputeCanonicalViewsClustering(
diff --git a/internal/ceres/cgnr_solver.cc b/internal/ceres/cgnr_solver.cc index 3a7ed3c..463fbbd 100644 --- a/internal/ceres/cgnr_solver.cc +++ b/internal/ceres/cgnr_solver.cc
@@ -49,6 +49,8 @@ } } +CgnrSolver::~CgnrSolver() {} + LinearSolver::Summary CgnrSolver::SolveImpl( BlockSparseMatrix* A, const double* b,
diff --git a/internal/ceres/cgnr_solver.h b/internal/ceres/cgnr_solver.h index 7d9f8ef..0bd1883 100644 --- a/internal/ceres/cgnr_solver.h +++ b/internal/ceres/cgnr_solver.h
@@ -51,6 +51,10 @@ class CgnrSolver : public BlockSparseMatrixSolver { public: explicit CgnrSolver(const LinearSolver::Options& options); + CgnrSolver(const CgnrSolver&) = delete; + void operator=(const CgnrSolver&) = delete; + virtual ~CgnrSolver(); + virtual Summary SolveImpl( BlockSparseMatrix* A, const double* b, @@ -60,7 +64,6 @@ private: const LinearSolver::Options options_; std::unique_ptr<Preconditioner> preconditioner_; - CERES_DISALLOW_COPY_AND_ASSIGN(CgnrSolver); }; } // namespace internal
diff --git a/internal/ceres/compressed_row_sparse_matrix.h b/internal/ceres/compressed_row_sparse_matrix.h index 3e262e2..2b51b9b 100644 --- a/internal/ceres/compressed_row_sparse_matrix.h +++ b/internal/ceres/compressed_row_sparse_matrix.h
@@ -32,7 +32,6 @@ #define CERES_INTERNAL_COMPRESSED_ROW_SPARSE_MATRIX_H_ #include <vector> -#include "ceres/internal/macros.h" #include "ceres/internal/port.h" #include "ceres/sparse_matrix.h" #include "ceres/types.h"
diff --git a/internal/ceres/conjugate_gradients_solver.cc b/internal/ceres/conjugate_gradients_solver.cc index 3702276..039b4f4 100644 --- a/internal/ceres/conjugate_gradients_solver.cc +++ b/internal/ceres/conjugate_gradients_solver.cc
@@ -41,7 +41,6 @@ #include <cmath> #include <cstddef> -#include "ceres/fpclassify.h" #include "ceres/internal/eigen.h" #include "ceres/linear_operator.h" #include "ceres/stringprintf.h" @@ -53,7 +52,7 @@ namespace { bool IsZeroOrInfinity(double x) { - return ((x == 0.0) || (IsInfinite(x))); + return ((x == 0.0) || std::isinf(x)); } } // namespace @@ -148,7 +147,7 @@ q.setZero(); A->RightMultiply(p.data(), q.data()); const double pq = p.dot(q); - if ((pq <= 0) || IsInfinite(pq)) { + if ((pq <= 0) || std::isinf(pq)) { summary.termination_type = LINEAR_SOLVER_NO_CONVERGENCE; summary.message = StringPrintf( "Matrix is indefinite, no more progress can be made. " @@ -158,7 +157,7 @@ } const double alpha = rho / pq; - if (IsInfinite(alpha)) { + if (std::isinf(alpha)) { summary.termination_type = LINEAR_SOLVER_FAILURE; summary.message = StringPrintf("Numerical failure. alpha = rho / pq = %e, "
diff --git a/internal/ceres/conjugate_gradients_solver.h b/internal/ceres/conjugate_gradients_solver.h index a1e1833..434cde0 100644 --- a/internal/ceres/conjugate_gradients_solver.h +++ b/internal/ceres/conjugate_gradients_solver.h
@@ -35,7 +35,6 @@ #define CERES_INTERNAL_CONJUGATE_GRADIENTS_SOLVER_H_ #include "ceres/linear_solver.h" -#include "ceres/internal/macros.h" namespace ceres { namespace internal { @@ -65,7 +64,6 @@ private: const LinearSolver::Options options_; - CERES_DISALLOW_COPY_AND_ASSIGN(ConjugateGradientsSolver); }; } // namespace internal
diff --git a/internal/ceres/context_impl.h b/internal/ceres/context_impl.h index 8219ec2..d83b77a 100644 --- a/internal/ceres/context_impl.h +++ b/internal/ceres/context_impl.h
@@ -35,7 +35,6 @@ #include "ceres/internal/port.h" #include "ceres/context.h" -#include "ceres/internal/macros.h" #ifdef CERES_USE_CXX11_THREADS #include "ceres/thread_pool.h" @@ -47,6 +46,9 @@ class ContextImpl : public Context { public: ContextImpl() {} + ContextImpl(const ContextImpl&) = delete; + void operator=(const ContextImpl&) = delete; + virtual ~ContextImpl() {} // When compiled with C++11 threading support, resize the thread pool to have @@ -57,9 +59,6 @@ #ifdef CERES_USE_CXX11_THREADS ThreadPool thread_pool; #endif // CERES_USE_CXX11_THREADS - - private: - CERES_DISALLOW_COPY_AND_ASSIGN(ContextImpl); }; } // namespace internal
diff --git a/internal/ceres/dense_normal_cholesky_solver.h b/internal/ceres/dense_normal_cholesky_solver.h index 11287eb..c10bd7b 100644 --- a/internal/ceres/dense_normal_cholesky_solver.h +++ b/internal/ceres/dense_normal_cholesky_solver.h
@@ -35,7 +35,6 @@ #define CERES_INTERNAL_DENSE_NORMAL_CHOLESKY_SOLVER_H_ #include "ceres/linear_solver.h" -#include "ceres/internal/macros.h" namespace ceres { namespace internal { @@ -98,7 +97,6 @@ double* x); const LinearSolver::Options options_; - CERES_DISALLOW_COPY_AND_ASSIGN(DenseNormalCholeskySolver); }; } // namespace internal
diff --git a/internal/ceres/dense_qr_solver.h b/internal/ceres/dense_qr_solver.h index 1a6e089..2ec124f 100644 --- a/internal/ceres/dense_qr_solver.h +++ b/internal/ceres/dense_qr_solver.h
@@ -34,7 +34,6 @@ #include "ceres/linear_solver.h" #include "ceres/internal/eigen.h" -#include "ceres/internal/macros.h" namespace ceres { namespace internal { @@ -106,7 +105,6 @@ ColMajorMatrix lhs_; Vector rhs_; Vector work_; - CERES_DISALLOW_COPY_AND_ASSIGN(DenseQRSolver); }; } // namespace internal
diff --git a/internal/ceres/dense_sparse_matrix.h b/internal/ceres/dense_sparse_matrix.h index 9639a4a..e5a5483 100644 --- a/internal/ceres/dense_sparse_matrix.h +++ b/internal/ceres/dense_sparse_matrix.h
@@ -34,7 +34,6 @@ #define CERES_INTERNAL_DENSE_SPARSE_MATRIX_H_ #include "ceres/internal/eigen.h" -#include "ceres/internal/macros.h" #include "ceres/sparse_matrix.h" #include "ceres/types.h"
diff --git a/internal/ceres/dynamic_sparse_normal_cholesky_solver.h b/internal/ceres/dynamic_sparse_normal_cholesky_solver.h index 9861f6b..7032ce7 100644 --- a/internal/ceres/dynamic_sparse_normal_cholesky_solver.h +++ b/internal/ceres/dynamic_sparse_normal_cholesky_solver.h
@@ -37,7 +37,6 @@ // This include must come before any #ifndef check on Ceres compile options. #include "ceres/internal/port.h" -#include "ceres/internal/macros.h" #include "ceres/linear_solver.h" namespace ceres { @@ -76,7 +75,6 @@ double* rhs_and_solution); const LinearSolver::Options options_; - CERES_DISALLOW_COPY_AND_ASSIGN(DynamicSparseNormalCholeskySolver); }; } // namespace internal
diff --git a/internal/ceres/iterative_schur_complement_solver.h b/internal/ceres/iterative_schur_complement_solver.h index f898f02..c058f81 100644 --- a/internal/ceres/iterative_schur_complement_solver.h +++ b/internal/ceres/iterative_schur_complement_solver.h
@@ -70,6 +70,9 @@ class IterativeSchurComplementSolver : public BlockSparseMatrixSolver { public: explicit IterativeSchurComplementSolver(const LinearSolver::Options& options); + IterativeSchurComplementSolver(const IterativeSchurComplementSolver&) = delete; + void operator=(const IterativeSchurComplementSolver&) = delete; + virtual ~IterativeSchurComplementSolver(); private: @@ -85,7 +88,6 @@ std::unique_ptr<internal::ImplicitSchurComplement> schur_complement_; std::unique_ptr<Preconditioner> preconditioner_; Vector reduced_linear_system_solution_; - CERES_DISALLOW_COPY_AND_ASSIGN(IterativeSchurComplementSolver); }; } // namespace internal
diff --git a/internal/ceres/jet_test.cc b/internal/ceres/jet_test.cc index 188d9f5..e15fd67 100644 --- a/internal/ceres/jet_test.cc +++ b/internal/ceres/jet_test.cc
@@ -35,7 +35,6 @@ #include "glog/logging.h" #include "gtest/gtest.h" -#include "ceres/fpclassify.h" #include "ceres/stringprintf.h" #include "ceres/test_util.h"
diff --git a/internal/ceres/line_search.cc b/internal/ceres/line_search.cc index dd73b0e..a087615 100644 --- a/internal/ceres/line_search.cc +++ b/internal/ceres/line_search.cc
@@ -31,11 +31,11 @@ #include "ceres/line_search.h" #include <algorithm> +#include <cmath> #include <iomanip> #include <iostream> // NOLINT #include "ceres/evaluator.h" -#include "ceres/fpclassify.h" #include "ceres/function_sample.h" #include "ceres/internal/eigen.h" #include "ceres/map_util.h" @@ -128,7 +128,7 @@ const bool eval_status = evaluator_->Evaluate( output->vector_x.data(), &(output->value), NULL, gradient, NULL); - if (!eval_status || !IsFinite(output->value)) { + if (!eval_status || !std::isfinite(output->value)) { return; } @@ -138,7 +138,7 @@ } output->gradient = direction_.dot(output->vector_gradient); - if (!IsFinite(output->gradient)) { + if (!std::isfinite(output->gradient)) { return; }
diff --git a/internal/ceres/local_parameterization_test.cc b/internal/ceres/local_parameterization_test.cc index 2465b41..851f99c 100644 --- a/internal/ceres/local_parameterization_test.cc +++ b/internal/ceres/local_parameterization_test.cc
@@ -34,7 +34,6 @@ #include "Eigen/Geometry" #include "ceres/autodiff_local_parameterization.h" -#include "ceres/fpclassify.h" #include "ceres/householder_vector.h" #include "ceres/internal/autodiff.h" #include "ceres/internal/eigen.h"
diff --git a/internal/ceres/numeric_diff_cost_function_test.cc b/internal/ceres/numeric_diff_cost_function_test.cc index f006ff0..79d3e8a 100644 --- a/internal/ceres/numeric_diff_cost_function_test.cc +++ b/internal/ceres/numeric_diff_cost_function_test.cc
@@ -37,7 +37,6 @@ #include <string> #include <vector> -#include "ceres/internal/macros.h" #include "ceres/array_utils.h" #include "ceres/numeric_diff_test_utils.h" #include "ceres/test_util.h"
diff --git a/internal/ceres/numeric_diff_test_utils.cc b/internal/ceres/numeric_diff_test_utils.cc index bab186c..ab1b5f8 100644 --- a/internal/ceres/numeric_diff_test_utils.cc +++ b/internal/ceres/numeric_diff_test_utils.cc
@@ -34,7 +34,6 @@ #include <algorithm> #include <cmath> #include "ceres/cost_function.h" -#include "ceres/internal/macros.h" #include "ceres/test_util.h" #include "ceres/types.h" #include "gtest/gtest.h" @@ -122,10 +121,13 @@ void TranscendentalFunctor::ExpectCostFunctionEvaluationIsNearlyCorrect( const CostFunction& cost_function, NumericDiffMethodType method) const { - struct { + + struct TestParameterBlocks { double x1[5]; double x2[5]; - } kTests[] = { + }; + + std::vector<TestParameterBlocks> kTests = { { { 1.0, 2.0, 3.0, 4.0, 5.0 }, // No zeros. { 9.0, 9.0, 5.0, 5.0, 1.0 }, }, @@ -146,7 +148,7 @@ }, }; - for (int k = 0; k < CERES_ARRAYSIZE(kTests); ++k) { + for (int k = 0; k < kTests.size(); ++k) { double *x1 = &(kTests[k].x1[0]); double *x2 = &(kTests[k].x2[0]); double *parameters[] = { x1, x2 }; @@ -196,15 +198,16 @@ return true; } + void ExponentialFunctor::ExpectCostFunctionEvaluationIsNearlyCorrect( const CostFunction& cost_function) const { // Evaluating the functor at specific points for testing. - double kTests[] = { 1.0, 2.0, 3.0, 4.0, 5.0 }; + std::vector<double> kTests = { 1.0, 2.0, 3.0, 4.0, 5.0 }; // Minimal tolerance w.r.t. the cost function and the tests. const double kTolerance = 2e-14; - for (int k = 0; k < CERES_ARRAYSIZE(kTests); ++k) { + for (int k = 0; k < kTests.size(); ++k) { double *parameters[] = { &kTests[k] }; double dydx; double *jacobians[1] = { &dydx }; @@ -241,14 +244,14 @@ void RandomizedFunctor::ExpectCostFunctionEvaluationIsNearlyCorrect( const CostFunction& cost_function) const { - double kTests[] = { 0.0, 1.0, 3.0, 4.0, 50.0 }; + std::vector<double> kTests = { 0.0, 1.0, 3.0, 4.0, 50.0 }; const double kTolerance = 2e-4; // Initialize random number generator with given seed. srand(random_seed_); - for (int k = 0; k < CERES_ARRAYSIZE(kTests); ++k) { + for (int k = 0; k < kTests.size(); ++k) { double *parameters[] = { &kTests[k] }; double dydx; double *jacobians[1] = { &dydx };
diff --git a/internal/ceres/problem_impl.h b/internal/ceres/problem_impl.h index 44d6e89..88df82c 100644 --- a/internal/ceres/problem_impl.h +++ b/internal/ceres/problem_impl.h
@@ -45,7 +45,6 @@ #include <vector> #include "ceres/context_impl.h" -#include "ceres/internal/macros.h" #include "ceres/internal/port.h" #include "ceres/problem.h" #include "ceres/types.h" @@ -71,6 +70,8 @@ ProblemImpl(); explicit ProblemImpl(const Problem::Options& options); + ProblemImpl(const ProblemImpl&) = delete; + void operator=(const ProblemImpl&) = delete; ~ProblemImpl(); @@ -226,7 +227,6 @@ CostFunctionRefCount cost_function_ref_count_; LossFunctionRefCount loss_function_ref_count_; std::vector<double*> residual_parameters_; - CERES_DISALLOW_COPY_AND_ASSIGN(ProblemImpl); }; } // namespace internal
diff --git a/internal/ceres/schur_complement_solver.h b/internal/ceres/schur_complement_solver.h index 5f15c86..16ffb8c 100644 --- a/internal/ceres/schur_complement_solver.h +++ b/internal/ceres/schur_complement_solver.h
@@ -115,6 +115,8 @@ CHECK_GT(options.elimination_groups[0], 0); CHECK(options.context != NULL); } + SchurComplementSolver(const SchurComplementSolver&) = delete; + void operator=(const SchurComplementSolver&) = delete; // LinearSolver methods virtual ~SchurComplementSolver() {} @@ -143,8 +145,6 @@ std::unique_ptr<SchurEliminatorBase> eliminator_; std::unique_ptr<BlockRandomAccessMatrix> lhs_; std::unique_ptr<double[]> rhs_; - - CERES_DISALLOW_COPY_AND_ASSIGN(SchurComplementSolver); }; // Dense Cholesky factorization based solver. @@ -152,6 +152,9 @@ public: explicit DenseSchurComplementSolver(const LinearSolver::Options& options) : SchurComplementSolver(options) {} + DenseSchurComplementSolver(const DenseSchurComplementSolver&) = delete; + void operator=(const DenseSchurComplementSolver&) = delete; + virtual ~DenseSchurComplementSolver() {} private: @@ -159,14 +162,15 @@ virtual LinearSolver::Summary SolveReducedLinearSystem( const LinearSolver::PerSolveOptions& per_solve_options, double* solution); - - CERES_DISALLOW_COPY_AND_ASSIGN(DenseSchurComplementSolver); }; // Sparse Cholesky factorization based solver. class SparseSchurComplementSolver : public SchurComplementSolver { public: explicit SparseSchurComplementSolver(const LinearSolver::Options& options); + SparseSchurComplementSolver(const SparseSchurComplementSolver&) = delete; + void operator=(const SparseSchurComplementSolver&) = delete; + virtual ~SparseSchurComplementSolver(); private: @@ -182,7 +186,6 @@ std::vector<int> blocks_; std::unique_ptr<SparseCholesky> sparse_cholesky_; std::unique_ptr<BlockRandomAccessDiagonalMatrix> preconditioner_; - CERES_DISALLOW_COPY_AND_ASSIGN(SparseSchurComplementSolver); }; } // namespace internal
diff --git a/internal/ceres/schur_jacobi_preconditioner.h b/internal/ceres/schur_jacobi_preconditioner.h index 2a61d6f..c95468f 100644 --- a/internal/ceres/schur_jacobi_preconditioner.h +++ b/internal/ceres/schur_jacobi_preconditioner.h
@@ -43,7 +43,6 @@ #include <utility> #include <vector> -#include "ceres/internal/macros.h" #include "ceres/preconditioner.h" namespace ceres { @@ -83,6 +82,9 @@ // based solvers. Please see schur_eliminator.h for more details. SchurJacobiPreconditioner(const CompressedRowBlockStructure& bs, const Preconditioner::Options& options); + SchurJacobiPreconditioner(const SchurJacobiPreconditioner&) = delete; + void operator=(const SchurJacobiPreconditioner&) = delete; + virtual ~SchurJacobiPreconditioner(); // Preconditioner interface. @@ -97,7 +99,6 @@ std::unique_ptr<SchurEliminatorBase> eliminator_; // Preconditioner matrix. std::unique_ptr<BlockRandomAccessDiagonalMatrix> m_; - CERES_DISALLOW_COPY_AND_ASSIGN(SchurJacobiPreconditioner); }; } // namespace internal
diff --git a/internal/ceres/sparse_normal_cholesky_solver.h b/internal/ceres/sparse_normal_cholesky_solver.h index 59c7c0b..95d5436 100644 --- a/internal/ceres/sparse_normal_cholesky_solver.h +++ b/internal/ceres/sparse_normal_cholesky_solver.h
@@ -38,7 +38,6 @@ #include "ceres/internal/port.h" #include <vector> -#include "ceres/internal/macros.h" #include "ceres/linear_solver.h" namespace ceres { @@ -53,6 +52,9 @@ class SparseNormalCholeskySolver : public BlockSparseMatrixSolver { public: explicit SparseNormalCholeskySolver(const LinearSolver::Options& options); + SparseNormalCholeskySolver(const SparseNormalCholeskySolver&) = delete; + void operator=(const SparseNormalCholeskySolver&) = delete; + virtual ~SparseNormalCholeskySolver(); private: @@ -66,7 +68,6 @@ Vector rhs_; std::unique_ptr<SparseCholesky> sparse_cholesky_; std::unique_ptr<InnerProductComputer> inner_product_computer_; - CERES_DISALLOW_COPY_AND_ASSIGN(SparseNormalCholeskySolver); }; } // namespace internal
diff --git a/internal/ceres/visibility_based_preconditioner.h b/internal/ceres/visibility_based_preconditioner.h index a03a582..31ba171 100644 --- a/internal/ceres/visibility_based_preconditioner.h +++ b/internal/ceres/visibility_based_preconditioner.h
@@ -56,7 +56,6 @@ #include <vector> #include "ceres/graph.h" -#include "ceres/internal/macros.h" #include "ceres/linear_solver.h" #include "ceres/pair_hash.h" #include "ceres/preconditioner.h" @@ -135,6 +134,9 @@ // based solvers. Please see schur_eliminator.h for more details. VisibilityBasedPreconditioner(const CompressedRowBlockStructure& bs, const Preconditioner::Options& options); + VisibilityBasedPreconditioner(const VisibilityBasedPreconditioner&) = delete; + void operator=(const VisibilityBasedPreconditioner&) = delete; + virtual ~VisibilityBasedPreconditioner(); // Preconditioner interface @@ -191,7 +193,6 @@ // Preconditioner matrix. std::unique_ptr<BlockRandomAccessSparseMatrix> m_; std::unique_ptr<SparseCholesky> sparse_cholesky_; - CERES_DISALLOW_COPY_AND_ASSIGN(VisibilityBasedPreconditioner); }; } // namespace internal