mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
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
This commit is contained in:
@@ -51,6 +51,9 @@
|
||||
|
||||
namespace ceres {
|
||||
namespace internal {
|
||||
|
||||
using std::vector;
|
||||
|
||||
namespace {
|
||||
|
||||
// True if x and y have an absolute relative difference less than
|
||||
@@ -68,7 +71,7 @@ bool IsClose(double x, double y, double relative_precision,
|
||||
relative_error = &local_relative_error;
|
||||
}
|
||||
*absolute_error = fabs(x - y);
|
||||
*relative_error = *absolute_error / max(fabs(x), fabs(y));
|
||||
*relative_error = *absolute_error / std::max(fabs(x), fabs(y));
|
||||
if (x == 0 || y == 0) {
|
||||
// If x or y is exactly zero, then relative difference doesn't have any
|
||||
// meaning. Take the absolute difference instead.
|
||||
@@ -121,7 +124,8 @@ class GradientCheckingCostFunction : public CostFunction {
|
||||
vector<Matrix> term_jacobians(block_sizes.size());
|
||||
vector<Matrix> finite_difference_jacobians(block_sizes.size());
|
||||
vector<double*> term_jacobian_pointers(block_sizes.size());
|
||||
vector<double*> finite_difference_jacobian_pointers(block_sizes.size());
|
||||
vector<double*> finite_difference_jacobian_pointers(
|
||||
block_sizes.size());
|
||||
for (int i = 0; i < block_sizes.size(); i++) {
|
||||
term_jacobians[i].resize(num_residuals, block_sizes[i]);
|
||||
term_jacobian_pointers[i] = term_jacobians[i].data();
|
||||
@@ -259,7 +263,8 @@ ProblemImpl* CreateGradientCheckingProblemImpl(ProblemImpl* problem_impl,
|
||||
|
||||
// For every ParameterBlock in problem_impl, create a new parameter
|
||||
// block with the same local parameterization and constancy.
|
||||
const vector<ParameterBlock*>& parameter_blocks = program->parameter_blocks();
|
||||
const vector<ParameterBlock*>& parameter_blocks =
|
||||
program->parameter_blocks();
|
||||
for (int i = 0; i < parameter_blocks.size(); ++i) {
|
||||
ParameterBlock* parameter_block = parameter_blocks[i];
|
||||
gradient_checking_problem_impl->AddParameterBlock(
|
||||
@@ -276,7 +281,8 @@ ProblemImpl* CreateGradientCheckingProblemImpl(ProblemImpl* problem_impl,
|
||||
// For every ResidualBlock in problem_impl, create a new
|
||||
// ResidualBlock by wrapping its CostFunction inside a
|
||||
// GradientCheckingCostFunction.
|
||||
const vector<ResidualBlock*>& residual_blocks = program->residual_blocks();
|
||||
const vector<ResidualBlock*>& residual_blocks =
|
||||
program->residual_blocks();
|
||||
for (int i = 0; i < residual_blocks.size(); ++i) {
|
||||
ResidualBlock* residual_block = residual_blocks[i];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user