mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
CERES_DONT_HAVE_PROTOCOL_BUFFERS -> CERES_NO_PROTOCOL_BUFFERS.
Change-Id: I6c9f50e4c006faf4e75a8f417455db18357f3187
This commit is contained in:
committed by
ceres-solver code review
parent
8b4cb7aa2c
commit
dd2b17d7dd
+2
-3
@@ -390,10 +390,10 @@ IF (${PROTOBUF})
|
||||
INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIRS})
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/internal)
|
||||
ELSE (${PROTOBUF_FOUND})
|
||||
ADD_DEFINITIONS(-DCERES_DONT_HAVE_PROTOCOL_BUFFERS)
|
||||
ADD_DEFINITIONS(-DCERES_NO_PROTOCOL_BUFFERS)
|
||||
ENDIF (${PROTOBUF_FOUND})
|
||||
ELSE (${PROTOBUF})
|
||||
ADD_DEFINITIONS(-DCERES_DONT_HAVE_PROTOCOL_BUFFERS)
|
||||
ADD_DEFINITIONS(-DCERES_NO_PROTOCOL_BUFFERS)
|
||||
ENDIF (${PROTOBUF})
|
||||
|
||||
|
||||
@@ -528,4 +528,3 @@ ENDIF (MSVC)
|
||||
|
||||
ADD_SUBDIRECTORY(internal/ceres)
|
||||
ADD_SUBDIRECTORY(examples)
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ BlockSparseMatrix::BlockSparseMatrix(
|
||||
CHECK_NOTNULL(values_.get());
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
BlockSparseMatrix::BlockSparseMatrix(const SparseMatrixProto& outer_proto) {
|
||||
CHECK(outer_proto.has_block_matrix());
|
||||
|
||||
@@ -244,7 +244,7 @@ const CompressedRowBlockStructure* BlockSparseMatrix::block_structure()
|
||||
return block_structure_.get();
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
void BlockSparseMatrix::ToProto(SparseMatrixProto* outer_proto) const {
|
||||
outer_proto->Clear();
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class BlockSparseMatrix : public BlockSparseMatrixBase {
|
||||
explicit BlockSparseMatrix(CompressedRowBlockStructure* block_structure);
|
||||
|
||||
// Construct a block sparse matrix from a protocol buffer.
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
explicit BlockSparseMatrix(const SparseMatrixProto& proto);
|
||||
#endif
|
||||
|
||||
@@ -110,7 +110,7 @@ class BlockSparseMatrix : public BlockSparseMatrixBase {
|
||||
virtual void SquaredColumnNorm(double* x) const;
|
||||
virtual void ScaleColumns(const double* scale);
|
||||
virtual void ToDenseMatrix(Matrix* dense_matrix) const;
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
virtual void ToProto(SparseMatrixProto* proto) const;
|
||||
#endif
|
||||
virtual void ToTextFile(FILE* file) const;
|
||||
|
||||
@@ -109,7 +109,7 @@ TEST_F(BlockSparseMatrixTest, ToDenseMatrixTest) {
|
||||
EXPECT_LT((m_a - m_b).norm(), 1e-12);
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
TEST_F(BlockSparseMatrixTest, Serialization) {
|
||||
// Roundtrip through serialization and check for equality.
|
||||
SparseMatrixProto proto;
|
||||
|
||||
@@ -38,7 +38,7 @@ bool CellLessThan(const Cell& lhs, const Cell& rhs) {
|
||||
return (lhs.block_id < rhs.block_id);
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
void ProtoToBlockStructure(const BlockStructureProto &proto,
|
||||
CompressedRowBlockStructure *block_structure) {
|
||||
// Decode the column blocks.
|
||||
|
||||
@@ -135,7 +135,7 @@ CompressedRowSparseMatrix::CompressedRowSparseMatrix(
|
||||
CHECK_EQ(num_nonzeros(), m.num_nonzeros());
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
CompressedRowSparseMatrix::CompressedRowSparseMatrix(
|
||||
const SparseMatrixProto& outer_proto) {
|
||||
CHECK(outer_proto.has_compressed_row_matrix());
|
||||
@@ -248,7 +248,7 @@ void CompressedRowSparseMatrix::ToDenseMatrix(Matrix* dense_matrix) const {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
void CompressedRowSparseMatrix::ToProto(SparseMatrixProto* outer_proto) const {
|
||||
CHECK_NOTNULL(outer_proto);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class CompressedRowSparseMatrix : public SparseMatrix {
|
||||
//
|
||||
// We assume that m does not have any repeated entries.
|
||||
explicit CompressedRowSparseMatrix(const TripletSparseMatrix& m);
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
explicit CompressedRowSparseMatrix(const SparseMatrixProto& proto);
|
||||
#endif
|
||||
|
||||
@@ -90,7 +90,7 @@ class CompressedRowSparseMatrix : public SparseMatrix {
|
||||
virtual void ScaleColumns(const double* scale);
|
||||
|
||||
virtual void ToDenseMatrix(Matrix* dense_matrix) const;
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
virtual void ToProto(SparseMatrixProto* proto) const;
|
||||
#endif
|
||||
virtual void ToTextFile(FILE* file) const;
|
||||
|
||||
@@ -146,7 +146,7 @@ TEST_F(CompressedRowSparseMatrixTest, AppendRows) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
TEST_F(CompressedRowSparseMatrixTest, Serialization) {
|
||||
SparseMatrixProto proto;
|
||||
crsm->ToProto(&proto);
|
||||
|
||||
@@ -67,7 +67,7 @@ DenseSparseMatrix::DenseSparseMatrix(const Matrix& m)
|
||||
has_diagonal_reserved_(false) {
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
DenseSparseMatrix::DenseSparseMatrix(const SparseMatrixProto& outer_proto)
|
||||
: m_(Eigen::MatrixXd::Zero(
|
||||
outer_proto.dense_matrix().num_rows(),
|
||||
@@ -108,7 +108,7 @@ void DenseSparseMatrix::ToDenseMatrix(Matrix* dense_matrix) const {
|
||||
*dense_matrix = m_;
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
void DenseSparseMatrix::ToProto(SparseMatrixProto* outer_proto) const {
|
||||
CHECK(!has_diagonal_appended_) << "Not supported.";
|
||||
outer_proto->Clear();
|
||||
@@ -183,7 +183,7 @@ void DenseSparseMatrix::ToTextFile(FILE* file) const {
|
||||
CHECK_NOTNULL(file);
|
||||
const int active_rows =
|
||||
(has_diagonal_reserved_ && !has_diagonal_appended_)
|
||||
? (m_.rows() - m_.cols())
|
||||
? (m_.rows() - m_.cols())
|
||||
: m_.rows();
|
||||
|
||||
for (int r = 0; r < active_rows; ++r) {
|
||||
|
||||
@@ -52,7 +52,7 @@ class DenseSparseMatrix : public SparseMatrix {
|
||||
// m. This assumes that m does not have any repeated entries.
|
||||
explicit DenseSparseMatrix(const TripletSparseMatrix& m);
|
||||
explicit DenseSparseMatrix(const Matrix& m);
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
explicit DenseSparseMatrix(const SparseMatrixProto& proto);
|
||||
#endif
|
||||
|
||||
@@ -67,7 +67,7 @@ class DenseSparseMatrix : public SparseMatrix {
|
||||
virtual void SquaredColumnNorm(double* x) const;
|
||||
virtual void ScaleColumns(const double* scale);
|
||||
virtual void ToDenseMatrix(Matrix* dense_matrix) const;
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
virtual void ToProto(SparseMatrixProto* proto) const;
|
||||
#endif
|
||||
virtual void ToTextFile(FILE* file) const;
|
||||
|
||||
@@ -155,7 +155,7 @@ TEST_F(DenseSparseMatrixTest, Scale) {
|
||||
CompareMatrices(tsm.get(), dsm.get());
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
TEST_F(DenseSparseMatrixTest, Serialization) {
|
||||
SparseMatrixProto proto;
|
||||
dsm->ToProto(&proto);
|
||||
@@ -182,7 +182,7 @@ TEST_F(DenseSparseMatrixTest, ToDenseMatrix) {
|
||||
}
|
||||
|
||||
// TODO(keir): Make this work without protocol buffers.
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
TEST_F(DenseSparseMatrixTest, AppendDiagonal) {
|
||||
DenseSparseMatrixProto proto;
|
||||
proto.set_num_rows(3);
|
||||
|
||||
@@ -64,7 +64,7 @@ LinearLeastSquaresProblem* CreateLinearLeastSquaresProblemFromId(int id) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
LinearLeastSquaresProblem* CreateLinearLeastSquaresProblemFromFile(
|
||||
const string& filename) {
|
||||
LinearLeastSquaresProblemProto problem_proto;
|
||||
@@ -130,7 +130,7 @@ LinearLeastSquaresProblem* CreateLinearLeastSquaresProblemFromFile(
|
||||
<< "Ceres to be built with Protocol Buffers support.";
|
||||
return NULL;
|
||||
}
|
||||
#endif // CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#endif // CERES_NO_PROTOCOL_BUFFERS
|
||||
|
||||
/*
|
||||
A = [1 2]
|
||||
@@ -600,7 +600,7 @@ bool DumpLinearLeastSquaresProblemToConsole(const string& directory,
|
||||
return true;
|
||||
};
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
bool DumpLinearLeastSquaresProblemToProtocolBuffer(const string& directory,
|
||||
int iteration,
|
||||
const SparseMatrix* A,
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#ifndef CERES_INTERNAL_MATRIX_PROTO_H_
|
||||
#define CERES_INTERNAL_MATRIX_PROTO_H_
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
#include "ceres/matrix.pb.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ TEST_F(SchurEliminatorTest, ScalarProblem) {
|
||||
EliminateSolveAndCompare(VectorRef(D.get(), A->num_cols()), false, 1e-14);
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
TEST_F(SchurEliminatorTest, BlockProblem) {
|
||||
const string input_file = TestFileAbsolutePath("problem-6-1384-000.lsqp");
|
||||
|
||||
@@ -223,7 +223,7 @@ TEST_F(SchurEliminatorTest, BlockProblem) {
|
||||
EliminateSolveAndCompare(VectorRef(D.get(), A->num_cols()), true, 1e-10);
|
||||
EliminateSolveAndCompare(VectorRef(D.get(), A->num_cols()), false, 1e-10);
|
||||
}
|
||||
#endif // CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#endif // CERES_NO_PROTOCOL_BUFFERS
|
||||
|
||||
} // namespace internal
|
||||
} // namespace ceres
|
||||
|
||||
@@ -86,7 +86,7 @@ class SparseMatrix : public LinearOperator {
|
||||
// sparse matrix.
|
||||
virtual void ToDenseMatrix(Matrix* dense_matrix) const = 0;
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
// Dump the sparse matrix to a proto. Destroys the contents of proto.
|
||||
virtual void ToProto(SparseMatrixProto* proto) const = 0;
|
||||
#endif
|
||||
|
||||
@@ -82,7 +82,7 @@ TripletSparseMatrix::TripletSparseMatrix(const TripletSparseMatrix& orig)
|
||||
CopyData(orig);
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
TripletSparseMatrix::TripletSparseMatrix(const SparseMatrixProto& outer_proto) {
|
||||
CHECK(outer_proto.has_triplet_matrix());
|
||||
|
||||
@@ -214,7 +214,7 @@ void TripletSparseMatrix::ToDenseMatrix(Matrix* dense_matrix) const {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
void TripletSparseMatrix::ToProto(SparseMatrixProto *proto) const {
|
||||
proto->Clear();
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class TripletSparseMatrix : public SparseMatrix {
|
||||
TripletSparseMatrix();
|
||||
TripletSparseMatrix(int num_rows, int num_cols, int max_num_nonzeros);
|
||||
explicit TripletSparseMatrix(const TripletSparseMatrix& orig);
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
explicit TripletSparseMatrix(const SparseMatrixProto& proto);
|
||||
#endif
|
||||
|
||||
@@ -65,7 +65,7 @@ class TripletSparseMatrix : public SparseMatrix {
|
||||
virtual void SquaredColumnNorm(double* x) const;
|
||||
virtual void ScaleColumns(const double* scale);
|
||||
virtual void ToDenseMatrix(Matrix* dense_matrix) const;
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
virtual void ToProto(SparseMatrixProto *proto) const;
|
||||
#endif
|
||||
virtual void ToTextFile(FILE* file) const;
|
||||
|
||||
@@ -318,7 +318,7 @@ TEST(TripletSparseMatrix, Resize) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
TEST(TripletSparseMatrix, Serialization) {
|
||||
TripletSparseMatrix m(2, 5, 4);
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ class VisibilityBasedPreconditionerTest : public ::testing::Test {
|
||||
scoped_ptr<BlockRandomAccessDenseMatrix> schur_complement_;
|
||||
};
|
||||
|
||||
#ifndef CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#ifndef CERES_NO_PROTOCOL_BUFFERS
|
||||
TEST_F(VisibilityBasedPreconditionerTest, SchurJacobiStructure) {
|
||||
options_.preconditioner_type = SCHUR_JACOBI;
|
||||
preconditioner_.reset(
|
||||
@@ -352,7 +352,7 @@ TEST_F(VisibilityBasedPreconditionerTest, ClusterTridiagonal) {
|
||||
EXPECT_TRUE(IsSparsityStructureValid());
|
||||
EXPECT_TRUE(PreconditionerValuesMatch());
|
||||
}
|
||||
#endif // CERES_DONT_HAVE_PROTOCOL_BUFFERS
|
||||
#endif // CERES_NO_PROTOCOL_BUFFERS
|
||||
|
||||
} // namespace internal
|
||||
} // namespace ceres
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ LOCAL_C_INCLUDES += $(EIGEN_PATH)
|
||||
|
||||
LOCAL_CPP_EXTENSION := .cc
|
||||
LOCAL_CFLAGS := $(CERES_EXTRA_DEFINES) \
|
||||
-DCERES_DONT_HAVE_PROTOCOL_BUFFERS \
|
||||
-DCERES_NO_PROTOCOL_BUFFERS \
|
||||
-DCERES_NO_SUITESPARSE \
|
||||
-DCERES_NO_GFLAGS \
|
||||
-DCERES_NO_THREADS \
|
||||
|
||||
Reference in New Issue
Block a user