mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 09:00:37 +08:00
Removing using std::...
Change-Id: I584402e2a34869183c1d59071a15d97b216c52fb
This commit is contained in:
@@ -38,8 +38,6 @@
|
||||
|
||||
namespace ceres::internal {
|
||||
|
||||
using std::vector;
|
||||
|
||||
const double kTolerance = 1e-6;
|
||||
|
||||
// Takes 2 parameter blocks:
|
||||
@@ -74,8 +72,8 @@ class MyCostFunctor {
|
||||
};
|
||||
|
||||
TEST(DynamicNumericdiffCostFunctionTest, TestResiduals) {
|
||||
vector<double> param_block_0(10, 0.0);
|
||||
vector<double> param_block_1(5, 0.0);
|
||||
std::vector<double> param_block_0(10, 0.0);
|
||||
std::vector<double> param_block_1(5, 0.0);
|
||||
DynamicNumericDiffCostFunction<MyCostFunctor> cost_function(
|
||||
new MyCostFunctor());
|
||||
cost_function.AddParameterBlock(param_block_0.size());
|
||||
@@ -83,8 +81,8 @@ TEST(DynamicNumericdiffCostFunctionTest, TestResiduals) {
|
||||
cost_function.SetNumResiduals(21);
|
||||
|
||||
// Test residual computation.
|
||||
vector<double> residuals(21, -100000);
|
||||
vector<double*> parameter_blocks(2);
|
||||
std::vector<double> residuals(21, -100000);
|
||||
std::vector<double*> parameter_blocks(2);
|
||||
parameter_blocks[0] = ¶m_block_0[0];
|
||||
parameter_blocks[1] = ¶m_block_1[0];
|
||||
EXPECT_TRUE(
|
||||
@@ -98,11 +96,11 @@ TEST(DynamicNumericdiffCostFunctionTest, TestResiduals) {
|
||||
|
||||
TEST(DynamicNumericdiffCostFunctionTest, TestJacobian) {
|
||||
// Test the residual counting.
|
||||
vector<double> param_block_0(10, 0.0);
|
||||
std::vector<double> param_block_0(10, 0.0);
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
param_block_0[i] = 2 * i;
|
||||
}
|
||||
vector<double> param_block_1(5, 0.0);
|
||||
std::vector<double> param_block_1(5, 0.0);
|
||||
DynamicNumericDiffCostFunction<MyCostFunctor> cost_function(
|
||||
new MyCostFunctor());
|
||||
cost_function.AddParameterBlock(param_block_0.size());
|
||||
@@ -110,18 +108,18 @@ TEST(DynamicNumericdiffCostFunctionTest, TestJacobian) {
|
||||
cost_function.SetNumResiduals(21);
|
||||
|
||||
// Prepare the residuals.
|
||||
vector<double> residuals(21, -100000);
|
||||
std::vector<double> residuals(21, -100000);
|
||||
|
||||
// Prepare the parameters.
|
||||
vector<double*> parameter_blocks(2);
|
||||
std::vector<double*> parameter_blocks(2);
|
||||
parameter_blocks[0] = ¶m_block_0[0];
|
||||
parameter_blocks[1] = ¶m_block_1[0];
|
||||
|
||||
// Prepare the jacobian.
|
||||
vector<vector<double>> jacobian_vect(2);
|
||||
std::vector<std::vector<double>> jacobian_vect(2);
|
||||
jacobian_vect[0].resize(21 * 10, -100000);
|
||||
jacobian_vect[1].resize(21 * 5, -100000);
|
||||
vector<double*> jacobian;
|
||||
std::vector<double*> jacobian;
|
||||
jacobian.push_back(jacobian_vect[0].data());
|
||||
jacobian.push_back(jacobian_vect[1].data());
|
||||
|
||||
@@ -165,11 +163,11 @@ TEST(DynamicNumericdiffCostFunctionTest, TestJacobian) {
|
||||
TEST(DynamicNumericdiffCostFunctionTest,
|
||||
JacobianWithFirstParameterBlockConstant) { // NOLINT
|
||||
// Test the residual counting.
|
||||
vector<double> param_block_0(10, 0.0);
|
||||
std::vector<double> param_block_0(10, 0.0);
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
param_block_0[i] = 2 * i;
|
||||
}
|
||||
vector<double> param_block_1(5, 0.0);
|
||||
std::vector<double> param_block_1(5, 0.0);
|
||||
DynamicNumericDiffCostFunction<MyCostFunctor> cost_function(
|
||||
new MyCostFunctor());
|
||||
cost_function.AddParameterBlock(param_block_0.size());
|
||||
@@ -177,18 +175,18 @@ TEST(DynamicNumericdiffCostFunctionTest,
|
||||
cost_function.SetNumResiduals(21);
|
||||
|
||||
// Prepare the residuals.
|
||||
vector<double> residuals(21, -100000);
|
||||
std::vector<double> residuals(21, -100000);
|
||||
|
||||
// Prepare the parameters.
|
||||
vector<double*> parameter_blocks(2);
|
||||
std::vector<double*> parameter_blocks(2);
|
||||
parameter_blocks[0] = ¶m_block_0[0];
|
||||
parameter_blocks[1] = ¶m_block_1[0];
|
||||
|
||||
// Prepare the jacobian.
|
||||
vector<vector<double>> jacobian_vect(2);
|
||||
std::vector<std::vector<double>> jacobian_vect(2);
|
||||
jacobian_vect[0].resize(21 * 10, -100000);
|
||||
jacobian_vect[1].resize(21 * 5, -100000);
|
||||
vector<double*> jacobian;
|
||||
std::vector<double*> jacobian;
|
||||
jacobian.push_back(nullptr);
|
||||
jacobian.push_back(jacobian_vect[1].data());
|
||||
|
||||
@@ -215,11 +213,11 @@ TEST(DynamicNumericdiffCostFunctionTest,
|
||||
TEST(DynamicNumericdiffCostFunctionTest,
|
||||
JacobianWithSecondParameterBlockConstant) { // NOLINT
|
||||
// Test the residual counting.
|
||||
vector<double> param_block_0(10, 0.0);
|
||||
std::vector<double> param_block_0(10, 0.0);
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
param_block_0[i] = 2 * i;
|
||||
}
|
||||
vector<double> param_block_1(5, 0.0);
|
||||
std::vector<double> param_block_1(5, 0.0);
|
||||
DynamicNumericDiffCostFunction<MyCostFunctor> cost_function(
|
||||
new MyCostFunctor());
|
||||
cost_function.AddParameterBlock(param_block_0.size());
|
||||
@@ -227,18 +225,18 @@ TEST(DynamicNumericdiffCostFunctionTest,
|
||||
cost_function.SetNumResiduals(21);
|
||||
|
||||
// Prepare the residuals.
|
||||
vector<double> residuals(21, -100000);
|
||||
std::vector<double> residuals(21, -100000);
|
||||
|
||||
// Prepare the parameters.
|
||||
vector<double*> parameter_blocks(2);
|
||||
std::vector<double*> parameter_blocks(2);
|
||||
parameter_blocks[0] = ¶m_block_0[0];
|
||||
parameter_blocks[1] = ¶m_block_1[0];
|
||||
|
||||
// Prepare the jacobian.
|
||||
vector<vector<double>> jacobian_vect(2);
|
||||
std::vector<std::vector<double>> jacobian_vect(2);
|
||||
jacobian_vect[0].resize(21 * 10, -100000);
|
||||
jacobian_vect[1].resize(21 * 5, -100000);
|
||||
vector<double*> jacobian;
|
||||
std::vector<double*> jacobian;
|
||||
jacobian.push_back(jacobian_vect[0].data());
|
||||
jacobian.push_back(nullptr);
|
||||
|
||||
@@ -409,25 +407,25 @@ class ThreeParameterCostFunctorTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
protected:
|
||||
vector<double> x_;
|
||||
vector<double> y_;
|
||||
vector<double> z_;
|
||||
std::vector<double> x_;
|
||||
std::vector<double> y_;
|
||||
std::vector<double> z_;
|
||||
|
||||
vector<double*> parameter_blocks_;
|
||||
std::vector<double*> parameter_blocks_;
|
||||
|
||||
std::unique_ptr<CostFunction> cost_function_;
|
||||
|
||||
vector<vector<double>> jacobian_vect_;
|
||||
std::vector<std::vector<double>> jacobian_vect_;
|
||||
|
||||
vector<double> expected_residuals_;
|
||||
std::vector<double> expected_residuals_;
|
||||
|
||||
vector<double> expected_jacobian_x_;
|
||||
vector<double> expected_jacobian_y_;
|
||||
vector<double> expected_jacobian_z_;
|
||||
std::vector<double> expected_jacobian_x_;
|
||||
std::vector<double> expected_jacobian_y_;
|
||||
std::vector<double> expected_jacobian_z_;
|
||||
};
|
||||
|
||||
TEST_F(ThreeParameterCostFunctorTest, TestThreeParameterResiduals) {
|
||||
vector<double> residuals(7, -100000);
|
||||
std::vector<double> residuals(7, -100000);
|
||||
EXPECT_TRUE(cost_function_->Evaluate(
|
||||
parameter_blocks_.data(), residuals.data(), nullptr));
|
||||
for (int i = 0; i < 7; ++i) {
|
||||
@@ -436,9 +434,9 @@ TEST_F(ThreeParameterCostFunctorTest, TestThreeParameterResiduals) {
|
||||
}
|
||||
|
||||
TEST_F(ThreeParameterCostFunctorTest, TestThreeParameterJacobian) {
|
||||
vector<double> residuals(7, -100000);
|
||||
std::vector<double> residuals(7, -100000);
|
||||
|
||||
vector<double*> jacobian;
|
||||
std::vector<double*> jacobian;
|
||||
jacobian.push_back(jacobian_vect_[0].data());
|
||||
jacobian.push_back(jacobian_vect_[1].data());
|
||||
jacobian.push_back(jacobian_vect_[2].data());
|
||||
@@ -465,9 +463,9 @@ TEST_F(ThreeParameterCostFunctorTest, TestThreeParameterJacobian) {
|
||||
|
||||
TEST_F(ThreeParameterCostFunctorTest,
|
||||
ThreeParameterJacobianWithFirstAndLastParameterBlockConstant) {
|
||||
vector<double> residuals(7, -100000);
|
||||
std::vector<double> residuals(7, -100000);
|
||||
|
||||
vector<double*> jacobian;
|
||||
std::vector<double*> jacobian;
|
||||
jacobian.push_back(nullptr);
|
||||
jacobian.push_back(jacobian_vect_[1].data());
|
||||
jacobian.push_back(nullptr);
|
||||
@@ -486,9 +484,9 @@ TEST_F(ThreeParameterCostFunctorTest,
|
||||
|
||||
TEST_F(ThreeParameterCostFunctorTest,
|
||||
ThreeParameterJacobianWithSecondParameterBlockConstant) {
|
||||
vector<double> residuals(7, -100000);
|
||||
std::vector<double> residuals(7, -100000);
|
||||
|
||||
vector<double*> jacobian;
|
||||
std::vector<double*> jacobian;
|
||||
jacobian.push_back(jacobian_vect_[0].data());
|
||||
jacobian.push_back(nullptr);
|
||||
jacobian.push_back(jacobian_vect_[2].data());
|
||||
|
||||
Reference in New Issue
Block a user