Convert calls to CHECK_NOTNULL to CHECK.

CHECK_NOTNULL is being deprecated and removed from the
glog library.

Change-Id: I4a6d1eec6e82a768c7861c8f776bf1f9c0b50c74
diff --git a/include/ceres/cost_function_to_functor.h b/include/ceres/cost_function_to_functor.h
index e17bc0e..bba67a4 100644
--- a/include/ceres/cost_function_to_functor.h
+++ b/include/ceres/cost_function_to_functor.h
@@ -107,7 +107,7 @@
   // Takes ownership of cost_function.
   explicit CostFunctionToFunctor(CostFunction* cost_function)
       : cost_functor_(cost_function) {
-    CHECK_NOTNULL(cost_function);
+    CHECK(cost_function != nullptr);
     CHECK(kNumResiduals > 0 || kNumResiduals == DYNAMIC);
 
     // This block breaks the 80 column rule to keep it somewhat readable.
diff --git a/include/ceres/dynamic_cost_function_to_functor.h b/include/ceres/dynamic_cost_function_to_functor.h
index d4fce1c..7ae5291 100644
--- a/include/ceres/dynamic_cost_function_to_functor.h
+++ b/include/ceres/dynamic_cost_function_to_functor.h
@@ -105,7 +105,7 @@
   // Takes ownership of cost_function.
   explicit DynamicCostFunctionToFunctor(CostFunction* cost_function)
       : cost_function_(cost_function) {
-    CHECK_NOTNULL(cost_function);
+    CHECK(cost_function != nullptr);
   }
 
   bool operator()(double const* const* parameters, double* residuals) const {
diff --git a/internal/ceres/block_jacobi_preconditioner_test.cc b/internal/ceres/block_jacobi_preconditioner_test.cc
index 80e5fba..4a9a871 100644
--- a/internal/ceres/block_jacobi_preconditioner_test.cc
+++ b/internal/ceres/block_jacobi_preconditioner_test.cc
@@ -48,7 +48,7 @@
     std::unique_ptr<LinearLeastSquaresProblem> problem(
         CreateLinearLeastSquaresProblemFromId(problem_id));
 
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
     A.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
     D.reset(problem->D.release());
 
diff --git a/internal/ceres/block_jacobian_writer.cc b/internal/ceres/block_jacobian_writer.cc
index 5714ada..6998bd6 100644
--- a/internal/ceres/block_jacobian_writer.cc
+++ b/internal/ceres/block_jacobian_writer.cc
@@ -205,7 +205,7 @@
   }
 
   BlockSparseMatrix* jacobian = new BlockSparseMatrix(bs);
-  CHECK_NOTNULL(jacobian);
+  CHECK(jacobian != nullptr);
   return jacobian;
 }
 
diff --git a/internal/ceres/block_random_access_diagonal_matrix.cc b/internal/ceres/block_random_access_diagonal_matrix.cc
index 9866e75..526d173 100644
--- a/internal/ceres/block_random_access_diagonal_matrix.cc
+++ b/internal/ceres/block_random_access_diagonal_matrix.cc
@@ -137,8 +137,8 @@
 
 void BlockRandomAccessDiagonalMatrix::RightMultiply(const double* x,
                                                     double* y) const {
-  CHECK_NOTNULL(x);
-  CHECK_NOTNULL(y);
+  CHECK(x != nullptr);
+  CHECK(y != nullptr);
   const double* values = tsm_->values();
   for (int i = 0; i < blocks_.size(); ++i) {
     const int block_size = blocks_[i];
diff --git a/internal/ceres/block_sparse_matrix.cc b/internal/ceres/block_sparse_matrix.cc
index aabac61..8f50f35 100644
--- a/internal/ceres/block_sparse_matrix.cc
+++ b/internal/ceres/block_sparse_matrix.cc
@@ -53,7 +53,7 @@
       num_cols_(0),
       num_nonzeros_(0),
       block_structure_(block_structure) {
-  CHECK_NOTNULL(block_structure_.get());
+  CHECK(block_structure_ != nullptr);
 
   // Count the number of columns in the matrix.
   for (int i = 0; i < block_structure_->cols.size(); ++i) {
@@ -81,7 +81,7 @@
           << num_nonzeros_ * sizeof(double) << " bytes.";  // NOLINT
   values_.reset(new double[num_nonzeros_]);
   max_num_nonzeros_ = num_nonzeros_;
-  CHECK_NOTNULL(values_.get());
+  CHECK(values_ != nullptr);
 }
 
 void BlockSparseMatrix::SetZero() {
@@ -89,8 +89,8 @@
 }
 
 void BlockSparseMatrix::RightMultiply(const double* x,  double* y) const {
-  CHECK_NOTNULL(x);
-  CHECK_NOTNULL(y);
+  CHECK(x != nullptr);
+  CHECK(y != nullptr);
 
   for (int i = 0; i < block_structure_->rows.size(); ++i) {
     int row_block_pos = block_structure_->rows[i].block.position;
@@ -109,8 +109,8 @@
 }
 
 void BlockSparseMatrix::LeftMultiply(const double* x, double* y) const {
-  CHECK_NOTNULL(x);
-  CHECK_NOTNULL(y);
+  CHECK(x != nullptr);
+  CHECK(y != nullptr);
 
   for (int i = 0; i < block_structure_->rows.size(); ++i) {
     int row_block_pos = block_structure_->rows[i].block.position;
@@ -129,7 +129,7 @@
 }
 
 void BlockSparseMatrix::SquaredColumnNorm(double* x) const {
-  CHECK_NOTNULL(x);
+  CHECK(x != nullptr);
   VectorRef(x, num_cols_).setZero();
   for (int i = 0; i < block_structure_->rows.size(); ++i) {
     int row_block_size = block_structure_->rows[i].block.size;
@@ -146,7 +146,7 @@
 }
 
 void BlockSparseMatrix::ScaleColumns(const double* scale) {
-  CHECK_NOTNULL(scale);
+  CHECK(scale != nullptr);
 
   for (int i = 0; i < block_structure_->rows.size(); ++i) {
     int row_block_size = block_structure_->rows[i].block.size;
@@ -163,7 +163,7 @@
 }
 
 void BlockSparseMatrix::ToDenseMatrix(Matrix* dense_matrix) const {
-  CHECK_NOTNULL(dense_matrix);
+  CHECK(dense_matrix != nullptr);
 
   dense_matrix->resize(num_rows_, num_cols_);
   dense_matrix->setZero();
@@ -186,7 +186,7 @@
 
 void BlockSparseMatrix::ToTripletSparseMatrix(
     TripletSparseMatrix* matrix) const {
-  CHECK_NOTNULL(matrix);
+  CHECK(matrix != nullptr);
 
   matrix->Reserve(num_nonzeros_);
   matrix->Resize(num_rows_, num_cols_);
@@ -221,7 +221,7 @@
 }
 
 void BlockSparseMatrix::ToTextFile(FILE* file) const {
-  CHECK_NOTNULL(file);
+  CHECK(file != nullptr);
   for (int i = 0; i < block_structure_->rows.size(); ++i) {
     const int row_block_pos = block_structure_->rows[i].block.position;
     const int row_block_size = block_structure_->rows[i].block.size;
diff --git a/internal/ceres/block_sparse_matrix_test.cc b/internal/ceres/block_sparse_matrix_test.cc
index 50b6766..26fa9a2 100644
--- a/internal/ceres/block_sparse_matrix_test.cc
+++ b/internal/ceres/block_sparse_matrix_test.cc
@@ -47,11 +47,11 @@
   virtual void SetUp() {
     std::unique_ptr<LinearLeastSquaresProblem> problem(
         CreateLinearLeastSquaresProblemFromId(2));
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
     A_.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
 
     problem.reset(CreateLinearLeastSquaresProblemFromId(1));
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
     B_.reset(down_cast<TripletSparseMatrix*>(problem->A.release()));
 
     CHECK_EQ(A_->num_rows(), B_->num_rows());
diff --git a/internal/ceres/canonical_views_clustering.cc b/internal/ceres/canonical_views_clustering.cc
index 95fc36e..b2fd49f 100644
--- a/internal/ceres/canonical_views_clustering.cc
+++ b/internal/ceres/canonical_views_clustering.cc
@@ -99,8 +99,10 @@
     vector<int>* centers,
     IntMap* membership) {
   options_ = options;
-  CHECK_NOTNULL(centers)->clear();
-  CHECK_NOTNULL(membership)->clear();
+  CHECK(centers != nullptr);
+  CHECK(membership != nullptr);
+  centers->clear();
+  membership->clear();
   graph_ = &graph;
 
   IntSet valid_views;
@@ -203,7 +205,8 @@
 void CanonicalViewsClustering::ComputeClusterMembership(
     const vector<int>& centers,
     IntMap* membership) const {
-  CHECK_NOTNULL(membership)->clear();
+  CHECK(membership != nullptr);
+  membership->clear();
 
   // The i^th cluster has cluster id i.
   IntMap center_to_cluster_id;
diff --git a/internal/ceres/compressed_col_sparse_matrix_utils.cc b/internal/ceres/compressed_col_sparse_matrix_utils.cc
index ebb2a62..3f6672f 100644
--- a/internal/ceres/compressed_col_sparse_matrix_utils.cc
+++ b/internal/ceres/compressed_col_sparse_matrix_utils.cc
@@ -47,8 +47,10 @@
     const vector<int>& col_blocks,
     vector<int>* block_rows,
     vector<int>* block_cols) {
-  CHECK_NOTNULL(block_rows)->clear();
-  CHECK_NOTNULL(block_cols)->clear();
+  CHECK(block_rows != nullptr);
+  CHECK(block_cols != nullptr);
+  block_rows->clear();
+  block_cols->clear();
   const int num_row_blocks = row_blocks.size();
   const int num_col_blocks = col_blocks.size();
 
diff --git a/internal/ceres/compressed_row_sparse_matrix.cc b/internal/ceres/compressed_row_sparse_matrix.cc
index bdb0b7a..e56de16 100644
--- a/internal/ceres/compressed_row_sparse_matrix.cc
+++ b/internal/ceres/compressed_row_sparse_matrix.cc
@@ -246,7 +246,7 @@
 
 CompressedRowSparseMatrix::CompressedRowSparseMatrix(const double* diagonal,
                                                      int num_rows) {
-  CHECK_NOTNULL(diagonal);
+  CHECK(diagonal != nullptr);
 
   num_rows_ = num_rows;
   num_cols_ = num_rows;
@@ -275,8 +275,8 @@
 // block-aware for higher performance.
 void CompressedRowSparseMatrix::RightMultiply(const double* x,
                                               double* y) const {
-  CHECK_NOTNULL(x);
-  CHECK_NOTNULL(y);
+  CHECK(x != nullptr);
+  CHECK(y != nullptr);
 
   if (storage_type_ == UNSYMMETRIC) {
     for (int r = 0; r < num_rows_; ++r) {
@@ -336,8 +336,8 @@
 }
 
 void CompressedRowSparseMatrix::LeftMultiply(const double* x, double* y) const {
-  CHECK_NOTNULL(x);
-  CHECK_NOTNULL(y);
+  CHECK(x != nullptr);
+  CHECK(y != nullptr);
 
   if (storage_type_ == UNSYMMETRIC) {
     for (int r = 0; r < num_rows_; ++r) {
@@ -352,7 +352,7 @@
 }
 
 void CompressedRowSparseMatrix::SquaredColumnNorm(double* x) const {
-  CHECK_NOTNULL(x);
+  CHECK(x != nullptr);
 
   std::fill(x, x + num_cols_, 0.0);
   if (storage_type_ == UNSYMMETRIC) {
@@ -408,7 +408,7 @@
   }
 }
 void CompressedRowSparseMatrix::ScaleColumns(const double* scale) {
-  CHECK_NOTNULL(scale);
+  CHECK(scale != nullptr);
 
   for (int idx = 0; idx < rows_[num_rows_]; ++idx) {
     values_[idx] *= scale[cols_[idx]];
@@ -416,7 +416,7 @@
 }
 
 void CompressedRowSparseMatrix::ToDenseMatrix(Matrix* dense_matrix) const {
-  CHECK_NOTNULL(dense_matrix);
+  CHECK(dense_matrix != nullptr);
   dense_matrix->resize(num_rows_, num_cols_);
   dense_matrix->setZero();
 
@@ -504,7 +504,7 @@
 }
 
 void CompressedRowSparseMatrix::ToTextFile(FILE* file) const {
-  CHECK_NOTNULL(file);
+  CHECK(file != nullptr);
   for (int r = 0; r < num_rows_; ++r) {
     for (int idx = rows_[r]; idx < rows_[r + 1]; ++idx) {
       fprintf(file, "% 10d % 10d %17f\n", r, cols_[idx], values_[idx]);
diff --git a/internal/ceres/compressed_row_sparse_matrix_test.cc b/internal/ceres/compressed_row_sparse_matrix_test.cc
index 4351e3d..cf6e2e4 100644
--- a/internal/ceres/compressed_row_sparse_matrix_test.cc
+++ b/internal/ceres/compressed_row_sparse_matrix_test.cc
@@ -75,7 +75,7 @@
     std::unique_ptr<LinearLeastSquaresProblem> problem(
         CreateLinearLeastSquaresProblemFromId(1));
 
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
 
     tsm.reset(down_cast<TripletSparseMatrix*>(problem->A.release()));
     crsm.reset(CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm));
diff --git a/internal/ceres/conjugate_gradients_solver.cc b/internal/ceres/conjugate_gradients_solver.cc
index 039b4f4..c6f85c1 100644
--- a/internal/ceres/conjugate_gradients_solver.cc
+++ b/internal/ceres/conjugate_gradients_solver.cc
@@ -67,9 +67,9 @@
     const double* b,
     const LinearSolver::PerSolveOptions& per_solve_options,
     double* x) {
-  CHECK_NOTNULL(A);
-  CHECK_NOTNULL(x);
-  CHECK_NOTNULL(b);
+  CHECK(A != nullptr);
+  CHECK(x != nullptr);
+  CHECK(b != nullptr);
   CHECK_EQ(A->num_rows(), A->num_cols());
 
   LinearSolver::Summary summary;
diff --git a/internal/ceres/coordinate_descent_minimizer.cc b/internal/ceres/coordinate_descent_minimizer.cc
index 558faed..c5d56f3 100644
--- a/internal/ceres/coordinate_descent_minimizer.cc
+++ b/internal/ceres/coordinate_descent_minimizer.cc
@@ -60,7 +60,9 @@
 using std::vector;
 
 CoordinateDescentMinimizer::CoordinateDescentMinimizer(ContextImpl* context)
-    : context_(CHECK_NOTNULL(context)) {}
+    : context_(context) {
+  CHECK(context_ != nullptr);
+}
 
 CoordinateDescentMinimizer::~CoordinateDescentMinimizer() {
 }
@@ -222,14 +224,17 @@
 
   Minimizer::Options minimizer_options;
   minimizer_options.evaluator.reset(
-      CHECK_NOTNULL(Evaluator::Create(evaluator_options_, program, &error)));
+      Evaluator::Create(evaluator_options_, program, &error));
+  CHECK(minimizer_options.evaluator != nullptr);
   minimizer_options.jacobian.reset(
-      CHECK_NOTNULL(minimizer_options.evaluator->CreateJacobian()));
+      minimizer_options.evaluator->CreateJacobian());
+  CHECK(minimizer_options.jacobian != nullptr);
 
   TrustRegionStrategy::Options trs_options;
   trs_options.linear_solver = linear_solver;
   minimizer_options.trust_region_strategy.reset(
-      CHECK_NOTNULL(TrustRegionStrategy::Create(trs_options)));
+      TrustRegionStrategy::Create(trs_options));
+  CHECK(minimizer_options.trust_region_strategy != nullptr);
   minimizer_options.is_silent = true;
 
   TrustRegionMinimizer minimizer;
diff --git a/internal/ceres/covariance_impl.cc b/internal/ceres/covariance_impl.cc
index 4804173..d24f5c9 100644
--- a/internal/ceres/covariance_impl.cc
+++ b/internal/ceres/covariance_impl.cc
@@ -651,7 +651,7 @@
                             &permutation,
                             &cc);
   event_logger.AddEvent("Numeric Factorization");
-  CHECK_NOTNULL(R);
+  CHECK(R != nullptr);
 
   if (rank < cholmod_jacobian.ncol) {
     LOG(ERROR) << "Jacobian matrix is rank deficient. "
diff --git a/internal/ceres/dense_sparse_matrix.cc b/internal/ceres/dense_sparse_matrix.cc
index 19db867..72e0836 100644
--- a/internal/ceres/dense_sparse_matrix.cc
+++ b/internal/ceres/dense_sparse_matrix.cc
@@ -166,7 +166,7 @@
 
 
 void DenseSparseMatrix::ToTextFile(FILE* file) const {
-  CHECK_NOTNULL(file);
+  CHECK(file != nullptr);
   const int active_rows =
       (has_diagonal_reserved_ && !has_diagonal_appended_)
       ? (m_.rows() - m_.cols())
diff --git a/internal/ceres/dense_sparse_matrix_test.cc b/internal/ceres/dense_sparse_matrix_test.cc
index 7c7e69a..4d52e81 100644
--- a/internal/ceres/dense_sparse_matrix_test.cc
+++ b/internal/ceres/dense_sparse_matrix_test.cc
@@ -72,7 +72,7 @@
     std::unique_ptr<LinearLeastSquaresProblem> problem(
         CreateLinearLeastSquaresProblemFromId(1));
 
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
 
     tsm.reset(down_cast<TripletSparseMatrix*>(problem->A.release()));
     dsm.reset(new DenseSparseMatrix(*tsm));
diff --git a/internal/ceres/dogleg_strategy.cc b/internal/ceres/dogleg_strategy.cc
index b3c52b9..ecc6b88 100644
--- a/internal/ceres/dogleg_strategy.cc
+++ b/internal/ceres/dogleg_strategy.cc
@@ -66,7 +66,7 @@
       dogleg_step_norm_(0.0),
       reuse_(false),
       dogleg_type_(options.dogleg_type) {
-  CHECK_NOTNULL(linear_solver_);
+  CHECK(linear_solver_ != nullptr);
   CHECK_GT(min_diagonal_, 0.0);
   CHECK_LE(min_diagonal_, max_diagonal_);
   CHECK_GT(max_radius_, 0.0);
@@ -81,9 +81,9 @@
     SparseMatrix* jacobian,
     const double* residuals,
     double* step) {
-  CHECK_NOTNULL(jacobian);
-  CHECK_NOTNULL(residuals);
-  CHECK_NOTNULL(step);
+  CHECK(jacobian != nullptr);
+  CHECK(residuals != nullptr);
+  CHECK(step != nullptr);
 
   const int n = jacobian->num_cols();
   if (reuse_) {
@@ -471,7 +471,7 @@
 // In the failure case, another step should be taken, such as the traditional
 // dogleg step.
 bool DoglegStrategy::FindMinimumOnTrustRegionBoundary(Vector2d* minimum) const {
-  CHECK_NOTNULL(minimum);
+  CHECK(minimum != nullptr);
 
   // Return (0, 0) in all error cases.
   minimum->setZero();
diff --git a/internal/ceres/gradient_checker.cc b/internal/ceres/gradient_checker.cc
index d231c83..f00c76e 100644
--- a/internal/ceres/gradient_checker.cc
+++ b/internal/ceres/gradient_checker.cc
@@ -62,9 +62,9 @@
     Vector* residuals,
     std::vector<Matrix>* jacobians,
     std::vector<Matrix>* local_jacobians) {
-  CHECK_NOTNULL(residuals);
-  CHECK_NOTNULL(jacobians);
-  CHECK_NOTNULL(local_jacobians);
+  CHECK(residuals != nullptr);
+  CHECK(jacobians != nullptr);
+  CHECK(local_jacobians != nullptr);
 
   const vector<int32_t>& block_sizes = function->parameter_block_sizes();
   const int num_parameter_blocks = block_sizes.size();
@@ -123,7 +123,7 @@
       const vector<const LocalParameterization*>* local_parameterizations,
       const NumericDiffOptions& options) :
         function_(function) {
-  CHECK_NOTNULL(function);
+  CHECK(function != nullptr);
   if (local_parameterizations != NULL) {
     local_parameterizations_ = *local_parameterizations;
   } else {
diff --git a/internal/ceres/gradient_checking_cost_function.cc b/internal/ceres/gradient_checking_cost_function.cc
index b402844..a2bfa1c 100644
--- a/internal/ceres/gradient_checking_cost_function.cc
+++ b/internal/ceres/gradient_checking_cost_function.cc
@@ -175,7 +175,7 @@
     double relative_step_size,
     double relative_precision,
     GradientCheckingIterationCallback* callback) {
-  CHECK_NOTNULL(callback);
+  CHECK(callback != nullptr);
   // We create new CostFunctions by wrapping the original CostFunction
   // in a gradient checking CostFunction. So its okay for the
   // ProblemImpl to take ownership of it and destroy it. The
diff --git a/internal/ceres/gradient_checking_cost_function_test.cc b/internal/ceres/gradient_checking_cost_function_test.cc
index 2a0390c..f08bcd0 100644
--- a/internal/ceres/gradient_checking_cost_function_test.cc
+++ b/internal/ceres/gradient_checking_cost_function_test.cc
@@ -326,8 +326,8 @@
 // array and have the same LocalParameterization object.
 void ParameterBlocksAreEquivalent(const ParameterBlock*  left,
                                   const ParameterBlock* right) {
-  CHECK_NOTNULL(left);
-  CHECK_NOTNULL(right);
+  CHECK(left != nullptr);
+  CHECK(right != nullptr);
   EXPECT_EQ(left->user_state(), right->user_state());
   EXPECT_EQ(left->Size(), right->Size());
   EXPECT_EQ(left->Size(), right->Size());
diff --git a/internal/ceres/gradient_problem_solver.cc b/internal/ceres/gradient_problem_solver.cc
index 47d8ade..1639e30 100644
--- a/internal/ceres/gradient_problem_solver.cc
+++ b/internal/ceres/gradient_problem_solver.cc
@@ -109,7 +109,8 @@
 
   double start_time = WallTimeInSeconds();
 
-  *CHECK_NOTNULL(summary) = Summary();
+  CHECK(summary != nullptr);
+  *summary = Summary();
   summary->num_parameters                    = problem.NumParameters();
   summary->num_local_parameters              = problem.NumLocalParameters();
   summary->line_search_direction_type        = options.line_search_direction_type;         //  NOLINT
diff --git a/internal/ceres/graph_algorithms.h b/internal/ceres/graph_algorithms.h
index 8768465..b062931 100644
--- a/internal/ceres/graph_algorithms.h
+++ b/internal/ceres/graph_algorithms.h
@@ -100,7 +100,7 @@
   const std::unordered_set<Vertex>& vertices = graph.vertices();
   const int num_vertices = vertices.size();
 
-  CHECK_NOTNULL(ordering);
+  CHECK(ordering != nullptr);
   ordering->clear();
   ordering->reserve(num_vertices);
 
@@ -165,7 +165,7 @@
 template <typename Vertex>
 int StableIndependentSetOrdering(const Graph<Vertex>& graph,
                                  std::vector<Vertex>* ordering) {
-  CHECK_NOTNULL(ordering);
+  CHECK(ordering != nullptr);
   const std::unordered_set<Vertex>& vertices = graph.vertices();
   const int num_vertices = vertices.size();
   CHECK_EQ(vertices.size(), ordering->size());
diff --git a/internal/ceres/householder_vector.h b/internal/ceres/householder_vector.h
index f54feea..6d85217 100644
--- a/internal/ceres/householder_vector.h
+++ b/internal/ceres/householder_vector.h
@@ -46,8 +46,8 @@
 void ComputeHouseholderVector(const Eigen::Matrix<Scalar, Eigen::Dynamic, 1>& x,
                               Eigen::Matrix<Scalar, Eigen::Dynamic, 1>* v,
                               Scalar* beta) {
-  CHECK_NOTNULL(beta);
-  CHECK_NOTNULL(v);
+  CHECK(beta != nullptr);
+  CHECK(v != nullptr);
   CHECK_GT(x.rows(), 1);
   CHECK_EQ(x.rows(), v->rows());
 
diff --git a/internal/ceres/implicit_schur_complement_test.cc b/internal/ceres/implicit_schur_complement_test.cc
index cbc0aee..3beb386 100644
--- a/internal/ceres/implicit_schur_complement_test.cc
+++ b/internal/ceres/implicit_schur_complement_test.cc
@@ -59,7 +59,7 @@
     std::unique_ptr<LinearLeastSquaresProblem> problem(
         CreateLinearLeastSquaresProblemFromId(2));
 
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
     A_.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
     b_.reset(problem->b.release());
     D_.reset(problem->D.release());
@@ -91,7 +91,7 @@
 
     std::unique_ptr<SchurEliminatorBase> eliminator(
         SchurEliminatorBase::Create(options));
-    CHECK_NOTNULL(eliminator.get());
+    CHECK(eliminator != nullptr);
     const bool kFullRankETE = true;
     eliminator->Init(num_eliminate_blocks_, kFullRankETE, bs);
 
diff --git a/internal/ceres/iterative_schur_complement_solver.cc b/internal/ceres/iterative_schur_complement_solver.cc
index 8ce9075..6076c38 100644
--- a/internal/ceres/iterative_schur_complement_solver.cc
+++ b/internal/ceres/iterative_schur_complement_solver.cc
@@ -67,7 +67,7 @@
     double* x) {
   EventLogger event_logger("IterativeSchurComplementSolver::Solve");
 
-  CHECK_NOTNULL(A->block_structure());
+  CHECK(A->block_structure() != nullptr);
   const int num_eliminate_blocks = options_.elimination_groups[0];
   // Initialize a ImplicitSchurComplement object.
   if (schur_complement_ == NULL) {
diff --git a/internal/ceres/iterative_schur_complement_solver_test.cc b/internal/ceres/iterative_schur_complement_solver_test.cc
index 28c0d99..3bf2d92 100644
--- a/internal/ceres/iterative_schur_complement_solver_test.cc
+++ b/internal/ceres/iterative_schur_complement_solver_test.cc
@@ -63,7 +63,7 @@
     std::unique_ptr<LinearLeastSquaresProblem> problem(
         CreateLinearLeastSquaresProblemFromId(problem_id));
 
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
     A_.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
     b_.reset(problem->b.release());
     D_.reset(problem->D.release());
diff --git a/internal/ceres/levenberg_marquardt_strategy.cc b/internal/ceres/levenberg_marquardt_strategy.cc
index 8565800..e1a0454 100644
--- a/internal/ceres/levenberg_marquardt_strategy.cc
+++ b/internal/ceres/levenberg_marquardt_strategy.cc
@@ -55,7 +55,7 @@
       max_diagonal_(options.max_lm_diagonal),
       decrease_factor_(2.0),
       reuse_diagonal_(false) {
-  CHECK_NOTNULL(linear_solver_);
+  CHECK(linear_solver_ != nullptr);
   CHECK_GT(min_diagonal_, 0.0);
   CHECK_LE(min_diagonal_, max_diagonal_);
   CHECK_GT(max_radius_, 0.0);
@@ -69,9 +69,9 @@
     SparseMatrix* jacobian,
     const double* residuals,
     double* step) {
-  CHECK_NOTNULL(jacobian);
-  CHECK_NOTNULL(residuals);
-  CHECK_NOTNULL(step);
+  CHECK(jacobian != nullptr);
+  CHECK(residuals != nullptr);
+  CHECK(step != nullptr);
 
   const int num_parameters = jacobian->num_cols();
   if (!reuse_diagonal_) {
diff --git a/internal/ceres/levenberg_marquardt_strategy_test.cc b/internal/ceres/levenberg_marquardt_strategy_test.cc
index d5f746e..cfbec71 100644
--- a/internal/ceres/levenberg_marquardt_strategy_test.cc
+++ b/internal/ceres/levenberg_marquardt_strategy_test.cc
@@ -66,7 +66,7 @@
       const double* b,
       const LinearSolver::PerSolveOptions& per_solve_options,
       double* x) {
-    CHECK_NOTNULL(per_solve_options.D);
+    CHECK(per_solve_options.D != nullptr);
     for (int i = 0; i < num_cols_; ++i) {
       EXPECT_NEAR(per_solve_options.D[i], diagonal_[i], kTolerance)
           << i << " " << per_solve_options.D[i] << " " << diagonal_[i];
diff --git a/internal/ceres/line_search.cc b/internal/ceres/line_search.cc
index a087615..352c64f 100644
--- a/internal/ceres/line_search.cc
+++ b/internal/ceres/line_search.cc
@@ -192,7 +192,8 @@
                         double initial_gradient,
                         Summary* summary) const {
   const double start_time = WallTimeInSeconds();
-  *CHECK_NOTNULL(summary) = LineSearch::Summary();
+  CHECK(summary != nullptr);
+  *summary = LineSearch::Summary();
 
   summary->cost_evaluation_time_in_seconds = 0.0;
   summary->gradient_evaluation_time_in_seconds = 0.0;
diff --git a/internal/ceres/line_search_minimizer.cc b/internal/ceres/line_search_minimizer.cc
index 38e6452..ac0a192 100644
--- a/internal/ceres/line_search_minimizer.cc
+++ b/internal/ceres/line_search_minimizer.cc
@@ -90,7 +90,8 @@
   double start_time = WallTimeInSeconds();
   double iteration_start_time =  start_time;
 
-  Evaluator* evaluator = CHECK_NOTNULL(options.evaluator.get());
+  CHECK(options.evaluator != nullptr);
+  Evaluator* evaluator = options.evaluator.get();
   const int num_parameters = evaluator->NumParameters();
   const int num_effective_parameters = evaluator->NumEffectiveParameters();
 
diff --git a/internal/ceres/line_search_preprocessor.cc b/internal/ceres/line_search_preprocessor.cc
index 72c1dd8..17226ad 100644
--- a/internal/ceres/line_search_preprocessor.cc
+++ b/internal/ceres/line_search_preprocessor.cc
@@ -75,7 +75,7 @@
 bool LineSearchPreprocessor::Preprocess(const Solver::Options& options,
                                         ProblemImpl* problem,
                                         PreprocessedProblem* pp) {
-  CHECK_NOTNULL(pp);
+  CHECK(pp != nullptr);
   pp->options = options;
   ChangeNumThreadsIfNeeded(&pp->options);
 
diff --git a/internal/ceres/linear_least_squares_problems.cc b/internal/ceres/linear_least_squares_problems.cc
index fb72d63..7c523d3 100644
--- a/internal/ceres/linear_least_squares_problems.cc
+++ b/internal/ceres/linear_least_squares_problems.cc
@@ -614,7 +614,7 @@
                                             const double* b,
                                             const double* x,
                                             int num_eliminate_blocks) {
-  CHECK_NOTNULL(A);
+  CHECK(A != nullptr);
   Matrix AA;
   A->ToDenseMatrix(&AA);
   LOG(INFO) << "A^T: \n" << AA.transpose();
@@ -637,10 +637,10 @@
 void WriteArrayToFileOrDie(const string& filename,
                            const double* x,
                            const int size) {
-  CHECK_NOTNULL(x);
+  CHECK(x != nullptr);
   VLOG(2) << "Writing array to: " << filename;
   FILE* fptr = fopen(filename.c_str(), "w");
-  CHECK_NOTNULL(fptr);
+  CHECK(fptr != nullptr);
   for (int i = 0; i < size; ++i) {
     fprintf(fptr, "%17f\n", x[i]);
   }
@@ -653,7 +653,7 @@
                                              const double* b,
                                              const double* x,
                                              int num_eliminate_blocks) {
-  CHECK_NOTNULL(A);
+  CHECK(A != nullptr);
   LOG(INFO) << "writing to: " << filename_base << "*";
 
   string matlab_script;
@@ -667,7 +667,7 @@
   {
     string filename = filename_base + "_A.txt";
     FILE* fptr = fopen(filename.c_str(), "w");
-    CHECK_NOTNULL(fptr);
+    CHECK(fptr != nullptr);
     A->ToTextFile(fptr);
     fclose(fptr);
     StringAppendF(&matlab_script,
diff --git a/internal/ceres/linear_solver.h b/internal/ceres/linear_solver.h
index 51897fc..24c245d 100644
--- a/internal/ceres/linear_solver.h
+++ b/internal/ceres/linear_solver.h
@@ -306,9 +306,9 @@
       const LinearSolver::PerSolveOptions& per_solve_options,
       double* x) {
     ScopedExecutionTimer total_time("LinearSolver::Solve", &execution_summary_);
-    CHECK_NOTNULL(A);
-    CHECK_NOTNULL(b);
-    CHECK_NOTNULL(x);
+    CHECK(A != nullptr);
+    CHECK(b != nullptr);
+    CHECK(x != nullptr);
     return SolveImpl(down_cast<MatrixType*>(A), b, per_solve_options, x);
   }
 
diff --git a/internal/ceres/loss_function.cc b/internal/ceres/loss_function.cc
index 50612f5..bf41b9e 100644
--- a/internal/ceres/loss_function.cc
+++ b/internal/ceres/loss_function.cc
@@ -133,10 +133,12 @@
 
 ComposedLoss::ComposedLoss(const LossFunction* f, Ownership ownership_f,
                            const LossFunction* g, Ownership ownership_g)
-    : f_(CHECK_NOTNULL(f)),
-      g_(CHECK_NOTNULL(g)),
+    : f_(f),
+      g_(g),
       ownership_f_(ownership_f),
       ownership_g_(ownership_g) {
+  CHECK(f_ != nullptr);
+  CHECK(g_ != nullptr);
 }
 
 ComposedLoss::~ComposedLoss() {
diff --git a/internal/ceres/parameter_block_ordering.cc b/internal/ceres/parameter_block_ordering.cc
index ffae223..ef521c0 100644
--- a/internal/ceres/parameter_block_ordering.cc
+++ b/internal/ceres/parameter_block_ordering.cc
@@ -51,7 +51,8 @@
 
 int ComputeStableSchurOrdering(const Program& program,
                          vector<ParameterBlock*>* ordering) {
-  CHECK_NOTNULL(ordering)->clear();
+  CHECK(ordering != nullptr);
+  ordering->clear();
   EventLogger event_logger("ComputeStableSchurOrdering");
   std::unique_ptr<Graph< ParameterBlock*> > graph(CreateHessianGraph(program));
   event_logger.AddEvent("CreateHessianGraph");
@@ -82,7 +83,8 @@
 
 int ComputeSchurOrdering(const Program& program,
                          vector<ParameterBlock*>* ordering) {
-  CHECK_NOTNULL(ordering)->clear();
+  CHECK(ordering != nullptr);
+  ordering->clear();
 
   std::unique_ptr<Graph< ParameterBlock*> > graph(CreateHessianGraph(program));
   int independent_set_size = IndependentSetOrdering(*graph, ordering);
@@ -101,7 +103,8 @@
 
 void ComputeRecursiveIndependentSetOrdering(const Program& program,
                                             ParameterBlockOrdering* ordering) {
-  CHECK_NOTNULL(ordering)->Clear();
+  CHECK(ordering != nullptr);
+  ordering->Clear();
   const vector<ParameterBlock*> parameter_blocks = program.parameter_blocks();
   std::unique_ptr<Graph< ParameterBlock*> > graph(CreateHessianGraph(program));
 
@@ -122,7 +125,8 @@
 }
 
 Graph<ParameterBlock*>* CreateHessianGraph(const Program& program) {
-  Graph<ParameterBlock*>* graph = CHECK_NOTNULL(new Graph<ParameterBlock*>);
+  Graph<ParameterBlock*>* graph = new Graph<ParameterBlock*>;
+  CHECK(graph != nullptr);
   const vector<ParameterBlock*>& parameter_blocks = program.parameter_blocks();
   for (int i = 0; i < parameter_blocks.size(); ++i) {
     ParameterBlock* parameter_block = parameter_blocks[i];
@@ -157,7 +161,8 @@
 
 void OrderingToGroupSizes(const ParameterBlockOrdering* ordering,
                           vector<int>* group_sizes) {
-  CHECK_NOTNULL(group_sizes)->clear();
+  CHECK(group_sizes != nullptr);
+  group_sizes->clear();
   if (ordering == NULL) {
     return;
   }
diff --git a/internal/ceres/partitioned_matrix_view_impl.h b/internal/ceres/partitioned_matrix_view_impl.h
index 86fb278..f3f548c 100644
--- a/internal/ceres/partitioned_matrix_view_impl.h
+++ b/internal/ceres/partitioned_matrix_view_impl.h
@@ -50,7 +50,7 @@
     : matrix_(matrix),
       num_col_blocks_e_(num_col_blocks_e) {
   const CompressedRowBlockStructure* bs = matrix_.block_structure();
-  CHECK_NOTNULL(bs);
+  CHECK(bs != nullptr);
 
   num_col_blocks_f_ = bs->cols.size() - num_col_blocks_e_;
 
diff --git a/internal/ceres/partitioned_matrix_view_test.cc b/internal/ceres/partitioned_matrix_view_test.cc
index 7eafff4..40b49ef 100644
--- a/internal/ceres/partitioned_matrix_view_test.cc
+++ b/internal/ceres/partitioned_matrix_view_test.cc
@@ -52,7 +52,7 @@
     srand(5);
     std::unique_ptr<LinearLeastSquaresProblem> problem(
         CreateLinearLeastSquaresProblemFromId(2));
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
     A_.reset(problem->A.release());
 
     num_cols_ = A_->num_cols();
diff --git a/internal/ceres/polynomial.cc b/internal/ceres/polynomial.cc
index 6462bdd..20812f4 100644
--- a/internal/ceres/polynomial.cc
+++ b/internal/ceres/polynomial.cc
@@ -52,7 +52,7 @@
 // In: Numerische Mathematik, Volume 13, Number 4 (1969), 293-304,
 // Springer Berlin / Heidelberg. DOI: 10.1007/BF02165404
 void BalanceCompanionMatrix(Matrix* companion_matrix_ptr) {
-  CHECK_NOTNULL(companion_matrix_ptr);
+  CHECK(companion_matrix_ptr != nullptr);
   Matrix& companion_matrix = *companion_matrix_ptr;
   Matrix companion_matrix_offdiagonal = companion_matrix;
   companion_matrix_offdiagonal.diagonal().setZero();
@@ -104,7 +104,7 @@
 
 void BuildCompanionMatrix(const Vector& polynomial,
                           Matrix* companion_matrix_ptr) {
-  CHECK_NOTNULL(companion_matrix_ptr);
+  CHECK(companion_matrix_ptr != nullptr);
   Matrix& companion_matrix = *companion_matrix_ptr;
 
   const int degree = polynomial.size() - 1;
diff --git a/internal/ceres/preconditioner.cc b/internal/ceres/preconditioner.cc
index 82621da..f98374e 100644
--- a/internal/ceres/preconditioner.cc
+++ b/internal/ceres/preconditioner.cc
@@ -49,7 +49,8 @@
 
 SparseMatrixPreconditionerWrapper::SparseMatrixPreconditionerWrapper(
     const SparseMatrix* matrix)
-    : matrix_(CHECK_NOTNULL(matrix)) {
+    : matrix_(matrix) {
+  CHECK(matrix != nullptr);
 }
 
 SparseMatrixPreconditionerWrapper::~SparseMatrixPreconditionerWrapper() {
diff --git a/internal/ceres/problem_impl.cc b/internal/ceres/problem_impl.cc
index 984e3ca..6fd6f7b 100644
--- a/internal/ceres/problem_impl.cc
+++ b/internal/ceres/problem_impl.cc
@@ -185,7 +185,7 @@
 }
 
 void ProblemImpl::InternalRemoveResidualBlock(ResidualBlock* residual_block) {
-  CHECK_NOTNULL(residual_block);
+  CHECK(residual_block != nullptr);
   // Perform no check on the validity of residual_block, that is handled in
   // the public method: RemoveResidualBlock().
 
@@ -290,7 +290,7 @@
     CostFunction* cost_function,
     LossFunction* loss_function,
     const vector<double*>& parameter_blocks) {
-  CHECK_NOTNULL(cost_function);
+  CHECK(cost_function != nullptr);
   CHECK_EQ(parameter_blocks.size(),
            cost_function->parameter_block_sizes().size());
 
@@ -562,7 +562,7 @@
 }
 
 void ProblemImpl::RemoveResidualBlock(ResidualBlock* residual_block) {
-  CHECK_NOTNULL(residual_block);
+  CHECK(residual_block != nullptr);
 
   // Verify that residual_block identifies a residual in the current problem.
   const string residual_not_found_message =
@@ -958,7 +958,7 @@
 }
 
 void ProblemImpl::GetParameterBlocks(vector<double*>* parameter_blocks) const {
-  CHECK_NOTNULL(parameter_blocks);
+  CHECK(parameter_blocks != nullptr);
   parameter_blocks->resize(0);
   parameter_blocks->reserve(parameter_block_map_.size());
   for (const auto& entry : parameter_block_map_) {
@@ -968,7 +968,7 @@
 
 void ProblemImpl::GetResidualBlocks(
     vector<ResidualBlockId>* residual_blocks) const {
-  CHECK_NOTNULL(residual_blocks);
+  CHECK(residual_blocks != nullptr);
   *residual_blocks = program().residual_blocks();
 }
 
@@ -976,7 +976,8 @@
     const ResidualBlockId residual_block,
     vector<double*>* parameter_blocks) const {
   int num_parameter_blocks = residual_block->NumParameterBlocks();
-  CHECK_NOTNULL(parameter_blocks)->resize(num_parameter_blocks);
+  CHECK(parameter_blocks != nullptr);
+  parameter_blocks->resize(num_parameter_blocks);
   for (int i = 0; i < num_parameter_blocks; ++i) {
     (*parameter_blocks)[i] =
         residual_block->parameter_blocks()[i]->mutable_user_state();
@@ -1007,8 +1008,8 @@
   if (options_.enable_fast_removal) {
     // In this case the residual blocks that depend on the parameter block are
     // stored in the parameter block already, so just copy them out.
-    CHECK_NOTNULL(residual_blocks)->resize(
-        parameter_block->mutable_residual_blocks()->size());
+    CHECK(residual_blocks != nullptr);
+    residual_blocks->resize(parameter_block->mutable_residual_blocks()->size());
     std::copy(parameter_block->mutable_residual_blocks()->begin(),
               parameter_block->mutable_residual_blocks()->end(),
               residual_blocks->begin());
@@ -1016,7 +1017,8 @@
   }
 
   // Find residual blocks that depend on the parameter block.
-  CHECK_NOTNULL(residual_blocks)->clear();
+  CHECK(residual_blocks != nullptr);
+  residual_blocks->clear();
   const int num_residual_blocks = NumResidualBlocks();
   for (int i = 0; i < num_residual_blocks; ++i) {
     ResidualBlock* residual_block =
diff --git a/internal/ceres/problem_test.cc b/internal/ceres/problem_test.cc
index cdc0ef5..937f84e 100644
--- a/internal/ceres/problem_test.cc
+++ b/internal/ceres/problem_test.cc
@@ -128,7 +128,7 @@
   problem.AddParameterBlock(z, 5);
 
   EXPECT_DEATH_IF_SUPPORTED(problem.AddResidualBlock(NULL, NULL, x),
-                            "'cost_function' Must be non NULL");
+                            "cost_function != nullptr");
 }
 
 TEST(Problem, AddResidualWithIncorrectNumberOfParameterBlocksDies) {
@@ -1097,7 +1097,8 @@
 
 // Convert a CRSMatrix to a dense Eigen matrix.
 void CRSToDenseMatrix(const CRSMatrix& input, Matrix* output) {
-  Matrix& m = *CHECK_NOTNULL(output);
+  CHECK(output != nullptr);
+  Matrix& m = *output;
   m.resize(input.num_rows, input.num_cols);
   m.setZero();
   for (int row = 0; row < input.num_rows; ++row) {
diff --git a/internal/ceres/program.cc b/internal/ceres/program.cc
index 994c5aa..f1cd1bb 100644
--- a/internal/ceres/program.cc
+++ b/internal/ceres/program.cc
@@ -181,7 +181,7 @@
 }
 
 bool Program::ParameterBlocksAreFinite(string* message) const {
-  CHECK_NOTNULL(message);
+  CHECK(message != nullptr);
   for (int i = 0; i < parameter_blocks_.size(); ++i) {
     const ParameterBlock* parameter_block = parameter_blocks_[i];
     const double* array = parameter_block->user_state();
@@ -220,7 +220,7 @@
 }
 
 bool Program::IsFeasible(string* message) const {
-  CHECK_NOTNULL(message);
+  CHECK(message != nullptr);
   for (int i = 0; i < parameter_blocks_.size(); ++i) {
     const ParameterBlock* parameter_block = parameter_blocks_[i];
     const double* parameters = parameter_block->user_state();
@@ -273,9 +273,9 @@
     vector<double*>* removed_parameter_blocks,
     double* fixed_cost,
     string* error) const {
-  CHECK_NOTNULL(removed_parameter_blocks);
-  CHECK_NOTNULL(fixed_cost);
-  CHECK_NOTNULL(error);
+  CHECK(removed_parameter_blocks != nullptr);
+  CHECK(fixed_cost != nullptr);
+  CHECK(error != nullptr);
 
   std::unique_ptr<Program> reduced_program(new Program(*this));
   if (!reduced_program->RemoveFixedBlocks(removed_parameter_blocks,
@@ -291,9 +291,9 @@
 bool Program::RemoveFixedBlocks(vector<double*>* removed_parameter_blocks,
                                 double* fixed_cost,
                                 string* error) {
-  CHECK_NOTNULL(removed_parameter_blocks);
-  CHECK_NOTNULL(fixed_cost);
-  CHECK_NOTNULL(error);
+  CHECK(removed_parameter_blocks != nullptr);
+  CHECK(fixed_cost != nullptr);
+  CHECK(error != nullptr);
 
   std::unique_ptr<double[]> residual_block_evaluate_scratch;
   residual_block_evaluate_scratch.reset(
diff --git a/internal/ceres/program_test.cc b/internal/ceres/program_test.cc
index 6778484..52eaa40 100644
--- a/internal/ceres/program_test.cc
+++ b/internal/ceres/program_test.cc
@@ -97,11 +97,8 @@
   double fixed_cost = 0.0;
   string message;
   std::unique_ptr<Program> reduced_program(
-      CHECK_NOTNULL(problem
-                    .program()
-                    .CreateReducedProgram(&removed_parameter_blocks,
-                                          &fixed_cost,
-                                          &message)));
+      problem.program().CreateReducedProgram(
+          &removed_parameter_blocks, &fixed_cost, &message));
 
   EXPECT_EQ(reduced_program->NumParameterBlocks(), 3);
   EXPECT_EQ(reduced_program->NumResidualBlocks(), 3);
@@ -121,11 +118,9 @@
   double fixed_cost = 0.0;
   string message;
   std::unique_ptr<Program> reduced_program(
-      CHECK_NOTNULL(problem
-                    .program()
-                    .CreateReducedProgram(&removed_parameter_blocks,
-                                          &fixed_cost,
-                                          &message)));
+      problem.program().CreateReducedProgram(
+          &removed_parameter_blocks, &fixed_cost, &message));
+
   EXPECT_EQ(reduced_program->NumParameterBlocks(), 0);
   EXPECT_EQ(reduced_program->NumResidualBlocks(), 0);
   EXPECT_EQ(removed_parameter_blocks.size(), 1);
@@ -148,11 +143,8 @@
   double fixed_cost = 0.0;
   string message;
   std::unique_ptr<Program> reduced_program(
-      CHECK_NOTNULL(problem
-                    .program()
-                    .CreateReducedProgram(&removed_parameter_blocks,
-                                          &fixed_cost,
-                                          &message)));
+      problem.program().CreateReducedProgram(
+          &removed_parameter_blocks, &fixed_cost, &message));
   EXPECT_EQ(reduced_program->NumParameterBlocks(), 0);
   EXPECT_EQ(reduced_program->NumResidualBlocks(), 0);
   EXPECT_EQ(removed_parameter_blocks.size(), 3);
@@ -177,11 +169,8 @@
   double fixed_cost = 0.0;
   string message;
   std::unique_ptr<Program> reduced_program(
-      CHECK_NOTNULL(problem
-                    .program()
-                    .CreateReducedProgram(&removed_parameter_blocks,
-                                          &fixed_cost,
-                                          &message)));
+      problem.program().CreateReducedProgram(
+          &removed_parameter_blocks, &fixed_cost, &message));
   EXPECT_EQ(reduced_program->NumParameterBlocks(), 1);
   EXPECT_EQ(reduced_program->NumResidualBlocks(), 1);
 }
@@ -204,11 +193,8 @@
   double fixed_cost = 0.0;
   string message;
   std::unique_ptr<Program> reduced_program(
-      CHECK_NOTNULL(problem
-                    .program()
-                    .CreateReducedProgram(&removed_parameter_blocks,
-                                          &fixed_cost,
-                                          &message)));
+      problem.program().CreateReducedProgram(
+          &removed_parameter_blocks, &fixed_cost, &message));
   EXPECT_EQ(reduced_program->NumParameterBlocks(), 2);
   EXPECT_EQ(reduced_program->NumResidualBlocks(), 2);
 }
@@ -243,11 +229,8 @@
   double fixed_cost = 0.0;
   string message;
   std::unique_ptr<Program> reduced_program(
-      CHECK_NOTNULL(problem
-                    .program()
-                    .CreateReducedProgram(&removed_parameter_blocks,
-                                          &fixed_cost,
-                                          &message)));
+      problem.program().CreateReducedProgram(
+          &removed_parameter_blocks, &fixed_cost, &message));
 
   EXPECT_EQ(reduced_program->NumParameterBlocks(), 2);
   EXPECT_EQ(reduced_program->NumResidualBlocks(), 2);
diff --git a/internal/ceres/residual_block.cc b/internal/ceres/residual_block.cc
index f73d54f..7582e92 100644
--- a/internal/ceres/residual_block.cc
+++ b/internal/ceres/residual_block.cc
@@ -50,16 +50,14 @@
 namespace internal {
 
 ResidualBlock::ResidualBlock(
-    const CostFunction* cost_function,
-    const LossFunction* loss_function,
-    const std::vector<ParameterBlock*>& parameter_blocks,
-    int index)
-    : cost_function_(CHECK_NOTNULL(cost_function)),
+    const CostFunction* cost_function, const LossFunction* loss_function,
+    const std::vector<ParameterBlock*>& parameter_blocks, int index)
+    : cost_function_(cost_function),
       loss_function_(loss_function),
       parameter_blocks_(
-          new ParameterBlock* [
-              cost_function->parameter_block_sizes().size()]),
+          new ParameterBlock*[cost_function->parameter_block_sizes().size()]),
       index_(index) {
+  CHECK(cost_function_ != nullptr);
   std::copy(parameter_blocks.begin(),
             parameter_blocks.end(),
             parameter_blocks_.get());
diff --git a/internal/ceres/residual_block_utils.cc b/internal/ceres/residual_block_utils.cc
index dd2bd73..35e928b 100644
--- a/internal/ceres/residual_block_utils.cc
+++ b/internal/ceres/residual_block_utils.cc
@@ -68,8 +68,8 @@
                           double* cost,
                           double* residuals,
                           double** jacobians) {
-  CHECK_NOTNULL(cost);
-  CHECK_NOTNULL(residuals);
+  CHECK(cost != nullptr);
+  CHECK(residuals != nullptr);
 
   const int num_parameter_blocks = block.NumParameterBlocks();
   const int num_residuals = block.NumResiduals();
diff --git a/internal/ceres/schur_complement_solver.cc b/internal/ceres/schur_complement_solver.cc
index e051b98..cf6e46c 100644
--- a/internal/ceres/schur_complement_solver.cc
+++ b/internal/ceres/schur_complement_solver.cc
@@ -131,7 +131,8 @@
                     &options_.row_block_size,
                     &options_.e_block_size,
                     &options_.f_block_size);
-    eliminator_.reset(CHECK_NOTNULL(SchurEliminatorBase::Create(options_)));
+    eliminator_.reset(SchurEliminatorBase::Create(options_));
+    CHECK(eliminator_ != nullptr);
     const bool kFullRankETE = true;
     eliminator_->Init(
         options_.elimination_groups[0], kFullRankETE, A->block_structure());
@@ -378,16 +379,14 @@
 
     int sc_r, sc_c, sc_row_stride, sc_col_stride;
     CellInfo* sc_cell_info =
-        CHECK_NOTNULL(sc->GetCell(i, i,
-                                  &sc_r, &sc_c,
-                                  &sc_row_stride, &sc_col_stride));
+        sc->GetCell(i, i, &sc_r, &sc_c, &sc_row_stride, &sc_col_stride);
+    CHECK(sc_cell_info != nullptr);
     MatrixRef sc_m(sc_cell_info->values, sc_row_stride, sc_col_stride);
 
     int pre_r, pre_c, pre_row_stride, pre_col_stride;
-    CellInfo* pre_cell_info = CHECK_NOTNULL(
-        preconditioner_->GetCell(i, i,
-                                 &pre_r, &pre_c,
-                                 &pre_row_stride, &pre_col_stride));
+    CellInfo* pre_cell_info = preconditioner_->GetCell(
+        i, i, &pre_r, &pre_c, &pre_row_stride, &pre_col_stride);
+    CHECK(pre_cell_info != nullptr);
     MatrixRef pre_m(pre_cell_info->values, pre_row_stride, pre_col_stride);
 
     pre_m.block(pre_r, pre_c, block_size, block_size) =
diff --git a/internal/ceres/schur_complement_solver_test.cc b/internal/ceres/schur_complement_solver_test.cc
index a86c8ef..23d3674 100644
--- a/internal/ceres/schur_complement_solver_test.cc
+++ b/internal/ceres/schur_complement_solver_test.cc
@@ -54,7 +54,7 @@
     std::unique_ptr<LinearLeastSquaresProblem> problem(
         CreateLinearLeastSquaresProblemFromId(problem_id));
 
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
     A.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
     b.reset(problem->b.release());
     D.reset(problem->D.release());
diff --git a/internal/ceres/schur_eliminator.h b/internal/ceres/schur_eliminator.h
index deae5a5..0baea93 100644
--- a/internal/ceres/schur_eliminator.h
+++ b/internal/ceres/schur_eliminator.h
@@ -225,8 +225,9 @@
  public:
   explicit SchurEliminator(const LinearSolver::Options& options)
       : num_threads_(options.num_threads),
-        context_(CHECK_NOTNULL(options.context)) {
-  }
+        context_(options.context) {
+    CHECK(context_ != nullptr);
+}
 
   // SchurEliminatorBase Interface
   virtual ~SchurEliminator();
diff --git a/internal/ceres/schur_eliminator_test.cc b/internal/ceres/schur_eliminator_test.cc
index 6197bfc..2e8492f 100644
--- a/internal/ceres/schur_eliminator_test.cc
+++ b/internal/ceres/schur_eliminator_test.cc
@@ -56,7 +56,7 @@
   void SetUpFromId(int id) {
     std::unique_ptr<LinearLeastSquaresProblem>
         problem(CreateLinearLeastSquaresProblemFromId(id));
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
     SetupHelper(problem.get());
   }
 
diff --git a/internal/ceres/single_linkage_clustering.cc b/internal/ceres/single_linkage_clustering.cc
index 2d3213a..394492c 100644
--- a/internal/ceres/single_linkage_clustering.cc
+++ b/internal/ceres/single_linkage_clustering.cc
@@ -42,7 +42,8 @@
     const SingleLinkageClusteringOptions& options,
     const WeightedGraph<int>& graph,
     std::unordered_map<int, int>* membership) {
-  CHECK_NOTNULL(membership)->clear();
+  CHECK(membership != nullptr);
+  membership->clear();
 
   // Initially each vertex is in its own cluster.
   const std::unordered_set<int>& vertices = graph.vertices();
diff --git a/internal/ceres/solver.cc b/internal/ceres/solver.cc
index 7ac60ac..f8ad2c9 100644
--- a/internal/ceres/solver.cc
+++ b/internal/ceres/solver.cc
@@ -481,8 +481,8 @@
   using internal::Program;
   using internal::WallTimeInSeconds;
 
-  CHECK_NOTNULL(problem);
-  CHECK_NOTNULL(summary);
+  CHECK(problem != nullptr);
+  CHECK(summary != nullptr);
 
   double start_time = WallTimeInSeconds();
   *summary = Summary();
diff --git a/internal/ceres/sparse_normal_cholesky_solver_test.cc b/internal/ceres/sparse_normal_cholesky_solver_test.cc
index aa9dc62..c4b4a0b 100644
--- a/internal/ceres/sparse_normal_cholesky_solver_test.cc
+++ b/internal/ceres/sparse_normal_cholesky_solver_test.cc
@@ -57,7 +57,7 @@
     std::unique_ptr<LinearLeastSquaresProblem> problem(
         CreateLinearLeastSquaresProblemFromId(2));
 
-    CHECK_NOTNULL(problem.get());
+    CHECK(problem != nullptr);
     A_.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
     b_.reset(problem->b.release());
     D_.reset(problem->D.release());
diff --git a/internal/ceres/subset_preconditioner.cc b/internal/ceres/subset_preconditioner.cc
index de6e9fa..865c5f1 100644
--- a/internal/ceres/subset_preconditioner.cc
+++ b/internal/ceres/subset_preconditioner.cc
@@ -56,8 +56,8 @@
 SubsetPreconditioner::~SubsetPreconditioner() {}
 
 void SubsetPreconditioner::RightMultiply(const double* x, double* y) const {
-  CHECK_NOTNULL(x);
-  CHECK_NOTNULL(y);
+  CHECK(x != nullptr);
+  CHECK(y != nullptr);
   std::string message;
   sparse_cholesky_->Solve(x, y, &message);
 }
diff --git a/internal/ceres/suitesparse.cc b/internal/ceres/suitesparse.cc
index f10f57e..190d175 100644
--- a/internal/ceres/suitesparse.cc
+++ b/internal/ceres/suitesparse.cc
@@ -164,7 +164,8 @@
     return nullptr;
   }
 
-  return CHECK_NOTNULL(factor);
+  CHECK(factor != nullptr);
+  return factor;
 }
 
 cholmod_factor* SuiteSparse::BlockAnalyzeCholesky(cholmod_sparse* A,
@@ -196,7 +197,8 @@
     return nullptr;
   }
 
-  return CHECK_NOTNULL(factor);
+  CHECK(factor != nullptr);
+  return factor;
 }
 
 cholmod_factor* SuiteSparse::AnalyzeCholeskyWithNaturalOrdering(
@@ -215,7 +217,8 @@
     return nullptr;
   }
 
-  return CHECK_NOTNULL(factor);
+  CHECK(factor != nullptr);
+  return factor;
 }
 
 bool SuiteSparse::BlockAMDOrdering(const cholmod_sparse* A,
@@ -262,8 +265,8 @@
 LinearSolverTerminationType SuiteSparse::Cholesky(cholmod_sparse* A,
                                                   cholmod_factor* L,
                                                   string* message) {
-  CHECK_NOTNULL(A);
-  CHECK_NOTNULL(L);
+  CHECK(A != nullptr);
+  CHECK(L != nullptr);
 
   // Save the current print level and silence CHOLMOD, otherwise
   // CHOLMOD is prone to dumping stuff to stderr, which can be
diff --git a/internal/ceres/triplet_sparse_matrix.cc b/internal/ceres/triplet_sparse_matrix.cc
index bbb35d2..15b9674 100644
--- a/internal/ceres/triplet_sparse_matrix.cc
+++ b/internal/ceres/triplet_sparse_matrix.cc
@@ -178,7 +178,7 @@
 }
 
 void TripletSparseMatrix::SquaredColumnNorm(double* x) const {
-  CHECK_NOTNULL(x);
+  CHECK(x != nullptr);
   VectorRef(x, num_cols_).setZero();
   for (int i = 0; i < num_nonzeros_; ++i) {
     x[cols_[i]] += values_[i] * values_[i];
@@ -186,7 +186,7 @@
 }
 
 void TripletSparseMatrix::ScaleColumns(const double* scale) {
-  CHECK_NOTNULL(scale);
+  CHECK(scale != nullptr);
   for (int i = 0; i < num_nonzeros_; ++i) {
     values_[i] = values_[i] * scale[cols_[i]];
   }
@@ -267,7 +267,7 @@
 }
 
 void TripletSparseMatrix::ToTextFile(FILE* file) const {
-  CHECK_NOTNULL(file);
+  CHECK(file != nullptr);
   for (int i = 0; i < num_nonzeros_; ++i) {
     fprintf(file, "% 10d % 10d %17f\n", rows_[i], cols_[i], values_[i]);
   }
diff --git a/internal/ceres/trust_region_minimizer.cc b/internal/ceres/trust_region_minimizer.cc
index cd57abf..e3d70b0 100644
--- a/internal/ceres/trust_region_minimizer.cc
+++ b/internal/ceres/trust_region_minimizer.cc
@@ -136,9 +136,12 @@
   solver_summary_->num_unsuccessful_steps = 0;
   solver_summary_->is_constrained = options.is_constrained;
 
-  evaluator_ = CHECK_NOTNULL(options_.evaluator.get());
-  jacobian_ = CHECK_NOTNULL(options_.jacobian.get());
-  strategy_ = CHECK_NOTNULL(options_.trust_region_strategy.get());
+  CHECK(options_.evaluator != nullptr);
+  CHECK(options_.jacobian != nullptr);
+  CHECK(options_.trust_region_strategy != nullptr);
+  evaluator_ = options_.evaluator.get();
+  jacobian_ = options_.jacobian.get();
+  strategy_ = options_.trust_region_strategy.get();
 
   is_not_silent_ = !options.is_silent;
   inner_iterations_are_enabled_ =
@@ -574,8 +577,8 @@
   line_search_options.function = &line_search_function;
 
   std::string message;
-  std::unique_ptr<LineSearch> line_search(CHECK_NOTNULL(
-      LineSearch::Create(ceres::ARMIJO, line_search_options, &message)));
+  std::unique_ptr<LineSearch> line_search(
+      LineSearch::Create(ceres::ARMIJO, line_search_options, &message));
   LineSearch::Summary line_search_summary;
   line_search_function.Init(x, *delta);
   line_search->Search(1.0, cost, gradient.dot(*delta), &line_search_summary);
diff --git a/internal/ceres/trust_region_preprocessor.cc b/internal/ceres/trust_region_preprocessor.cc
index cca2cf7..aa7f095 100644
--- a/internal/ceres/trust_region_preprocessor.cc
+++ b/internal/ceres/trust_region_preprocessor.cc
@@ -334,7 +334,8 @@
       options.trust_region_strategy_type;
   strategy_options.dogleg_type = options.dogleg_type;
   pp->minimizer_options.trust_region_strategy.reset(
-      CHECK_NOTNULL(TrustRegionStrategy::Create(strategy_options)));
+      TrustRegionStrategy::Create(strategy_options));
+  CHECK(pp->minimizer_options.trust_region_strategy != nullptr);
 }
 
 }  // namespace
@@ -345,7 +346,7 @@
 bool TrustRegionPreprocessor::Preprocess(const Solver::Options& options,
                                          ProblemImpl* problem,
                                          PreprocessedProblem* pp) {
-  CHECK_NOTNULL(pp);
+  CHECK(pp != nullptr);
   pp->options = options;
   ChangeNumThreadsIfNeeded(&pp->options);
 
diff --git a/internal/ceres/visibility.cc b/internal/ceres/visibility.cc
index aa195b9..72a1c33 100644
--- a/internal/ceres/visibility.cc
+++ b/internal/ceres/visibility.cc
@@ -54,7 +54,7 @@
 void ComputeVisibility(const CompressedRowBlockStructure& block_structure,
                        const int num_eliminate_blocks,
                        vector<set<int>>* visibility) {
-  CHECK_NOTNULL(visibility);
+  CHECK(visibility != nullptr);
 
   // Clear the visibility vector and resize it to hold a
   // vector for each camera.
diff --git a/internal/ceres/visibility_based_preconditioner.cc b/internal/ceres/visibility_based_preconditioner.cc
index 5eebb69..41079ab 100644
--- a/internal/ceres/visibility_based_preconditioner.cc
+++ b/internal/ceres/visibility_based_preconditioner.cc
@@ -162,10 +162,12 @@
   // maximum spanning forest of this graph.
   vector<set<int>> cluster_visibility;
   ComputeClusterVisibility(visibility, &cluster_visibility);
-  std::unique_ptr<WeightedGraph<int> > cluster_graph(
-      CHECK_NOTNULL(CreateClusterGraph(cluster_visibility)));
-  std::unique_ptr<WeightedGraph<int> > forest(
-      CHECK_NOTNULL(Degree2MaximumSpanningForest(*cluster_graph)));
+  std::unique_ptr<WeightedGraph<int>> cluster_graph(
+      CreateClusterGraph(cluster_visibility));
+  CHECK(cluster_graph != nullptr);
+  std::unique_ptr<WeightedGraph<int>> forest(
+      Degree2MaximumSpanningForest(*cluster_graph));
+  CHECK(forest != nullptr);
   ForestToClusterPairs(*forest, &cluster_pairs_);
 }
 
@@ -184,8 +186,9 @@
 // memberships for each camera block.
 void VisibilityBasedPreconditioner::ClusterCameras(
     const vector<set<int> >& visibility) {
-  std::unique_ptr<WeightedGraph<int> > schur_complement_graph(
-      CHECK_NOTNULL(CreateSchurComplementGraph(visibility)));
+  std::unique_ptr<WeightedGraph<int>> schur_complement_graph(
+      CreateSchurComplementGraph(visibility));
+  CHECK(schur_complement_graph != nullptr);
 
   std::unordered_map<int, int> membership;
 
@@ -430,9 +433,9 @@
 
 void VisibilityBasedPreconditioner::RightMultiply(const double* x,
                                                   double* y) const {
-  CHECK_NOTNULL(x);
-  CHECK_NOTNULL(y);
-  CHECK_NOTNULL(sparse_cholesky_.get());
+  CHECK(x != nullptr);
+  CHECK(y != nullptr);
+  CHECK(sparse_cholesky_ != nullptr);
   std::string message;
   sparse_cholesky_->Solve(x, y, &message);
 }
@@ -462,7 +465,8 @@
 void VisibilityBasedPreconditioner::ForestToClusterPairs(
     const WeightedGraph<int>& forest,
     std::unordered_set<pair<int, int>, pair_hash >* cluster_pairs) const {
-  CHECK_NOTNULL(cluster_pairs)->clear();
+  CHECK(cluster_pairs != nullptr);
+  cluster_pairs->clear();
   const std::unordered_set<int>& vertices = forest.vertices();
   CHECK_EQ(vertices.size(), num_clusters_);
 
@@ -485,7 +489,8 @@
 void VisibilityBasedPreconditioner::ComputeClusterVisibility(
     const vector<set<int>>& visibility,
     vector<set<int>>* cluster_visibility) const {
-  CHECK_NOTNULL(cluster_visibility)->resize(0);
+  CHECK(cluster_visibility != nullptr);
+  cluster_visibility->resize(0);
   cluster_visibility->resize(num_clusters_);
   for (int i = 0; i < num_blocks_; ++i) {
     const int cluster_id = cluster_membership_[i];
@@ -540,7 +545,8 @@
 void VisibilityBasedPreconditioner::FlattenMembershipMap(
     const std::unordered_map<int, int>& membership_map,
     vector<int>* membership_vector) const {
-  CHECK_NOTNULL(membership_vector)->resize(0);
+  CHECK(membership_vector != nullptr);
+  membership_vector->resize(0);
   membership_vector->resize(num_blocks_, -1);
 
   std::unordered_map<int, int> cluster_id_to_index;