fix formatting for (non-generated) internal source files

- Change formatting standard to Cpp11. Main difference is not having
  the space between two closing >> for nested templates. We don't
  choose c++14, because older versions of clang-format (version 9
  and earlier) don't know this value yet, and it doesn't make a
  difference in the formatting.
- Apply clang-format to all (non generated) internal source files.
- Manually fix some code sections (clang-format on/off) and c-strings
- Exclude some embedded external files with very different formatting
  (gtest/gmock)
- Add script to format all source files

Change-Id: Ic6cea41575ad6e37c9e136dbce176b0d505dc44d
This commit is contained in:
Nikolaus Demmel
2020-09-20 21:45:24 +02:00
parent 921368ce31
commit 7b8f675bfd
272 changed files with 3449 additions and 3319 deletions
+4 -4
View File
@@ -32,6 +32,7 @@
#include <memory>
#include <string>
#include "ceres/casts.h"
#include "ceres/internal/eigen.h"
#include "ceres/linear_least_squares_problems.h"
@@ -43,7 +44,7 @@ namespace ceres {
namespace internal {
class BlockSparseMatrixTest : public ::testing::Test {
protected :
protected:
void SetUp() final {
std::unique_ptr<LinearLeastSquaresProblem> problem(
CreateLinearLeastSquaresProblemFromId(2));
@@ -159,13 +160,13 @@ TEST_F(BlockSparseMatrixTest, AppendAndDeleteBlockDiagonalMatrix) {
A_->RightMultiply(x.data(), y_a.data());
B_->RightMultiply(x.data(), y_b.data());
EXPECT_LT((y_a.head(B_->num_rows()) - y_b.head(B_->num_rows())).norm(), 1e-12);
EXPECT_LT((y_a.head(B_->num_rows()) - y_b.head(B_->num_rows())).norm(),
1e-12);
Vector expected_tail = Vector::Zero(A_->num_cols());
expected_tail(i) = diagonal(i);
EXPECT_LT((y_a.tail(A_->num_cols()) - expected_tail).norm(), 1e-12);
}
A_->DeleteRowBlocks(column_blocks.size());
EXPECT_EQ(A_->num_rows(), B_->num_rows());
EXPECT_EQ(A_->num_cols(), B_->num_cols());
@@ -213,6 +214,5 @@ TEST(BlockSparseMatrix, CreateDiagonalMatrix) {
}
}
} // namespace internal
} // namespace ceres