Remove using namespace std;
For historical reasons we had a "using namespace std;" in port.h. This
is generally a bad idea. So removing it and along the way doing a bunch
of cpplint cleanup.
Change-Id: Ia125601a55ae62695e247fb0250df4c6f86c46c6
diff --git a/include/ceres/conditioned_cost_function.h b/include/ceres/conditioned_cost_function.h
index 3f0087c..eee7116 100644
--- a/include/ceres/conditioned_cost_function.h
+++ b/include/ceres/conditioned_cost_function.h
@@ -78,7 +78,7 @@
// functions, or not, depending on the ownership parameter. Conditioners
// may be NULL, in which case the corresponding residual is not modified.
ConditionedCostFunction(CostFunction* wrapped_cost_function,
- const vector<CostFunction*>& conditioners,
+ const std::vector<CostFunction*>& conditioners,
Ownership ownership);
virtual ~ConditionedCostFunction();
@@ -88,7 +88,7 @@
private:
internal::scoped_ptr<CostFunction> wrapped_cost_function_;
- vector<CostFunction*> conditioners_;
+ std::vector<CostFunction*> conditioners_;
Ownership ownership_;
};
diff --git a/include/ceres/cost_function.h b/include/ceres/cost_function.h
index fe8fc07..069e572 100644
--- a/include/ceres/cost_function.h
+++ b/include/ceres/cost_function.h
@@ -115,7 +115,7 @@
double* residuals,
double** jacobians) const = 0;
- const vector<int32>& parameter_block_sizes() const {
+ const std::vector<int32>& parameter_block_sizes() const {
return parameter_block_sizes_;
}
@@ -124,7 +124,7 @@
}
protected:
- vector<int32>* mutable_parameter_block_sizes() {
+ std::vector<int32>* mutable_parameter_block_sizes() {
return ¶meter_block_sizes_;
}
@@ -135,7 +135,7 @@
private:
// Cost function signature metadata: number of inputs & their sizes,
// number of outputs (residuals).
- vector<int32> parameter_block_sizes_;
+ std::vector<int32> parameter_block_sizes_;
int num_residuals_;
CERES_DISALLOW_COPY_AND_ASSIGN(CostFunction);
};
diff --git a/include/ceres/cost_function_to_functor.h b/include/ceres/cost_function_to_functor.h
index b4a516e..65bc931 100644
--- a/include/ceres/cost_function_to_functor.h
+++ b/include/ceres/cost_function_to_functor.h
@@ -112,20 +112,20 @@
// This block breaks the 80 column rule to keep it somewhat readable.
CHECK((!N1 && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
((N1 > 0) && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && (N9 > 0)))
+ ((N1 > 0) && (N2 > 0) && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && (N9 > 0))) // NOLINT
<< "Zero block cannot precede a non-zero block. Block sizes are "
<< "(ignore trailing 0s): " << N0 << ", " << N1 << ", " << N2 << ", "
<< N3 << ", " << N4 << ", " << N5 << ", " << N6 << ", " << N7 << ", "
<< N8 << ", " << N9;
- const vector<int32>& parameter_block_sizes =
+ const std::vector<int32>& parameter_block_sizes =
cost_function->parameter_block_sizes();
const int num_parameter_blocks =
(N0 > 0) + (N1 > 0) + (N2 > 0) + (N3 > 0) + (N4 > 0) +
@@ -677,7 +677,7 @@
template <typename JetT>
bool EvaluateWithJets(const JetT** inputs, JetT* output) const {
const int kNumParameters = N0 + N1 + N2 + N3 + N4 + N5 + N6 + N7 + N8 + N9;
- const vector<int32>& parameter_block_sizes =
+ const std::vector<int32>& parameter_block_sizes =
cost_function_->parameter_block_sizes();
const int num_parameter_blocks = parameter_block_sizes.size();
const int num_residuals = cost_function_->num_residuals();
diff --git a/include/ceres/covariance.h b/include/ceres/covariance.h
index 35fde4d..1966340 100644
--- a/include/ceres/covariance.h
+++ b/include/ceres/covariance.h
@@ -183,7 +183,7 @@
// Covariance::Options options;
// Covariance covariance(options);
//
-// vector<pair<const double*, const double*> > covariance_blocks;
+// std::vector<std::pair<const double*, const double*> > covariance_blocks;
// covariance_blocks.push_back(make_pair(x, x));
// covariance_blocks.push_back(make_pair(y, y));
// covariance_blocks.push_back(make_pair(x, y));
@@ -353,7 +353,8 @@
// Covariance::Options for more on the conditions under which this
// function returns false.
bool Compute(
- const vector<pair<const double*, const double*> >& covariance_blocks,
+ const std::vector<std::pair<const double*,
+ const double*> >& covariance_blocks,
Problem* problem);
// Return the block of the covariance matrix corresponding to
diff --git a/include/ceres/crs_matrix.h b/include/ceres/crs_matrix.h
index d2d6289..757cac3 100644
--- a/include/ceres/crs_matrix.h
+++ b/include/ceres/crs_matrix.h
@@ -74,9 +74,9 @@
// cols = [ 1, 3, 1, 2, 3, 0, 1]
// values = [10, 4, 2, -3, 2, 1, 2]
- vector<int> cols;
- vector<int> rows;
- vector<double> values;
+ std::vector<int> cols;
+ std::vector<int> rows;
+ std::vector<double> values;
};
} // namespace ceres
diff --git a/include/ceres/dynamic_autodiff_cost_function.h b/include/ceres/dynamic_autodiff_cost_function.h
index f9342cd..810aded 100644
--- a/include/ceres/dynamic_autodiff_cost_function.h
+++ b/include/ceres/dynamic_autodiff_cost_function.h
@@ -120,18 +120,18 @@
0);
// Allocate scratch space for the strided evaluation.
- vector<Jet<double, Stride> > input_jets(num_parameters);
- vector<Jet<double, Stride> > output_jets(num_residuals());
+ std::vector<Jet<double, Stride> > input_jets(num_parameters);
+ std::vector<Jet<double, Stride> > output_jets(num_residuals());
// Make the parameter pack that is sent to the functor (reused).
- vector<Jet<double, Stride>* > jet_parameters(num_parameter_blocks,
+ std::vector<Jet<double, Stride>* > jet_parameters(num_parameter_blocks,
static_cast<Jet<double, Stride>* >(NULL));
int num_active_parameters = 0;
// To handle constant parameters between non-constant parameter blocks, the
// start position --- a raw parameter index --- of each contiguous block of
// non-constant parameters is recorded in start_derivative_section.
- vector<int> start_derivative_section;
+ std::vector<int> start_derivative_section;
bool in_derivative_section = false;
int parameter_cursor = 0;
diff --git a/include/ceres/dynamic_numeric_diff_cost_function.h b/include/ceres/dynamic_numeric_diff_cost_function.h
index 2b6e826..37a1eb6 100644
--- a/include/ceres/dynamic_numeric_diff_cost_function.h
+++ b/include/ceres/dynamic_numeric_diff_cost_function.h
@@ -104,7 +104,7 @@
<< "You must call DynamicNumericDiffCostFunction::SetNumResiduals() "
<< "before DynamicNumericDiffCostFunction::Evaluate().";
- const vector<int32>& block_sizes = parameter_block_sizes();
+ const std::vector<int32>& block_sizes = parameter_block_sizes();
CHECK(!block_sizes.empty())
<< "You must call DynamicNumericDiffCostFunction::AddParameterBlock() "
<< "before DynamicNumericDiffCostFunction::Evaluate().";
@@ -116,8 +116,8 @@
// Create local space for a copy of the parameters which will get mutated.
int parameters_size = accumulate(block_sizes.begin(), block_sizes.end(), 0);
- vector<double> parameters_copy(parameters_size);
- vector<double*> parameters_references_copy(block_sizes.size());
+ std::vector<double> parameters_copy(parameters_size);
+ std::vector<double*> parameters_references_copy(block_sizes.size());
parameters_references_copy[0] = ¶meters_copy[0];
for (int block = 1; block < block_sizes.size(); ++block) {
parameters_references_copy[block] = parameters_references_copy[block - 1]
diff --git a/include/ceres/fpclassify.h b/include/ceres/fpclassify.h
index da8a4d0..c2afeab 100644
--- a/include/ceres/fpclassify.h
+++ b/include/ceres/fpclassify.h
@@ -50,7 +50,7 @@
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) {
+inline bool IsNormal (double x) { // NOLINT
int classification = _fpclass(x);
return classification == _FPCLASS_NN ||
classification == _FPCLASS_PN;
diff --git a/include/ceres/gradient_checker.h b/include/ceres/gradient_checker.h
index 79ebae5..72b05b6 100644
--- a/include/ceres/gradient_checker.h
+++ b/include/ceres/gradient_checker.h
@@ -78,10 +78,10 @@
// block.
// Derivatives as computed by the cost function.
- vector<Matrix> term_jacobians;
+ std::vector<Matrix> term_jacobians;
// Derivatives as computed by finite differencing.
- vector<Matrix> finite_difference_jacobians;
+ std::vector<Matrix> finite_difference_jacobians;
// Infinity-norm of term_jacobians - finite_difference_jacobians.
double error_jacobians;
@@ -119,7 +119,7 @@
// Do a consistency check between the term and the template parameters.
CHECK_EQ(M, term->num_residuals());
const int num_residuals = M;
- const vector<int32>& block_sizes = term->parameter_block_sizes();
+ const std::vector<int32>& block_sizes = term->parameter_block_sizes();
const int num_blocks = block_sizes.size();
CHECK_LE(num_blocks, 5) << "Unable to test functions that take more "
diff --git a/include/ceres/gradient_problem_solver.h b/include/ceres/gradient_problem_solver.h
index 6e16dd7..0676d92 100644
--- a/include/ceres/gradient_problem_solver.h
+++ b/include/ceres/gradient_problem_solver.h
@@ -261,7 +261,7 @@
// executed, then set update_state_every_iteration to true.
//
// The solver does NOT take ownership of these pointers.
- vector<IterationCallback*> callbacks;
+ std::vector<IterationCallback*> callbacks;
};
struct CERES_EXPORT Summary {
@@ -292,7 +292,7 @@
double final_cost;
// IterationSummary for each minimizer iteration in order.
- vector<IterationSummary> iterations;
+ std::vector<IterationSummary> iterations;
// Sum total of all time spent inside Ceres when Solve is called.
double total_time_in_seconds;
diff --git a/include/ceres/internal/autodiff.h b/include/ceres/internal/autodiff.h
index 3a96625..ef05d55 100644
--- a/include/ceres/internal/autodiff.h
+++ b/include/ceres/internal/autodiff.h
@@ -214,15 +214,15 @@
// This block breaks the 80 column rule to keep it somewhat readable.
DCHECK_GT(num_outputs, 0);
DCHECK((!N1 && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && (N9 > 0)))
+ ((N1 > 0) && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
+ ((N1 > 0) && (N2 > 0) && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && (N9 > 0))) // NOLINT
<< "Zero block cannot precede a non-zero block. Block sizes are "
<< "(ignore trailing 0s): " << N0 << ", " << N1 << ", " << N2 << ", "
<< N3 << ", " << N4 << ", " << N5 << ", " << N6 << ", " << N7 << ", "
diff --git a/include/ceres/internal/port.h b/include/ceres/internal/port.h
index e38eb71..24eca05 100644
--- a/include/ceres/internal/port.h
+++ b/include/ceres/internal/port.h
@@ -46,12 +46,6 @@
namespace ceres {
-// It is unfortunate that this import of the entire standard namespace is
-// necessary. The reasons are historical and won't be explained here, but
-// suffice to say it is not a mistake and can't be removed without breaking
-// things outside of the Ceres optimization package.
-using namespace std;
-
// This is necessary to properly handle the case that there is a different
// "string" implementation in the global namespace.
using std::string;
diff --git a/include/ceres/local_parameterization.h b/include/ceres/local_parameterization.h
index 656c4d4..6a5a689 100644
--- a/include/ceres/local_parameterization.h
+++ b/include/ceres/local_parameterization.h
@@ -173,7 +173,7 @@
class CERES_EXPORT SubsetParameterization : public LocalParameterization {
public:
explicit SubsetParameterization(int size,
- const vector<int>& constant_parameters);
+ const std::vector<int>& constant_parameters);
virtual ~SubsetParameterization() {}
virtual bool Plus(const double* x,
const double* delta,
@@ -191,7 +191,7 @@
private:
const int local_size_;
- vector<int> constancy_mask_;
+ std::vector<int> constancy_mask_;
};
// Plus(x, delta) = [cos(|delta|), sin(|delta|) delta / |delta|] * x
diff --git a/include/ceres/ordered_groups.h b/include/ceres/ordered_groups.h
index c316d71..d42e285 100644
--- a/include/ceres/ordered_groups.h
+++ b/include/ceres/ordered_groups.h
@@ -63,7 +63,8 @@
return false;
}
- typename map<T, int>::const_iterator it = element_to_group_.find(element);
+ typename std::map<T, int>::const_iterator it =
+ element_to_group_.find(element);
if (it != element_to_group_.end()) {
if (it->second == group) {
// Element is already in the right group, nothing to do.
@@ -107,7 +108,7 @@
// Bulk remove elements. The return value indicates the number of
// elements successfully removed.
- int Remove(const vector<T>& elements) {
+ int Remove(const std::vector<T>& elements) {
if (NumElements() == 0 || elements.size() == 0) {
return 0;
}
@@ -121,14 +122,14 @@
// Reverse the order of the groups in place.
void Reverse() {
- typename map<int, set<T> >::reverse_iterator it =
+ typename std::map<int, std::set<T> >::reverse_iterator it =
group_to_elements_.rbegin();
- map<int, set<T> > new_group_to_elements;
+ std::map<int, std::set<T> > new_group_to_elements;
new_group_to_elements[it->first] = it->second;
int new_group_id = it->first + 1;
for (++it; it != group_to_elements_.rend(); ++it) {
- for (typename set<T>::const_iterator element_it = it->second.begin();
+ for (typename std::set<T>::const_iterator element_it = it->second.begin();
element_it != it->second.end();
++element_it) {
element_to_group_[*element_it] = new_group_id;
@@ -143,7 +144,8 @@
// Return the group id for the element. If the element is not a
// member of any group, return -1.
int GroupId(const T element) const {
- typename map<T, int>::const_iterator it = element_to_group_.find(element);
+ typename std::map<T, int>::const_iterator it =
+ element_to_group_.find(element);
if (it == element_to_group_.end()) {
return -1;
}
@@ -151,14 +153,15 @@
}
bool IsMember(const T element) const {
- typename map<T, int>::const_iterator it = element_to_group_.find(element);
+ typename std::map<T, int>::const_iterator it =
+ element_to_group_.find(element);
return (it != element_to_group_.end());
}
// This function always succeeds, i.e., implicitly there exists a
// group for every integer.
int GroupSize(const int group) const {
- typename map<int, set<T> >::const_iterator it =
+ typename std::map<int, std::set<T> >::const_iterator it =
group_to_elements_.find(group);
return (it == group_to_elements_.end()) ? 0 : it->second.size();
}
@@ -180,17 +183,17 @@
return group_to_elements_.begin()->first;
}
- const map<int, set<T> >& group_to_elements() const {
+ const std::map<int, std::set<T> >& group_to_elements() const {
return group_to_elements_;
}
- const map<T, int>& element_to_group() const {
+ const std::map<T, int>& element_to_group() const {
return element_to_group_;
}
private:
- map<int, set<T> > group_to_elements_;
- map<T, int> element_to_group_;
+ std::map<int, std::set<T> > group_to_elements_;
+ std::map<T, int> element_to_group_;
};
// Typedef for the most commonly used version of OrderedGroups.
diff --git a/include/ceres/problem.h b/include/ceres/problem.h
index be2ac6c..fba120b 100644
--- a/include/ceres/problem.h
+++ b/include/ceres/problem.h
@@ -211,9 +211,10 @@
// problem.AddResidualBlock(new MyUnaryCostFunction(...), NULL, x1);
// problem.AddResidualBlock(new MyBinaryCostFunction(...), NULL, x2, x1);
//
- ResidualBlockId AddResidualBlock(CostFunction* cost_function,
- LossFunction* loss_function,
- const vector<double*>& parameter_blocks);
+ ResidualBlockId AddResidualBlock(
+ CostFunction* cost_function,
+ LossFunction* loss_function,
+ const std::vector<double*>& parameter_blocks);
// Convenience methods for adding residuals with a small number of
// parameters. This is the common case. Instead of specifying the
@@ -356,17 +357,17 @@
// Fills the passed parameter_blocks vector with pointers to the
// parameter blocks currently in the problem. After this call,
// parameter_block.size() == NumParameterBlocks.
- void GetParameterBlocks(vector<double*>* parameter_blocks) const;
+ void GetParameterBlocks(std::vector<double*>* parameter_blocks) const;
// Fills the passed residual_blocks vector with pointers to the
// residual blocks currently in the problem. After this call,
// residual_blocks.size() == NumResidualBlocks.
- void GetResidualBlocks(vector<ResidualBlockId>* residual_blocks) const;
+ void GetResidualBlocks(std::vector<ResidualBlockId>* residual_blocks) const;
// Get all the parameter blocks that depend on the given residual block.
void GetParameterBlocksForResidualBlock(
const ResidualBlockId residual_block,
- vector<double*>* parameter_blocks) const;
+ std::vector<double*>* parameter_blocks) const;
// Get the CostFunction for the given residual block.
const CostFunction* GetCostFunctionForResidualBlock(
@@ -385,7 +386,7 @@
// block will incur a scan of the entire Problem object.
void GetResidualBlocksForParameterBlock(
const double* values,
- vector<ResidualBlockId>* residual_blocks) const;
+ std::vector<ResidualBlockId>* residual_blocks) const;
// Options struct to control Problem::Evaluate.
struct EvaluateOptions {
@@ -408,7 +409,7 @@
// used to add parameter blocks to the Problem. These parameter
// block should NOT point to new memory locations. Bad things will
// happen otherwise.
- vector<double*> parameter_blocks;
+ std::vector<double*> parameter_blocks;
// The set of residual blocks to evaluate. This vector determines
// the order in which the residuals occur, and how the rows of the
@@ -418,7 +419,7 @@
// the order in which they were added to the problem. But, this
// may change if the user removes any residual blocks from the
// problem.
- vector<ResidualBlockId> residual_blocks;
+ std::vector<ResidualBlockId> residual_blocks;
// Even though the residual blocks in the problem may contain loss
// functions, setting apply_loss_function to false will turn off
@@ -462,8 +463,8 @@
// columns in the jacobian).
bool Evaluate(const EvaluateOptions& options,
double* cost,
- vector<double>* residuals,
- vector<double>* gradient,
+ std::vector<double>* residuals,
+ std::vector<double>* gradient,
CRSMatrix* jacobian);
private:
diff --git a/include/ceres/rotation.h b/include/ceres/rotation.h
index d77ce21..b7cb32e 100644
--- a/include/ceres/rotation.h
+++ b/include/ceres/rotation.h
@@ -47,6 +47,7 @@
#include <algorithm>
#include <cmath>
+#include <limits>
#include "glog/logging.h"
namespace ceres {
diff --git a/include/ceres/sized_cost_function.h b/include/ceres/sized_cost_function.h
index 4f98d4e..0a4325b 100644
--- a/include/ceres/sized_cost_function.h
+++ b/include/ceres/sized_cost_function.h
@@ -55,15 +55,15 @@
// This block breaks the 80 column rule to keep it somewhat readable.
CHECK((!N1 && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && !N5 && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && !N6 && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && !N7 && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && !N8 && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && !N9) ||
- ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && (N9 > 0)))
+ ((N1 > 0) && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
+ ((N1 > 0) && (N2 > 0) && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && !N6 && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && !N7 && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && !N8 && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && !N9) || // NOLINT
+ ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && (N9 > 0))) // NOLINT
<< "Zero block cannot precede a non-zero block. Block sizes are "
<< "(ignore trailing 0s): " << N0 << ", " << N1 << ", " << N2 << ", "
<< N3 << ", " << N4 << ", " << N5 << ", " << N6 << ", " << N7 << ", "
diff --git a/include/ceres/solver.h b/include/ceres/solver.h
index b2fa3ae..dc06151 100644
--- a/include/ceres/solver.h
+++ b/include/ceres/solver.h
@@ -92,7 +92,7 @@
gradient_tolerance = 1e-10;
parameter_tolerance = 1e-8;
-#if defined(CERES_NO_SUITESPARSE) && defined(CERES_NO_CXSPARSE) && !defined(CERES_ENABLE_LGPL_CODE)
+#if defined(CERES_NO_SUITESPARSE) && defined(CERES_NO_CXSPARSE) && !defined(CERES_ENABLE_LGPL_CODE) // NOLINT
linear_solver_type = DENSE_QR;
#else
linear_solver_type = SPARSE_NORMAL_CHOLESKY;
@@ -677,7 +677,7 @@
// List of iterations at which the minimizer should dump the trust
// region problem. Useful for testing and benchmarking. If empty
// (default), no problems are dumped.
- vector<int> trust_region_minimizer_iterations_to_dump;
+ std::vector<int> trust_region_minimizer_iterations_to_dump;
// Directory to which the problems should be written to. Should be
// non-empty if trust_region_minimizer_iterations_to_dump is
@@ -747,7 +747,7 @@
// executed, then set update_state_every_iteration to true.
//
// The solver does NOT take ownership of these pointers.
- vector<IterationCallback*> callbacks;
+ std::vector<IterationCallback*> callbacks;
};
struct CERES_EXPORT Summary {
@@ -785,7 +785,7 @@
double fixed_cost;
// IterationSummary for each minimizer iteration in order.
- vector<IterationSummary> iterations;
+ std::vector<IterationSummary> iterations;
// Number of minimizer iterations in which the step was
// accepted. Unless use_non_monotonic_steps is true this is also
@@ -926,7 +926,7 @@
// Size of the elimination groups given by the user as hints to
// the linear solver.
- vector<int> linear_solver_ordering_given;
+ std::vector<int> linear_solver_ordering_given;
// Size of the parameter groups used by the solver when ordering
// the columns of the Jacobian. This maybe different from
@@ -934,7 +934,7 @@
// linear_solver_ordering_given blank and asked for an automatic
// ordering, or if the problem contains some constant or inactive
// parameter blocks.
- vector<int> linear_solver_ordering_used;
+ std::vector<int> linear_solver_ordering_used;
// True if the user asked for inner iterations to be used as part
// of the optimization.
@@ -948,7 +948,7 @@
// Size of the parameter groups given by the user for performing
// inner iterations.
- vector<int> inner_iteration_ordering_given;
+ std::vector<int> inner_iteration_ordering_given;
// Size of the parameter groups given used by the solver for
// performing inner iterations. This maybe different from
@@ -956,7 +956,7 @@
// inner_iteration_ordering_given blank and asked for an automatic
// ordering, or if the problem contains some constant or inactive
// parameter blocks.
- vector<int> inner_iteration_ordering_used;
+ std::vector<int> inner_iteration_ordering_used;
// Type of the preconditioner requested by the user.
PreconditionerType preconditioner_type_given;