diff --git a/examples/nist.cc b/examples/nist.cc
index 3944586..a3430ca 100644
--- a/examples/nist.cc
+++ b/examples/nist.cc
@@ -553,7 +553,7 @@
           model, ceres::TAKE_OWNERSHIP, num_observations, options);
     } else {
       LOG(ERROR) << "Invalid numeric diff method specified";
-      return 0;
+      return nullptr;
     }
   } else {
     cost_function =
diff --git a/examples/sampled_function/README.md b/examples/sampled_function/README.md
index ef1af43..5fde415 100644
--- a/examples/sampled_function/README.md
+++ b/examples/sampled_function/README.md
@@ -32,7 +32,7 @@
 
 ```c++
 bool Evaluate(double const* const* parameters, double* residuals, double** jacobians) const {
-  if (jacobians == NULL || jacobians[0] == NULL)
+  if (jacobians == nullptr || jacobians[0] == nullptr)
     interpolator_.Evaluate(parameters[0][0], residuals);
   else
     interpolator_.Evaluate(parameters[0][0], residuals, jacobians[0]);
diff --git a/examples/sampled_function/sampled_function.cc b/examples/sampled_function/sampled_function.cc
index e96018d..ee7e5ed 100644
--- a/examples/sampled_function/sampled_function.cc
+++ b/examples/sampled_function/sampled_function.cc
@@ -82,7 +82,7 @@
   double x = 1.0;
   Problem problem;
   CostFunction* cost_function = InterpolatedCostFunctor::Create(interpolator);
-  problem.AddResidualBlock(cost_function, NULL, &x);
+  problem.AddResidualBlock(cost_function, nullptr, &x);
 
   Solver::Options options;
   options.minimizer_progress_to_stdout = true;
diff --git a/internal/ceres/accelerate_sparse.cc b/internal/ceres/accelerate_sparse.cc
index d2b642b..6cb9382 100644
--- a/internal/ceres/accelerate_sparse.cc
+++ b/internal/ceres/accelerate_sparse.cc
@@ -196,17 +196,17 @@
 LinearSolverTerminationType AppleAccelerateCholesky<Scalar>::Factorize(
     CompressedRowSparseMatrix* lhs, std::string* message) {
   CHECK_EQ(lhs->storage_type(), StorageType());
-  if (lhs == NULL) {
-    *message = "Failure: Input lhs is NULL.";
+  if (lhs == nullptr) {
+    *message = "Failure: Input lhs is nullptr.";
     return LINEAR_SOLVER_FATAL_ERROR;
   }
   typename SparseTypesTrait<Scalar>::SparseMatrix as_lhs =
       as_.CreateSparseMatrixTransposeView(lhs);
 
   if (!symbolic_factor_) {
-    symbolic_factor_.reset(
-        new typename SparseTypesTrait<Scalar>::SymbolicFactorization(
-            as_.AnalyzeCholesky(&as_lhs)));
+    symbolic_factor_ = std::make_unique<
+        typename SparseTypesTrait<Scalar>::SymbolicFactorization>(
+        as_.AnalyzeCholesky(&as_lhs));
     if (symbolic_factor_->status != SparseStatusOK) {
       *message = StringPrintf(
           "Apple Accelerate Failure : Symbolic factorisation failed: %s",
@@ -217,9 +217,9 @@
   }
 
   if (!numeric_factor_) {
-    numeric_factor_.reset(
-        new typename SparseTypesTrait<Scalar>::NumericFactorization(
-            as_.Cholesky(&as_lhs, symbolic_factor_.get())));
+    numeric_factor_ = std::make_unique<
+        typename SparseTypesTrait<Scalar>::NumericFactorization>(
+        as_.Cholesky(&as_lhs, symbolic_factor_.get()));
   } else {
     // Recycle memory from previous numeric factorization.
     as_.Cholesky(&as_lhs, numeric_factor_.get());
@@ -265,7 +265,7 @@
 void AppleAccelerateCholesky<Scalar>::FreeSymbolicFactorization() {
   if (symbolic_factor_) {
     SparseCleanup(*symbolic_factor_);
-    symbolic_factor_.reset();
+    symbolic_factor_ = nullptr;
   }
 }
 
@@ -273,7 +273,7 @@
 void AppleAccelerateCholesky<Scalar>::FreeNumericFactorization() {
   if (numeric_factor_) {
     SparseCleanup(*numeric_factor_);
-    numeric_factor_.reset();
+    numeric_factor_ = nullptr;
   }
 }
 
diff --git a/internal/ceres/array_utils.cc b/internal/ceres/array_utils.cc
index 6bffd84..113d41c 100644
--- a/internal/ceres/array_utils.cc
+++ b/internal/ceres/array_utils.cc
@@ -44,7 +44,7 @@
 using std::string;
 
 bool IsArrayValid(const int size, const double* x) {
-  if (x != NULL) {
+  if (x != nullptr) {
     for (int i = 0; i < size; ++i) {
       if (!std::isfinite(x[i]) || (x[i] == kImpossibleValue)) {
         return false;
@@ -55,7 +55,7 @@
 }
 
 int FindInvalidValue(const int size, const double* x) {
-  if (x == NULL) {
+  if (x == nullptr) {
     return size;
   }
 
@@ -69,7 +69,7 @@
 }
 
 void InvalidateArray(const int size, double* x) {
-  if (x != NULL) {
+  if (x != nullptr) {
     for (int i = 0; i < size; ++i) {
       x[i] = kImpossibleValue;
     }
@@ -78,7 +78,7 @@
 
 void AppendArrayToString(const int size, const double* x, string* result) {
   for (int i = 0; i < size; ++i) {
-    if (x == NULL) {
+    if (x == nullptr) {
       StringAppendF(result, "Not Computed  ");
     } else {
       if (x[i] == kImpossibleValue) {
diff --git a/internal/ceres/array_utils.h b/internal/ceres/array_utils.h
index 68feca5..5264ee6 100644
--- a/internal/ceres/array_utils.h
+++ b/internal/ceres/array_utils.h
@@ -64,7 +64,7 @@
 CERES_EXPORT_INTERNAL int FindInvalidValue(const int size, const double* x);
 
 // Utility routine to print an array of doubles to a string. If the
-// array pointer is NULL, it is treated as an array of zeros.
+// array pointer is nullptr, it is treated as an array of zeros.
 CERES_EXPORT_INTERNAL void AppendArrayToString(const int size,
                                                const double* x,
                                                std::string* result);
diff --git a/internal/ceres/array_utils_test.cc b/internal/ceres/array_utils_test.cc
index 6c0ea84..b011520 100644
--- a/internal/ceres/array_utils_test.cc
+++ b/internal/ceres/array_utils_test.cc
@@ -53,7 +53,7 @@
   EXPECT_FALSE(IsArrayValid(3, x));
   x[1] = std::numeric_limits<double>::signaling_NaN();
   EXPECT_FALSE(IsArrayValid(3, x));
-  EXPECT_TRUE(IsArrayValid(1, NULL));
+  EXPECT_TRUE(IsArrayValid(1, nullptr));
   InvalidateArray(3, x);
   EXPECT_FALSE(IsArrayValid(3, x));
 }
@@ -70,7 +70,7 @@
   EXPECT_EQ(FindInvalidValue(3, x), 1);
   x[1] = std::numeric_limits<double>::signaling_NaN();
   EXPECT_EQ(FindInvalidValue(3, x), 1);
-  EXPECT_EQ(FindInvalidValue(1, NULL), 1);
+  EXPECT_EQ(FindInvalidValue(1, nullptr), 1);
   InvalidateArray(3, x);
   EXPECT_EQ(FindInvalidValue(3, x), 0);
 }
diff --git a/internal/ceres/block_evaluate_preparer.cc b/internal/ceres/block_evaluate_preparer.cc
index 7db96d9..56c97b6 100644
--- a/internal/ceres/block_evaluate_preparer.cc
+++ b/internal/ceres/block_evaluate_preparer.cc
@@ -53,7 +53,7 @@
                                     SparseMatrix* jacobian,
                                     double** jacobians) {
   // If the overall jacobian is not available, use the scratch space.
-  if (jacobian == NULL) {
+  if (jacobian == nullptr) {
     scratch_evaluate_preparer_.Prepare(
         residual_block, residual_block_index, jacobian, jacobians);
     return;
@@ -73,7 +73,7 @@
       // parameters. Instead, bump the pointer for active parameters only.
       jacobian_block_offset++;
     } else {
-      jacobians[j] = NULL;
+      jacobians[j] = nullptr;
     }
   }
 }
diff --git a/internal/ceres/block_jacobi_preconditioner.cc b/internal/ceres/block_jacobi_preconditioner.cc
index 7459310..da8fc94 100644
--- a/internal/ceres/block_jacobi_preconditioner.cc
+++ b/internal/ceres/block_jacobi_preconditioner.cc
@@ -47,7 +47,7 @@
     blocks[i] = bs->cols[i].size;
   }
 
-  m_.reset(new BlockRandomAccessDiagonalMatrix(blocks));
+  m_ = std::make_unique<BlockRandomAccessDiagonalMatrix>(blocks);
 }
 
 BlockJacobiPreconditioner::~BlockJacobiPreconditioner() = default;
@@ -74,7 +74,7 @@
     }
   }
 
-  if (D != NULL) {
+  if (D != nullptr) {
     // Add the diagonal.
     int position = 0;
     for (int i = 0; i < bs->cols.size(); ++i) {
diff --git a/internal/ceres/block_jacobi_preconditioner_test.cc b/internal/ceres/block_jacobi_preconditioner_test.cc
index cc582c6..6d124f1 100644
--- a/internal/ceres/block_jacobi_preconditioner_test.cc
+++ b/internal/ceres/block_jacobi_preconditioner_test.cc
@@ -45,12 +45,12 @@
 class BlockJacobiPreconditionerTest : public ::testing::Test {
  protected:
   void SetUpFromProblemId(int problem_id) {
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(problem_id));
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(problem_id);
 
     CHECK(problem != nullptr);
     A.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
-    D.reset(problem->D.release());
+    D = std::move(problem->D);
 
     Matrix dense_a;
     A->ToDenseMatrix(&dense_a);
diff --git a/internal/ceres/block_jacobian_writer.cc b/internal/ceres/block_jacobian_writer.cc
index e589c34..a5020e6 100644
--- a/internal/ceres/block_jacobian_writer.cc
+++ b/internal/ceres/block_jacobian_writer.cc
@@ -30,6 +30,8 @@
 
 #include "ceres/block_jacobian_writer.h"
 
+#include <algorithm>
+
 #include "ceres/block_evaluate_preparer.h"
 #include "ceres/block_sparse_matrix.h"
 #include "ceres/internal/eigen.h"
@@ -148,7 +150,7 @@
   return preparers;
 }
 
-SparseMatrix* BlockJacobianWriter::CreateJacobian() const {
+std::unique_ptr<SparseMatrix> BlockJacobianWriter::CreateJacobian() const {
   CompressedRowBlockStructure* bs = new CompressedRowBlockStructure;
 
   const vector<ParameterBlock*>& parameter_blocks =
@@ -201,12 +203,10 @@
       }
     }
 
-    sort(row->cells.begin(), row->cells.end(), CellLessThan);
+    std::sort(row->cells.begin(), row->cells.end(), CellLessThan);
   }
 
-  BlockSparseMatrix* jacobian = new BlockSparseMatrix(bs);
-  CHECK(jacobian != nullptr);
-  return jacobian;
+  return std::make_unique<BlockSparseMatrix>(bs);
 }
 
 }  // namespace internal
diff --git a/internal/ceres/block_jacobian_writer.h b/internal/ceres/block_jacobian_writer.h
index 8054d7b..b9c918b 100644
--- a/internal/ceres/block_jacobian_writer.h
+++ b/internal/ceres/block_jacobian_writer.h
@@ -61,7 +61,7 @@
   // This makes the final Write() a nop.
   BlockEvaluatePreparer* CreateEvaluatePreparers(int num_threads);
 
-  SparseMatrix* CreateJacobian() const;
+  std::unique_ptr<SparseMatrix> CreateJacobian() const;
 
   void Write(int /* residual_id */,
              int /* residual_offset */,
diff --git a/internal/ceres/block_random_access_dense_matrix.cc b/internal/ceres/block_random_access_dense_matrix.cc
index f2ac0b8..ed172de 100644
--- a/internal/ceres/block_random_access_dense_matrix.cc
+++ b/internal/ceres/block_random_access_dense_matrix.cc
@@ -48,9 +48,9 @@
     num_rows_ += blocks[i];
   }
 
-  values_.reset(new double[num_rows_ * num_rows_]);
+  values_ = std::make_unique<double[]>(num_rows_ * num_rows_);
 
-  cell_infos_.reset(new CellInfo[num_blocks * num_blocks]);
+  cell_infos_ = std::make_unique<CellInfo[]>(num_blocks * num_blocks);
   for (int i = 0; i < num_blocks * num_blocks; ++i) {
     cell_infos_[i].values = values_.get();
   }
diff --git a/internal/ceres/block_random_access_dense_matrix.h b/internal/ceres/block_random_access_dense_matrix.h
index 21007de..aef252e 100644
--- a/internal/ceres/block_random_access_dense_matrix.h
+++ b/internal/ceres/block_random_access_dense_matrix.h
@@ -46,7 +46,7 @@
 // num_rows x num_cols.
 //
 // This class is NOT thread safe. Since all n^2 cells are stored,
-// GetCell never returns NULL for any (row_block_id, col_block_id)
+// GetCell never returns nullptr for any (row_block_id, col_block_id)
 // pair.
 //
 // ReturnCell is a nop.
diff --git a/internal/ceres/block_random_access_dense_matrix_test.cc b/internal/ceres/block_random_access_dense_matrix_test.cc
index 0736d56..c85c388 100644
--- a/internal/ceres/block_random_access_dense_matrix_test.cc
+++ b/internal/ceres/block_random_access_dense_matrix_test.cc
@@ -58,7 +58,7 @@
       int col_stride;
       CellInfo* cell = m.GetCell(i, j, &row, &col, &row_stride, &col_stride);
 
-      EXPECT_TRUE(cell != NULL);
+      EXPECT_TRUE(cell != nullptr);
       EXPECT_EQ(row, row_idx);
       EXPECT_EQ(col, col_idx);
       EXPECT_EQ(row_stride, 3 + 4 + 5);
diff --git a/internal/ceres/block_random_access_diagonal_matrix.cc b/internal/ceres/block_random_access_diagonal_matrix.cc
index 08f6d7f..1b02155 100644
--- a/internal/ceres/block_random_access_diagonal_matrix.cc
+++ b/internal/ceres/block_random_access_diagonal_matrix.cc
@@ -31,6 +31,7 @@
 #include "ceres/block_random_access_diagonal_matrix.h"
 
 #include <algorithm>
+#include <memory>
 #include <set>
 #include <utility>
 #include <vector>
@@ -66,7 +67,8 @@
   VLOG(1) << "Matrix Size [" << num_cols << "," << num_cols << "] "
           << num_nonzeros;
 
-  tsm_.reset(new TripletSparseMatrix(num_cols, num_cols, num_nonzeros));
+  tsm_ =
+      std::make_unique<TripletSparseMatrix>(num_cols, num_cols, num_nonzeros);
   tsm_->set_num_nonzeros(num_nonzeros);
   int* rows = tsm_->mutable_rows();
   int* cols = tsm_->mutable_cols();
@@ -99,7 +101,7 @@
                                                    int* row_stride,
                                                    int* col_stride) {
   if (row_block_id != col_block_id) {
-    return NULL;
+    return nullptr;
   }
   const int stride = blocks_[row_block_id];
 
diff --git a/internal/ceres/block_random_access_diagonal_matrix_test.cc b/internal/ceres/block_random_access_diagonal_matrix_test.cc
index afd95ee..42a309f 100644
--- a/internal/ceres/block_random_access_diagonal_matrix_test.cc
+++ b/internal/ceres/block_random_access_diagonal_matrix_test.cc
@@ -52,7 +52,7 @@
     const int num_rows = 3 + 4 + 5;
     num_nonzeros_ = 3 * 3 + 4 * 4 + 5 * 5;
 
-    m_.reset(new BlockRandomAccessDiagonalMatrix(blocks));
+    m_ = std::make_unique<BlockRandomAccessDiagonalMatrix>(blocks);
 
     EXPECT_EQ(m_->num_rows(), num_rows);
     EXPECT_EQ(m_->num_cols(), num_rows);
@@ -71,11 +71,11 @@
             row_block_id, col_block_id, &row, &col, &row_stride, &col_stride);
         // Off diagonal entries are not present.
         if (i != j) {
-          EXPECT_TRUE(cell == NULL);
+          EXPECT_TRUE(cell == nullptr);
           continue;
         }
 
-        EXPECT_TRUE(cell != NULL);
+        EXPECT_TRUE(cell != nullptr);
         EXPECT_EQ(row, 0);
         EXPECT_EQ(col, 0);
         EXPECT_EQ(row_stride, blocks[row_block_id]);
diff --git a/internal/ceres/block_random_access_matrix.h b/internal/ceres/block_random_access_matrix.h
index f190622..7f01763 100644
--- a/internal/ceres/block_random_access_matrix.h
+++ b/internal/ceres/block_random_access_matrix.h
@@ -62,7 +62,7 @@
 //
 // There is no requirement that all cells be present, i.e. the matrix
 // itself can be block sparse. When a cell is not present, the GetCell
-// method will return a NULL pointer.
+// method will return a nullptr pointer.
 //
 // There is no requirement about how the cells are stored beyond that
 // form a dense submatrix of a larger dense matrix. Like everywhere
@@ -77,7 +77,7 @@
 //                              &row, &col,
 //                              &row_stride, &col_stride);
 //
-//  if (cell != NULL) {
+//  if (cell != nullptr) {
 //     MatrixRef m(cell->values, row_stride, col_stride);
 //     std::lock_guard<std::mutex> l(&cell->m);
 //     m.block(row, col, row_block_size, col_block_size) = ...
@@ -99,7 +99,7 @@
 
   // If the cell (row_block_id, col_block_id) is present, then return
   // a CellInfo with a pointer to the dense matrix containing it,
-  // otherwise return NULL. The dense matrix containing this cell has
+  // otherwise return nullptr. The dense matrix containing this cell has
   // size row_stride, col_stride and the cell is located at position
   // (row, col) within this matrix.
   //
diff --git a/internal/ceres/block_random_access_sparse_matrix.cc b/internal/ceres/block_random_access_sparse_matrix.cc
index c28b7ce..1b2f5e7 100644
--- a/internal/ceres/block_random_access_sparse_matrix.cc
+++ b/internal/ceres/block_random_access_sparse_matrix.cc
@@ -76,7 +76,8 @@
   VLOG(1) << "Matrix Size [" << num_cols << "," << num_cols << "] "
           << num_nonzeros;
 
-  tsm_.reset(new TripletSparseMatrix(num_cols, num_cols, num_nonzeros));
+  tsm_ =
+      std::make_unique<TripletSparseMatrix>(num_cols, num_cols, num_nonzeros);
   tsm_->set_num_nonzeros(num_nonzeros);
   int* rows = tsm_->mutable_rows();
   int* cols = tsm_->mutable_cols();
@@ -129,7 +130,7 @@
   const LayoutType::iterator it =
       layout_.find(IntPairToLong(row_block_id, col_block_id));
   if (it == layout_.end()) {
-    return NULL;
+    return nullptr;
   }
 
   // Each cell is stored contiguously as its own little dense matrix.
diff --git a/internal/ceres/block_random_access_sparse_matrix_test.cc b/internal/ceres/block_random_access_sparse_matrix_test.cc
index 557b678..7224b65 100644
--- a/internal/ceres/block_random_access_sparse_matrix_test.cc
+++ b/internal/ceres/block_random_access_sparse_matrix_test.cc
@@ -80,7 +80,7 @@
     int col_stride;
     CellInfo* cell = m.GetCell(
         row_block_id, col_block_id, &row, &col, &row_stride, &col_stride);
-    EXPECT_TRUE(cell != NULL);
+    EXPECT_TRUE(cell != nullptr);
     EXPECT_EQ(row, 0);
     EXPECT_EQ(col, 0);
     EXPECT_EQ(row_stride, blocks[row_block_id]);
@@ -142,7 +142,7 @@
     blocks.push_back(1);
     set<pair<int, int>> block_pairs;
     block_pairs.insert(make_pair(0, 0));
-    m_.reset(new BlockRandomAccessSparseMatrix(blocks, block_pairs));
+    m_ = std::make_unique<BlockRandomAccessSparseMatrix>(blocks, block_pairs);
   }
 
   void CheckIntPairToLong(int a, int b) {
diff --git a/internal/ceres/block_sparse_matrix.cc b/internal/ceres/block_sparse_matrix.cc
index 4db409d..e06bd2f 100644
--- a/internal/ceres/block_sparse_matrix.cc
+++ b/internal/ceres/block_sparse_matrix.cc
@@ -80,7 +80,7 @@
   CHECK_GE(num_nonzeros_, 0);
   VLOG(2) << "Allocating values array with " << num_nonzeros_ * sizeof(double)
           << " bytes.";  // NOLINT
-  values_.reset(new double[num_nonzeros_]);
+  values_ = std::make_unique<double[]>(num_nonzeros_);
   max_num_nonzeros_ = num_nonzeros_;
   CHECK(values_ != nullptr);
 }
@@ -248,7 +248,7 @@
   }
 }
 
-BlockSparseMatrix* BlockSparseMatrix::CreateDiagonalMatrix(
+std::unique_ptr<BlockSparseMatrix> BlockSparseMatrix::CreateDiagonalMatrix(
     const double* diagonal, const std::vector<Block>& column_blocks) {
   // Create the block structure for the diagonal matrix.
   CompressedRowBlockStructure* bs = new CompressedRowBlockStructure();
@@ -265,7 +265,7 @@
   }
 
   // Create the BlockSparseMatrix with the given block structure.
-  BlockSparseMatrix* matrix = new BlockSparseMatrix(bs);
+  auto matrix = std::make_unique<BlockSparseMatrix>(bs);
   matrix->SetZero();
 
   // Fill the values array of the block sparse matrix.
@@ -308,9 +308,10 @@
   }
 
   if (num_nonzeros_ > max_num_nonzeros_) {
-    double* new_values = new double[num_nonzeros_];
-    std::copy(values_.get(), values_.get() + old_num_nonzeros, new_values);
-    values_.reset(new_values);
+    std::unique_ptr<double[]> new_values =
+        std::make_unique<double[]>(num_nonzeros_);
+    std::copy_n(values_.get(), old_num_nonzeros, new_values.get());
+    values_ = std::move(new_values);
     max_num_nonzeros_ = num_nonzeros_;
   }
 
@@ -337,7 +338,7 @@
   block_structure_->rows.resize(num_row_blocks - delta_row_blocks);
 }
 
-BlockSparseMatrix* BlockSparseMatrix::CreateRandomMatrix(
+std::unique_ptr<BlockSparseMatrix> BlockSparseMatrix::CreateRandomMatrix(
     const BlockSparseMatrix::RandomMatrixOptions& options) {
   CHECK_GT(options.num_row_blocks, 0);
   CHECK_GT(options.min_row_block_size, 0);
@@ -395,7 +396,7 @@
     }
   }
 
-  BlockSparseMatrix* matrix = new BlockSparseMatrix(bs);
+  auto matrix = std::make_unique<BlockSparseMatrix>(bs);
   double* values = matrix->mutable_values();
   for (int i = 0; i < matrix->num_nonzeros(); ++i) {
     values[i] = RandNormal();
diff --git a/internal/ceres/block_sparse_matrix.h b/internal/ceres/block_sparse_matrix.h
index ecf6263..0707546 100644
--- a/internal/ceres/block_sparse_matrix.h
+++ b/internal/ceres/block_sparse_matrix.h
@@ -97,7 +97,7 @@
   // Delete the bottom delta_rows_blocks.
   void DeleteRowBlocks(int delta_row_blocks);
 
-  static BlockSparseMatrix* CreateDiagonalMatrix(
+  static std::unique_ptr<BlockSparseMatrix> CreateDiagonalMatrix(
       const double* diagonal, const std::vector<Block>& column_blocks);
 
   struct RandomMatrixOptions {
@@ -122,9 +122,7 @@
   // Create a random BlockSparseMatrix whose entries are normally
   // distributed and whose structure is determined by
   // RandomMatrixOptions.
-  //
-  // Caller owns the result.
-  static BlockSparseMatrix* CreateRandomMatrix(
+  static std::unique_ptr<BlockSparseMatrix> CreateRandomMatrix(
       const RandomMatrixOptions& options);
 
  private:
diff --git a/internal/ceres/block_sparse_matrix_test.cc b/internal/ceres/block_sparse_matrix_test.cc
index 02d3fb1..747cdef 100644
--- a/internal/ceres/block_sparse_matrix_test.cc
+++ b/internal/ceres/block_sparse_matrix_test.cc
@@ -46,12 +46,12 @@
 class BlockSparseMatrixTest : public ::testing::Test {
  protected:
   void SetUp() final {
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(2));
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(2);
     CHECK(problem != nullptr);
     A_.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
 
-    problem.reset(CreateLinearLeastSquaresProblemFromId(1));
+    problem = CreateLinearLeastSquaresProblemFromId(1);
     CHECK(problem != nullptr);
     B_.reset(down_cast<TripletSparseMatrix*>(problem->A.release()));
 
@@ -110,15 +110,15 @@
 }
 
 TEST_F(BlockSparseMatrixTest, AppendRows) {
-  std::unique_ptr<LinearLeastSquaresProblem> problem(
-      CreateLinearLeastSquaresProblemFromId(2));
+  std::unique_ptr<LinearLeastSquaresProblem> problem =
+      CreateLinearLeastSquaresProblemFromId(2);
   std::unique_ptr<BlockSparseMatrix> m(
       down_cast<BlockSparseMatrix*>(problem->A.release()));
   A_->AppendRows(*m);
   EXPECT_EQ(A_->num_rows(), 2 * m->num_rows());
   EXPECT_EQ(A_->num_cols(), m->num_cols());
 
-  problem.reset(CreateLinearLeastSquaresProblemFromId(1));
+  problem = CreateLinearLeastSquaresProblemFromId(1);
   std::unique_ptr<TripletSparseMatrix> m2(
       down_cast<TripletSparseMatrix*>(problem->A.release()));
   B_->AppendRows(*m2);
diff --git a/internal/ceres/bundle_adjustment_test_util.h b/internal/ceres/bundle_adjustment_test_util.h
index 074931f..8af935d 100644
--- a/internal/ceres/bundle_adjustment_test_util.h
+++ b/internal/ceres/bundle_adjustment_test_util.h
@@ -149,10 +149,11 @@
       // point_index()[i] respectively.
       double* camera = cameras + 9 * camera_index_[i];
       double* point = points + 3 * point_index()[i];
-      problem_.AddResidualBlock(cost_function, NULL, camera, point);
+      problem_.AddResidualBlock(cost_function, nullptr, camera, point);
     }
 
-    options_.linear_solver_ordering.reset(new ParameterBlockOrdering);
+    options_.linear_solver_ordering =
+        std::make_shared<ParameterBlockOrdering>();
 
     // The points come before the cameras.
     for (int i = 0; i < num_points_; ++i) {
diff --git a/internal/ceres/c_api.cc b/internal/ceres/c_api.cc
index a604e56..ddb8a98 100644
--- a/internal/ceres/c_api.cc
+++ b/internal/ceres/c_api.cc
@@ -148,24 +148,25 @@
     double** parameters) {
   Problem* ceres_problem = reinterpret_cast<Problem*>(problem);
 
-  ceres::CostFunction* callback_cost_function =
-      new CallbackCostFunction(cost_function,
-                               cost_function_data,
-                               num_residuals,
-                               num_parameter_blocks,
-                               parameter_block_sizes);
+  auto callback_cost_function =
+      std::make_unique<CallbackCostFunction>(cost_function,
+                                             cost_function_data,
+                                             num_residuals,
+                                             num_parameter_blocks,
+                                             parameter_block_sizes);
 
-  ceres::LossFunction* callback_loss_function = NULL;
-  if (loss_function != NULL) {
-    callback_loss_function =
-        new CallbackLossFunction(loss_function, loss_function_data);
+  std::unique_ptr<ceres::LossFunction> callback_loss_function;
+  if (loss_function != nullptr) {
+    callback_loss_function = std::make_unique<CallbackLossFunction>(
+        loss_function, loss_function_data);
   }
 
   std::vector<double*> parameter_blocks(parameters,
                                         parameters + num_parameter_blocks);
   return reinterpret_cast<ceres_residual_block_id_t*>(
-      ceres_problem->AddResidualBlock(
-          callback_cost_function, callback_loss_function, parameter_blocks));
+      ceres_problem->AddResidualBlock(callback_cost_function.release(),
+                                      callback_loss_function.release(),
+                                      parameter_blocks));
 }
 
 void ceres_solve(ceres_problem_t* c_problem) {
diff --git a/internal/ceres/c_api_test.cc b/internal/ceres/c_api_test.cc
index 043f6ab..2473116 100644
--- a/internal/ceres/c_api_test.cc
+++ b/internal/ceres/c_api_test.cc
@@ -121,13 +121,13 @@
   double c = parameters[1][0];
 
   residuals[0] = y - exp(m * x + c);
-  if (jacobians == NULL) {
+  if (jacobians == nullptr) {
     return 1;
   }
-  if (jacobians[0] != NULL) {
+  if (jacobians[0] != nullptr) {
     jacobians[0][0] = -x * exp(m * x + c);  // dr/dm
   }
-  if (jacobians[1] != NULL) {
+  if (jacobians[1] != nullptr) {
     jacobians[1][0] = -exp(m * x + c);  // dr/dc
   }
   return 1;
@@ -148,8 +148,8 @@
         problem,
         exponential_residual,  // Cost function
         &data[2 * i],          // Points to the (x,y) measurement
-        NULL,                  // Loss function
-        NULL,                  // Loss function user data
+        nullptr,               // Loss function
+        nullptr,               // Loss function user data
         1,                     // Number of residuals
         2,                     // Number of parameter blocks
         parameter_sizes,
diff --git a/internal/ceres/callbacks.cc b/internal/ceres/callbacks.cc
index 70e2409..7a4381c 100644
--- a/internal/ceres/callbacks.cc
+++ b/internal/ceres/callbacks.cc
@@ -30,6 +30,7 @@
 
 #include "ceres/callbacks.h"
 
+#include <algorithm>
 #include <iostream>  // NO LINT
 
 #include "ceres/program.h"
@@ -69,9 +70,7 @@
 CallbackReturnType GradientProblemSolverStateUpdatingCallback::operator()(
     const IterationSummary& summary) {
   if (summary.step_is_successful) {
-    std::copy(internal_parameters_,
-              internal_parameters_ + num_parameters_,
-              user_parameters_);
+    std::copy_n(internal_parameters_, num_parameters_, user_parameters_);
   }
   return SOLVER_CONTINUE;
 }
diff --git a/internal/ceres/canonical_views_clustering.cc b/internal/ceres/canonical_views_clustering.cc
index 740ab8e..51cd4cb 100644
--- a/internal/ceres/canonical_views_clustering.cc
+++ b/internal/ceres/canonical_views_clustering.cc
@@ -85,11 +85,11 @@
     const WeightedGraph<int>& graph,
     vector<int>* centers,
     IntMap* membership) {
-  time_t start_time = time(NULL);
+  time_t start_time = time(nullptr);
   CanonicalViewsClustering cv;
   cv.ComputeClustering(options, graph, centers, membership);
   VLOG(2) << "Canonical views clustering time (secs): "
-          << time(NULL) - start_time;
+          << time(nullptr) - start_time;
 }
 
 // Implementation of CanonicalViewsClustering
@@ -107,7 +107,7 @@
 
   IntSet valid_views;
   FindValidViews(&valid_views);
-  while (valid_views.size() > 0) {
+  while (!valid_views.empty()) {
     // Find the next best canonical view.
     double best_difference = -std::numeric_limits<double>::max();
     int best_view = 0;
diff --git a/internal/ceres/casts.h b/internal/ceres/casts.h
index d137071..21445c8 100644
--- a/internal/ceres/casts.h
+++ b/internal/ceres/casts.h
@@ -32,7 +32,6 @@
 #define CERES_INTERNAL_CASTS_H_
 
 #include <cassert>
-#include <cstddef>  // For NULL.
 
 namespace ceres {
 
@@ -86,6 +85,7 @@
 //    if (dynamic_cast<Subclass2>(foo)) HandleASubclass2Object(foo);
 // You should design the code some other way not to need this.
 
+// TODO(sameeragarwal): Modernize this.
 template <typename To, typename From>  // use like this: down_cast<T*>(foo);
 inline To down_cast(From* f) {         // so we only accept pointers
   // Ensures that To is a sub-type of From *.  This test is here only
@@ -95,11 +95,11 @@
 
   // TODO(csilvers): This should use COMPILE_ASSERT.
   if (false) {
-    implicit_cast<From*, To>(NULL);
+    implicit_cast<From*, To>(nullptr);
   }
 
   // uses RTTI in dbg and fastbuild. asserts are disabled in opt builds.
-  assert(f == NULL || dynamic_cast<To>(f) != NULL);  // NOLINT
+  assert(f == nullptr || dynamic_cast<To>(f) != nullptr);  // NOLINT
   return static_cast<To>(f);
 }
 
diff --git a/internal/ceres/cgnr_linear_operator.h b/internal/ceres/cgnr_linear_operator.h
index a0d9e85..569ecdc 100644
--- a/internal/ceres/cgnr_linear_operator.h
+++ b/internal/ceres/cgnr_linear_operator.h
@@ -94,7 +94,7 @@
     A_.LeftMultiply(z_.get(), y);
 
     // y = y + DtDx
-    if (D_ != NULL) {
+    if (D_ != nullptr) {
       int n = A_.num_cols();
       VectorRef(y, n).array() +=
           ConstVectorRef(D_, n).array().square() * ConstVectorRef(x, n).array();
diff --git a/internal/ceres/cgnr_solver.cc b/internal/ceres/cgnr_solver.cc
index 2f38d30..e89305f 100644
--- a/internal/ceres/cgnr_solver.cc
+++ b/internal/ceres/cgnr_solver.cc
@@ -30,6 +30,8 @@
 
 #include "ceres/cgnr_solver.h"
 
+#include <memory>
+
 #include "ceres/block_jacobi_preconditioner.h"
 #include "ceres/cgnr_linear_operator.h"
 #include "ceres/conjugate_gradients_solver.h"
@@ -70,7 +72,7 @@
 
   if (!preconditioner_) {
     if (options_.preconditioner_type == JACOBI) {
-      preconditioner_.reset(new BlockJacobiPreconditioner(*A));
+      preconditioner_ = std::make_unique<BlockJacobiPreconditioner>(*A);
     } else if (options_.preconditioner_type == SUBSET) {
       Preconditioner::Options preconditioner_options;
       preconditioner_options.type = SUBSET;
@@ -81,8 +83,8 @@
       preconditioner_options.use_postordering = options_.use_postordering;
       preconditioner_options.num_threads = options_.num_threads;
       preconditioner_options.context = options_.context;
-      preconditioner_.reset(
-          new SubsetPreconditioner(preconditioner_options, *A));
+      preconditioner_ =
+          std::make_unique<SubsetPreconditioner>(preconditioner_options, *A);
     }
   }
 
diff --git a/internal/ceres/compressed_row_jacobian_writer.cc b/internal/ceres/compressed_row_jacobian_writer.cc
index c6a3001..2526940 100644
--- a/internal/ceres/compressed_row_jacobian_writer.cc
+++ b/internal/ceres/compressed_row_jacobian_writer.cc
@@ -30,7 +30,9 @@
 
 #include "ceres/compressed_row_jacobian_writer.h"
 
+#include <algorithm>
 #include <iterator>
+#include <string>
 #include <utility>
 #include <vector>
 
@@ -81,10 +83,12 @@
           make_pair(parameter_block->index(), j));
     }
   }
-  sort(evaluated_jacobian_blocks->begin(), evaluated_jacobian_blocks->end());
+  std::sort(evaluated_jacobian_blocks->begin(),
+            evaluated_jacobian_blocks->end());
 }
 
-SparseMatrix* CompressedRowJacobianWriter::CreateJacobian() const {
+std::unique_ptr<SparseMatrix> CompressedRowJacobianWriter::CreateJacobian()
+    const {
   const vector<ResidualBlock*>& residual_blocks = program_->residual_blocks();
 
   int total_num_residuals = program_->NumResiduals();
@@ -108,10 +112,11 @@
   // Allocate more space than needed to store the jacobian so that when the LM
   // algorithm adds the diagonal, no reallocation is necessary. This reduces
   // peak memory usage significantly.
-  CompressedRowSparseMatrix* jacobian = new CompressedRowSparseMatrix(
-      total_num_residuals,
-      total_num_effective_parameters,
-      num_jacobian_nonzeros + total_num_effective_parameters);
+  std::unique_ptr<CompressedRowSparseMatrix> jacobian =
+      std::make_unique<CompressedRowSparseMatrix>(
+          total_num_residuals,
+          total_num_effective_parameters,
+          num_jacobian_nonzeros + total_num_effective_parameters);
 
   // At this stage, the CompressedRowSparseMatrix is an invalid state. But this
   // seems to be the only way to construct it without doing a memory copy.
@@ -183,7 +188,7 @@
   }
   CHECK_EQ(num_jacobian_nonzeros, rows[total_num_residuals]);
 
-  PopulateJacobianRowAndColumnBlockVectors(program_, jacobian);
+  PopulateJacobianRowAndColumnBlockVectors(program_, jacobian.get());
 
   return jacobian;
 }
diff --git a/internal/ceres/compressed_row_jacobian_writer.h b/internal/ceres/compressed_row_jacobian_writer.h
index b1251ca..2765a58 100644
--- a/internal/ceres/compressed_row_jacobian_writer.h
+++ b/internal/ceres/compressed_row_jacobian_writer.h
@@ -93,7 +93,7 @@
     return ScratchEvaluatePreparer::Create(*program_, num_threads);
   }
 
-  SparseMatrix* CreateJacobian() const;
+  std::unique_ptr<SparseMatrix> CreateJacobian() const;
 
   void Write(int residual_id,
              int residual_offset,
diff --git a/internal/ceres/compressed_row_sparse_matrix.cc b/internal/ceres/compressed_row_sparse_matrix.cc
index b9e2715..766e413 100644
--- a/internal/ceres/compressed_row_sparse_matrix.cc
+++ b/internal/ceres/compressed_row_sparse_matrix.cc
@@ -104,7 +104,7 @@
       const int c = cols[idx];
       const int transpose_idx = transpose_rows[c]++;
       transpose_cols[transpose_idx] = r;
-      if (values != NULL && transpose_values != NULL) {
+      if (values != nullptr && transpose_values != nullptr) {
         transpose_values[transpose_idx] = values[idx];
       }
     }
@@ -174,18 +174,20 @@
                  cols_.size() * sizeof(double);  // NOLINT
 }
 
-CompressedRowSparseMatrix* CompressedRowSparseMatrix::FromTripletSparseMatrix(
+std::unique_ptr<CompressedRowSparseMatrix>
+CompressedRowSparseMatrix::FromTripletSparseMatrix(
     const TripletSparseMatrix& input) {
   return CompressedRowSparseMatrix::FromTripletSparseMatrix(input, false);
 }
 
-CompressedRowSparseMatrix*
+std::unique_ptr<CompressedRowSparseMatrix>
 CompressedRowSparseMatrix::FromTripletSparseMatrixTransposed(
     const TripletSparseMatrix& input) {
   return CompressedRowSparseMatrix::FromTripletSparseMatrix(input, true);
 }
 
-CompressedRowSparseMatrix* CompressedRowSparseMatrix::FromTripletSparseMatrix(
+std::unique_ptr<CompressedRowSparseMatrix>
+CompressedRowSparseMatrix::FromTripletSparseMatrix(
     const TripletSparseMatrix& input, bool transpose) {
   int num_rows = input.num_rows();
   int num_cols = input.num_cols();
@@ -214,8 +216,9 @@
               input.num_nonzeros() * sizeof(int) +     // NOLINT
               input.num_nonzeros() * sizeof(double));  // NOLINT
 
-  CompressedRowSparseMatrix* output =
-      new CompressedRowSparseMatrix(num_rows, num_cols, input.num_nonzeros());
+  std::unique_ptr<CompressedRowSparseMatrix> output =
+      std::make_unique<CompressedRowSparseMatrix>(
+          num_rows, num_cols, input.num_nonzeros());
 
   if (num_rows == 0) {
     // No data to copy.
@@ -533,7 +536,8 @@
   values_.resize(num_nonzeros);
 }
 
-CompressedRowSparseMatrix* CompressedRowSparseMatrix::CreateBlockDiagonalMatrix(
+std::unique_ptr<CompressedRowSparseMatrix>
+CompressedRowSparseMatrix::CreateBlockDiagonalMatrix(
     const double* diagonal, const vector<int>& blocks) {
   int num_rows = 0;
   int num_nonzeros = 0;
@@ -542,8 +546,9 @@
     num_nonzeros += blocks[i] * blocks[i];
   }
 
-  CompressedRowSparseMatrix* matrix =
-      new CompressedRowSparseMatrix(num_rows, num_rows, num_nonzeros);
+  std::unique_ptr<CompressedRowSparseMatrix> matrix =
+      std::make_unique<CompressedRowSparseMatrix>(
+          num_rows, num_rows, num_nonzeros);
 
   int* rows = matrix->mutable_rows();
   int* cols = matrix->mutable_cols();
@@ -573,9 +578,11 @@
   return matrix;
 }
 
-CompressedRowSparseMatrix* CompressedRowSparseMatrix::Transpose() const {
-  CompressedRowSparseMatrix* transpose =
-      new CompressedRowSparseMatrix(num_cols_, num_rows_, num_nonzeros());
+std::unique_ptr<CompressedRowSparseMatrix>
+CompressedRowSparseMatrix::Transpose() const {
+  std::unique_ptr<CompressedRowSparseMatrix> transpose =
+      std::make_unique<CompressedRowSparseMatrix>(
+          num_cols_, num_rows_, num_nonzeros());
 
   switch (storage_type_) {
     case UNSYMMETRIC:
@@ -612,7 +619,8 @@
   return transpose;
 }
 
-CompressedRowSparseMatrix* CompressedRowSparseMatrix::CreateRandomMatrix(
+std::unique_ptr<CompressedRowSparseMatrix>
+CompressedRowSparseMatrix::CreateRandomMatrix(
     CompressedRowSparseMatrix::RandomMatrixOptions options) {
   CHECK_GT(options.num_row_blocks, 0);
   CHECK_GT(options.min_row_block_size, 0);
@@ -714,7 +722,7 @@
   const int num_rows = std::accumulate(row_blocks.begin(), row_blocks.end(), 0);
   const int num_cols = std::accumulate(col_blocks.begin(), col_blocks.end(), 0);
   const bool kDoNotTranspose = false;
-  CompressedRowSparseMatrix* matrix =
+  std::unique_ptr<CompressedRowSparseMatrix> matrix =
       CompressedRowSparseMatrix::FromTripletSparseMatrix(
           TripletSparseMatrix(
               num_rows, num_cols, tsm_rows, tsm_cols, tsm_values),
diff --git a/internal/ceres/compressed_row_sparse_matrix.h b/internal/ceres/compressed_row_sparse_matrix.h
index a92fc91..0805ee7 100644
--- a/internal/ceres/compressed_row_sparse_matrix.h
+++ b/internal/ceres/compressed_row_sparse_matrix.h
@@ -63,9 +63,7 @@
   // entries.
   //
   // The storage type of the matrix is set to UNSYMMETRIC.
-  //
-  // Caller owns the result.
-  static CompressedRowSparseMatrix* FromTripletSparseMatrix(
+  static std::unique_ptr<CompressedRowSparseMatrix> FromTripletSparseMatrix(
       const TripletSparseMatrix& input);
 
   // Create a matrix with the same content as the TripletSparseMatrix
@@ -73,10 +71,8 @@
   // entries.
   //
   // The storage type of the matrix is set to UNSYMMETRIC.
-  //
-  // Caller owns the result.
-  static CompressedRowSparseMatrix* FromTripletSparseMatrixTransposed(
-      const TripletSparseMatrix& input);
+  static std::unique_ptr<CompressedRowSparseMatrix>
+  FromTripletSparseMatrixTransposed(const TripletSparseMatrix& input);
 
   // Use this constructor only if you know what you are doing. This
   // creates a "blank" matrix with the appropriate amount of memory
@@ -124,7 +120,7 @@
 
   void ToCRSMatrix(CRSMatrix* matrix) const;
 
-  CompressedRowSparseMatrix* Transpose() const;
+  std::unique_ptr<CompressedRowSparseMatrix> Transpose() const;
 
   // Destructive array resizing method.
   void SetMaxNumNonZeros(int num_nonzeros);
@@ -154,9 +150,7 @@
   // Create a block diagonal CompressedRowSparseMatrix with the given
   // block structure. The individual blocks are assumed to be laid out
   // contiguously in the diagonal array, one block at a time.
-  //
-  // Caller owns the result.
-  static CompressedRowSparseMatrix* CreateBlockDiagonalMatrix(
+  static std::unique_ptr<CompressedRowSparseMatrix> CreateBlockDiagonalMatrix(
       const double* diagonal, const std::vector<int>& blocks);
 
   // Options struct to control the generation of random block sparse
@@ -198,13 +192,11 @@
   // Create a random CompressedRowSparseMatrix whose entries are
   // normally distributed and whose structure is determined by
   // RandomMatrixOptions.
-  //
-  // Caller owns the result.
-  static CompressedRowSparseMatrix* CreateRandomMatrix(
+  static std::unique_ptr<CompressedRowSparseMatrix> CreateRandomMatrix(
       RandomMatrixOptions options);
 
  private:
-  static CompressedRowSparseMatrix* FromTripletSparseMatrix(
+  static std::unique_ptr<CompressedRowSparseMatrix> FromTripletSparseMatrix(
       const TripletSparseMatrix& input, bool transpose);
 
   int num_rows_;
diff --git a/internal/ceres/compressed_row_sparse_matrix_test.cc b/internal/ceres/compressed_row_sparse_matrix_test.cc
index 91f3ba4..3a2768c 100644
--- a/internal/ceres/compressed_row_sparse_matrix_test.cc
+++ b/internal/ceres/compressed_row_sparse_matrix_test.cc
@@ -30,8 +30,10 @@
 
 #include "ceres/compressed_row_sparse_matrix.h"
 
+#include <algorithm>
 #include <memory>
 #include <numeric>
+#include <string>
 
 #include "Eigen/SparseCore"
 #include "ceres/casts.h"
@@ -72,13 +74,13 @@
 class CompressedRowSparseMatrixTest : public ::testing::Test {
  protected:
   void SetUp() final {
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(1));
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(1);
 
     CHECK(problem != nullptr);
 
     tsm.reset(down_cast<TripletSparseMatrix*>(problem->A.release()));
-    crsm.reset(CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm));
+    crsm = CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm);
 
     num_rows = tsm->num_rows();
     num_cols = tsm->num_cols();
@@ -132,8 +134,8 @@
     tsm_appendage.Resize(i, num_cols);
 
     tsm->AppendRows(tsm_appendage);
-    std::unique_ptr<CompressedRowSparseMatrix> crsm_appendage(
-        CompressedRowSparseMatrix::FromTripletSparseMatrix(tsm_appendage));
+    std::unique_ptr<CompressedRowSparseMatrix> crsm_appendage =
+        CompressedRowSparseMatrix::FromTripletSparseMatrix(tsm_appendage);
 
     crsm->AppendRows(*crsm_appendage);
     CompareMatrices(tsm.get(), crsm.get());
@@ -143,7 +145,8 @@
 TEST_F(CompressedRowSparseMatrixTest, AppendAndDeleteBlockDiagonalMatrix) {
   int num_diagonal_rows = crsm->num_cols();
 
-  std::unique_ptr<double[]> diagonal(new double[num_diagonal_rows]);
+  std::unique_ptr<double[]> diagonal =
+      std::make_unique<double[]>(num_diagonal_rows);
   for (int i = 0; i < num_diagonal_rows; ++i) {
     diagonal[i] = i;
   }
@@ -156,9 +159,9 @@
   const vector<int> pre_row_blocks = crsm->row_blocks();
   const vector<int> pre_col_blocks = crsm->col_blocks();
 
-  std::unique_ptr<CompressedRowSparseMatrix> appendage(
+  std::unique_ptr<CompressedRowSparseMatrix> appendage =
       CompressedRowSparseMatrix::CreateBlockDiagonalMatrix(
-          diagonal.get(), row_and_column_blocks));
+          diagonal.get(), row_and_column_blocks);
 
   crsm->AppendRows(*appendage);
 
@@ -220,9 +223,9 @@
     diagonal(i) = i + 1;
   }
 
-  std::unique_ptr<CompressedRowSparseMatrix> matrix(
+  std::unique_ptr<CompressedRowSparseMatrix> matrix =
       CompressedRowSparseMatrix::CreateBlockDiagonalMatrix(diagonal.data(),
-                                                           blocks));
+                                                           blocks);
 
   EXPECT_EQ(matrix->num_rows(), 5);
   EXPECT_EQ(matrix->num_cols(), 5);
@@ -305,7 +308,7 @@
 
   std::copy(values, values + 17, cols);
 
-  std::unique_ptr<CompressedRowSparseMatrix> transpose(matrix.Transpose());
+  std::unique_ptr<CompressedRowSparseMatrix> transpose = matrix.Transpose();
 
   ASSERT_EQ(transpose->row_blocks().size(), matrix.col_blocks().size());
   for (int i = 0; i < transpose->row_blocks().size(); ++i) {
@@ -333,10 +336,10 @@
 
   const int kNumTrials = 10;
   for (int i = 0; i < kNumTrials; ++i) {
-    std::unique_ptr<TripletSparseMatrix> tsm(
-        TripletSparseMatrix::CreateRandomMatrix(options));
-    std::unique_ptr<CompressedRowSparseMatrix> crsm(
-        CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm));
+    std::unique_ptr<TripletSparseMatrix> tsm =
+        TripletSparseMatrix::CreateRandomMatrix(options);
+    std::unique_ptr<CompressedRowSparseMatrix> crsm =
+        CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm);
 
     Matrix expected;
     tsm->ToDenseMatrix(&expected);
@@ -359,10 +362,10 @@
 
   const int kNumTrials = 10;
   for (int i = 0; i < kNumTrials; ++i) {
-    std::unique_ptr<TripletSparseMatrix> tsm(
-        TripletSparseMatrix::CreateRandomMatrix(options));
-    std::unique_ptr<CompressedRowSparseMatrix> crsm(
-        CompressedRowSparseMatrix::FromTripletSparseMatrixTransposed(*tsm));
+    std::unique_ptr<TripletSparseMatrix> tsm =
+        TripletSparseMatrix::CreateRandomMatrix(options);
+    std::unique_ptr<CompressedRowSparseMatrix> crsm =
+        CompressedRowSparseMatrix::FromTripletSparseMatrixTransposed(*tsm);
 
     Matrix tmp;
     tsm->ToDenseMatrix(&tmp);
@@ -416,8 +419,8 @@
       options.max_row_block_size = kMaxBlockSize;
       options.block_density = std::max(0.5, RandDouble());
       options.storage_type = ::testing::get<0>(param);
-      std::unique_ptr<CompressedRowSparseMatrix> matrix(
-          CompressedRowSparseMatrix::CreateRandomMatrix(options));
+      std::unique_ptr<CompressedRowSparseMatrix> matrix =
+          CompressedRowSparseMatrix::CreateRandomMatrix(options);
       const int num_rows = matrix->num_rows();
       const int num_cols = matrix->num_cols();
 
@@ -485,8 +488,8 @@
       options.max_row_block_size = kMaxBlockSize;
       options.block_density = std::max(0.5, RandDouble());
       options.storage_type = ::testing::get<0>(param);
-      std::unique_ptr<CompressedRowSparseMatrix> matrix(
-          CompressedRowSparseMatrix::CreateRandomMatrix(options));
+      std::unique_ptr<CompressedRowSparseMatrix> matrix =
+          CompressedRowSparseMatrix::CreateRandomMatrix(options);
       const int num_rows = matrix->num_rows();
       const int num_cols = matrix->num_cols();
 
@@ -554,8 +557,8 @@
       options.max_row_block_size = kMaxBlockSize;
       options.block_density = std::max(0.5, RandDouble());
       options.storage_type = ::testing::get<0>(param);
-      std::unique_ptr<CompressedRowSparseMatrix> matrix(
-          CompressedRowSparseMatrix::CreateRandomMatrix(options));
+      std::unique_ptr<CompressedRowSparseMatrix> matrix =
+          CompressedRowSparseMatrix::CreateRandomMatrix(options);
       const int num_cols = matrix->num_cols();
 
       Vector actual(num_cols);
diff --git a/internal/ceres/conditioned_cost_function.cc b/internal/ceres/conditioned_cost_function.cc
index fb4c52a..a9013a2 100644
--- a/internal/ceres/conditioned_cost_function.cc
+++ b/internal/ceres/conditioned_cost_function.cc
@@ -98,7 +98,7 @@
       double** conditioner_derivative_pointer2 =
           &conditioner_derivative_pointer;
       if (!jacobians) {
-        conditioner_derivative_pointer2 = NULL;
+        conditioner_derivative_pointer2 = nullptr;
       }
 
       double unconditioned_residual = residuals[r];
diff --git a/internal/ceres/conjugate_gradients_solver.cc b/internal/ceres/conjugate_gradients_solver.cc
index 3019628..436a5b1 100644
--- a/internal/ceres/conjugate_gradients_solver.cc
+++ b/internal/ceres/conjugate_gradients_solver.cc
@@ -112,7 +112,7 @@
 
   for (summary.num_iterations = 1;; ++summary.num_iterations) {
     // Apply preconditioner
-    if (per_solve_options.preconditioner != NULL) {
+    if (per_solve_options.preconditioner != nullptr) {
       z.setZero();
       per_solve_options.preconditioner->RightMultiply(r.data(), z.data());
     } else {
diff --git a/internal/ceres/coordinate_descent_minimizer.cc b/internal/ceres/coordinate_descent_minimizer.cc
index 3c566c7..86ab838 100644
--- a/internal/ceres/coordinate_descent_minimizer.cc
+++ b/internal/ceres/coordinate_descent_minimizer.cc
@@ -135,8 +135,10 @@
     parameter_block->SetConstant();
   }
 
-  std::unique_ptr<LinearSolver*[]> linear_solvers(
-      new LinearSolver*[options.num_threads]);
+  std::vector<std::unique_ptr<LinearSolver>> linear_solvers(
+      options.num_threads);
+  // std::unique_ptr<LinearSolver*[]> linear_solvers(
+  //    new LinearSolver*[options.num_threads]);
 
   LinearSolver::Options linear_solver_options;
   linear_solver_options.type = DENSE_QR;
@@ -188,7 +190,7 @@
           // we are fine.
           Solver::Summary inner_summary;
           Solve(&inner_program,
-                linear_solvers[thread_id],
+                linear_solvers[thread_id].get(),
                 parameters + parameter_block->state_offset(),
                 &inner_summary);
 
@@ -204,9 +206,9 @@
     parameter_blocks_[i]->SetVarying();
   }
 
-  for (int i = 0; i < options.num_threads; ++i) {
-    delete linear_solvers[i];
-  }
+  //  for (int i = 0; i < options.num_threads; ++i) {
+  //  delete linear_solvers[i];
+  //}
 }
 
 // Solve the optimization problem for one parameter block.
@@ -221,17 +223,16 @@
   string error;
 
   Minimizer::Options minimizer_options;
-  minimizer_options.evaluator.reset(
-      Evaluator::Create(evaluator_options_, program, &error));
+  minimizer_options.evaluator =
+      Evaluator::Create(evaluator_options_, program, &error);
   CHECK(minimizer_options.evaluator != nullptr);
-  minimizer_options.jacobian.reset(
-      minimizer_options.evaluator->CreateJacobian());
+  minimizer_options.jacobian = 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(
-      TrustRegionStrategy::Create(trs_options));
+  minimizer_options.trust_region_strategy =
+      TrustRegionStrategy::Create(trs_options);
   CHECK(minimizer_options.trust_region_strategy != nullptr);
   minimizer_options.is_silent = true;
 
@@ -263,12 +264,12 @@
 // of independent sets of decreasing size and invert it. This
 // seems to work better in practice, i.e., Cameras before
 // points.
-ParameterBlockOrdering* CoordinateDescentMinimizer::CreateOrdering(
-    const Program& program) {
-  std::unique_ptr<ParameterBlockOrdering> ordering(new ParameterBlockOrdering);
+std::shared_ptr<ParameterBlockOrdering>
+CoordinateDescentMinimizer::CreateOrdering(const Program& program) {
+  auto ordering = std::make_shared<ParameterBlockOrdering>();
   ComputeRecursiveIndependentSetOrdering(program, ordering.get());
   ordering->Reverse();
-  return ordering.release();
+  return ordering;
 }
 
 }  // namespace internal
diff --git a/internal/ceres/coordinate_descent_minimizer.h b/internal/ceres/coordinate_descent_minimizer.h
index 90ba2cf..d46e6a8 100644
--- a/internal/ceres/coordinate_descent_minimizer.h
+++ b/internal/ceres/coordinate_descent_minimizer.h
@@ -81,7 +81,8 @@
   // of independent sets of decreasing size and invert it. This
   // seems to work better in practice, i.e., Cameras before
   // points.
-  static ParameterBlockOrdering* CreateOrdering(const Program& program);
+  static std::shared_ptr<ParameterBlockOrdering> CreateOrdering(
+      const Program& program);
 
  private:
   void Solve(Program* program,
diff --git a/internal/ceres/corrector.cc b/internal/ceres/corrector.cc
index 6a79a06..bf3ba9c 100644
--- a/internal/ceres/corrector.cc
+++ b/internal/ceres/corrector.cc
@@ -111,7 +111,7 @@
 }
 
 void Corrector::CorrectResiduals(const int num_rows, double* residuals) {
-  DCHECK(residuals != NULL);
+  DCHECK(residuals != nullptr);
   // Equation 11 in BANS.
   VectorRef(residuals, num_rows) *= residual_scaling_;
 }
@@ -120,8 +120,8 @@
                                 const int num_cols,
                                 double* residuals,
                                 double* jacobian) {
-  DCHECK(residuals != NULL);
-  DCHECK(jacobian != NULL);
+  DCHECK(residuals != nullptr);
+  DCHECK(jacobian != nullptr);
 
   // The common case (rho[2] <= 0).
   if (alpha_sq_norm_ == 0.0) {
diff --git a/internal/ceres/cost_function_to_functor_test.cc b/internal/ceres/cost_function_to_functor_test.cc
index 11f47e3..80efd66 100644
--- a/internal/ceres/cost_function_to_functor_test.cc
+++ b/internal/ceres/cost_function_to_functor_test.cc
@@ -92,9 +92,9 @@
   }
 
   EXPECT_TRUE(
-      cost_function.Evaluate(parameter_blocks.get(), residuals.get(), NULL));
+      cost_function.Evaluate(parameter_blocks.get(), residuals.get(), nullptr));
   EXPECT_TRUE(actual_cost_function.Evaluate(
-      parameter_blocks.get(), actual_residuals.get(), NULL));
+      parameter_blocks.get(), actual_residuals.get(), nullptr));
   for (int i = 0; i < num_residuals; ++i) {
     EXPECT_NEAR(residuals[i], actual_residuals[i], kTolerance)
         << "residual id: " << i;
diff --git a/internal/ceres/covariance.cc b/internal/ceres/covariance.cc
index ead3287..d63dd37 100644
--- a/internal/ceres/covariance.cc
+++ b/internal/ceres/covariance.cc
@@ -39,12 +39,11 @@
 
 namespace ceres {
 
-using std::make_pair;
 using std::pair;
 using std::vector;
 
 Covariance::Covariance(const Covariance::Options& options) {
-  impl_.reset(new internal::CovarianceImpl(options));
+  impl_ = std::make_unique<internal::CovarianceImpl>(options);
 }
 
 Covariance::~Covariance() = default;
diff --git a/internal/ceres/covariance_impl.cc b/internal/ceres/covariance_impl.cc
index 8c00384..5075609 100644
--- a/internal/ceres/covariance_impl.cc
+++ b/internal/ceres/covariance_impl.cc
@@ -83,7 +83,7 @@
 
 template <typename T>
 void CheckForDuplicates(std::vector<T> blocks) {
-  sort(blocks.begin(), blocks.end());
+  std::sort(blocks.begin(), blocks.end());
   typename std::vector<T>::iterator it =
       std::adjacent_find(blocks.begin(), blocks.end());
   if (it != blocks.end()) {
@@ -117,7 +117,7 @@
       covariance_blocks);
   problem_ = problem;
   parameter_block_to_row_index_.clear();
-  covariance_matrix_.reset(nullptr);
+  covariance_matrix_ = nullptr;
   is_valid_ = (ComputeCovarianceSparsity(covariance_blocks, problem) &&
                ComputeCovarianceValues());
   is_computed_ = true;
@@ -448,9 +448,9 @@
     }
   }
 
-  if (covariance_blocks.size() == 0) {
+  if (covariance_blocks.empty()) {
     VLOG(2) << "No non-zero covariance blocks found";
-    covariance_matrix_.reset(nullptr);
+    covariance_matrix_ = nullptr;
     return true;
   }
 
@@ -460,8 +460,8 @@
   std::sort(covariance_blocks.begin(), covariance_blocks.end());
 
   // Fill the sparsity pattern of the covariance matrix.
-  covariance_matrix_.reset(
-      new CompressedRowSparseMatrix(num_rows, num_rows, num_nonzeros));
+  covariance_matrix_ = std::make_unique<CompressedRowSparseMatrix>(
+      num_rows, num_rows, num_nonzeros);
 
   int* rows = covariance_matrix_->mutable_rows();
   int* cols = covariance_matrix_->mutable_cols();
diff --git a/internal/ceres/covariance_test.cc b/internal/ceres/covariance_test.cc
index e39b2ae..b117a64 100644
--- a/internal/ceres/covariance_test.cc
+++ b/internal/ceres/covariance_test.cc
@@ -72,12 +72,12 @@
       residuals[i] = 1;
     }
 
-    if (jacobians == NULL) {
+    if (jacobians == nullptr) {
       return true;
     }
 
-    if (jacobians[0] != NULL) {
-      copy(jacobian_.begin(), jacobian_.end(), jacobians[0]);
+    if (jacobians[0] != nullptr) {
+      std::copy(jacobian_.begin(), jacobian_.end(), jacobians[0]);
     }
 
     return true;
@@ -110,16 +110,16 @@
       residuals[i] = 2;
     }
 
-    if (jacobians == NULL) {
+    if (jacobians == nullptr) {
       return true;
     }
 
-    if (jacobians[0] != NULL) {
-      copy(jacobian1_.begin(), jacobian1_.end(), jacobians[0]);
+    if (jacobians[0] != nullptr) {
+      std::copy(jacobian1_.begin(), jacobian1_.end(), jacobians[0]);
     }
 
-    if (jacobians[1] != NULL) {
-      copy(jacobian2_.begin(), jacobian2_.end(), jacobians[1]);
+    if (jacobians[1] != nullptr) {
+      std::copy(jacobian2_.begin(), jacobian2_.end(), jacobians[1]);
     }
 
     return true;
@@ -143,13 +143,13 @@
   // Add in random order
   Vector junk_jacobian = Vector::Zero(10);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 1, junk_jacobian.data()), NULL, block1);
+      new UnaryCostFunction(1, 1, junk_jacobian.data()), nullptr, block1);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 4, junk_jacobian.data()), NULL, block4);
+      new UnaryCostFunction(1, 4, junk_jacobian.data()), nullptr, block4);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 3, junk_jacobian.data()), NULL, block3);
+      new UnaryCostFunction(1, 3, junk_jacobian.data()), nullptr, block3);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 2, junk_jacobian.data()), NULL, block2);
+      new UnaryCostFunction(1, 2, junk_jacobian.data()), nullptr, block2);
 
   // Sparsity pattern
   //
@@ -229,13 +229,13 @@
   // Add in random order
   Vector junk_jacobian = Vector::Zero(10);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 1, junk_jacobian.data()), NULL, block1);
+      new UnaryCostFunction(1, 1, junk_jacobian.data()), nullptr, block1);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 4, junk_jacobian.data()), NULL, block4);
+      new UnaryCostFunction(1, 4, junk_jacobian.data()), nullptr, block4);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 3, junk_jacobian.data()), NULL, block3);
+      new UnaryCostFunction(1, 3, junk_jacobian.data()), nullptr, block3);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 2, junk_jacobian.data()), NULL, block2);
+      new UnaryCostFunction(1, 2, junk_jacobian.data()), nullptr, block2);
   problem.SetParameterBlockConstant(block3);
 
   // Sparsity pattern
@@ -310,12 +310,12 @@
   // Add in random order
   Vector junk_jacobian = Vector::Zero(10);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 1, junk_jacobian.data()), NULL, block1);
+      new UnaryCostFunction(1, 1, junk_jacobian.data()), nullptr, block1);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 4, junk_jacobian.data()), NULL, block4);
+      new UnaryCostFunction(1, 4, junk_jacobian.data()), nullptr, block4);
   problem.AddParameterBlock(block3, 3);
   problem.AddResidualBlock(
-      new UnaryCostFunction(1, 2, junk_jacobian.data()), NULL, block2);
+      new UnaryCostFunction(1, 2, junk_jacobian.data()), nullptr, block2);
 
   // Sparsity pattern
   //
@@ -450,32 +450,34 @@
 
     {
       double jacobian[] = {1.0, 0.0, 0.0, 1.0};
-      problem_.AddResidualBlock(new UnaryCostFunction(2, 2, jacobian), NULL, x);
+      problem_.AddResidualBlock(
+          new UnaryCostFunction(2, 2, jacobian), nullptr, x);
     }
 
     {
       double jacobian[] = {2.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 2.0};
-      problem_.AddResidualBlock(new UnaryCostFunction(3, 3, jacobian), NULL, y);
+      problem_.AddResidualBlock(
+          new UnaryCostFunction(3, 3, jacobian), nullptr, y);
     }
 
     {
       double jacobian = 5.0;
       problem_.AddResidualBlock(
-          new UnaryCostFunction(1, 1, &jacobian), NULL, z);
+          new UnaryCostFunction(1, 1, &jacobian), nullptr, z);
     }
 
     {
       double jacobian1[] = {1.0, 2.0, 3.0};
       double jacobian2[] = {-5.0, -6.0};
       problem_.AddResidualBlock(
-          new BinaryCostFunction(1, 3, 2, jacobian1, jacobian2), NULL, y, x);
+          new BinaryCostFunction(1, 3, 2, jacobian1, jacobian2), nullptr, y, x);
     }
 
     {
       double jacobian1[] = {2.0};
       double jacobian2[] = {3.0, -2.0};
       problem_.AddResidualBlock(
-          new BinaryCostFunction(1, 1, 2, jacobian1, jacobian2), NULL, z, x);
+          new BinaryCostFunction(1, 1, 2, jacobian1, jacobian2), nullptr, z, x);
     }
 
     all_covariance_blocks_.push_back(make_pair(x, x));
@@ -1368,32 +1370,34 @@
 
     {
       double jacobian[] = {1.0, 0.0, 0.0, 1.0};
-      problem_.AddResidualBlock(new UnaryCostFunction(2, 2, jacobian), NULL, x);
+      problem_.AddResidualBlock(
+          new UnaryCostFunction(2, 2, jacobian), nullptr, x);
     }
 
     {
       double jacobian[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-      problem_.AddResidualBlock(new UnaryCostFunction(3, 3, jacobian), NULL, y);
+      problem_.AddResidualBlock(
+          new UnaryCostFunction(3, 3, jacobian), nullptr, y);
     }
 
     {
       double jacobian = 5.0;
       problem_.AddResidualBlock(
-          new UnaryCostFunction(1, 1, &jacobian), NULL, z);
+          new UnaryCostFunction(1, 1, &jacobian), nullptr, z);
     }
 
     {
       double jacobian1[] = {0.0, 0.0, 0.0};
       double jacobian2[] = {-5.0, -6.0};
       problem_.AddResidualBlock(
-          new BinaryCostFunction(1, 3, 2, jacobian1, jacobian2), NULL, y, x);
+          new BinaryCostFunction(1, 3, 2, jacobian1, jacobian2), nullptr, y, x);
     }
 
     {
       double jacobian1[] = {2.0};
       double jacobian2[] = {3.0, -2.0};
       problem_.AddResidualBlock(
-          new BinaryCostFunction(1, 1, 2, jacobian1, jacobian2), NULL, z, x);
+          new BinaryCostFunction(1, 1, 2, jacobian1, jacobian2), nullptr, z, x);
     }
 
     all_covariance_blocks_.push_back(make_pair(x, x));
@@ -1602,8 +1606,8 @@
   void SetUp() final {
     num_parameter_blocks_ = 2000;
     parameter_block_size_ = 5;
-    parameters_.reset(
-        new double[parameter_block_size_ * num_parameter_blocks_]);
+    parameters_ = std::make_unique<double[]>(parameter_block_size_ *
+                                             num_parameter_blocks_);
 
     Matrix jacobian(parameter_block_size_, parameter_block_size_);
     for (int i = 0; i < num_parameter_blocks_; ++i) {
@@ -1614,7 +1618,7 @@
       problem_.AddResidualBlock(
           new UnaryCostFunction(
               parameter_block_size_, parameter_block_size_, jacobian.data()),
-          NULL,
+          nullptr,
           block_i);
       for (int j = i; j < num_parameter_blocks_; ++j) {
         double* block_j = parameters_.get() + j * parameter_block_size_;
diff --git a/internal/ceres/cubic_interpolation_test.cc b/internal/ceres/cubic_interpolation_test.cc
index 3907d22..03b1aae 100644
--- a/internal/ceres/cubic_interpolation_test.cc
+++ b/internal/ceres/cubic_interpolation_test.cc
@@ -226,7 +226,7 @@
                                       const double b,
                                       const double c,
                                       const double d) {
-    values_.reset(new double[kDataDimension * kNumSamples]);
+    values_ = std::make_unique<double[]>(kDataDimension * kNumSamples);
 
     for (int x = 0; x < kNumSamples; ++x) {
       for (int dim = 0; dim < kDataDimension; ++dim) {
@@ -335,7 +335,7 @@
 
   template <int kDataDimension>
   void RunPolynomialInterpolationTest(const Eigen::Matrix3d& coeff) {
-    values_.reset(new double[kNumRows * kNumCols * kDataDimension]);
+    values_ = std::make_unique<double[]>(kNumRows * kNumCols * kDataDimension);
     coeff_ = coeff;
     double* v = values_.get();
     for (int r = 0; r < kNumRows; ++r) {
diff --git a/internal/ceres/cxsparse.cc b/internal/ceres/cxsparse.cc
index 0167f98..7800e8b 100644
--- a/internal/ceres/cxsparse.cc
+++ b/internal/ceres/cxsparse.cc
@@ -47,7 +47,7 @@
 
 using std::vector;
 
-CXSparse::CXSparse() : scratch_(NULL), scratch_size_(0) {}
+CXSparse::CXSparse() : scratch_(nullptr), scratch_size_(0) {}
 
 CXSparse::~CXSparse() {
   if (scratch_size_ > 0) {
@@ -116,7 +116,7 @@
   block_matrix.nzmax = block_rows.size();
   block_matrix.p = &block_cols[0];
   block_matrix.i = &block_rows[0];
-  block_matrix.x = NULL;
+  block_matrix.x = nullptr;
 
   int* ordering = cs_amd(1, &block_matrix);
   vector<int> block_ordering(num_row_blocks, -1);
@@ -146,7 +146,7 @@
 
   if (symbolic_factor->lnz < 0) {
     cs_sfree(symbolic_factor);
-    symbolic_factor = NULL;
+    symbolic_factor = nullptr;
   }
 
   return symbolic_factor;
@@ -206,8 +206,8 @@
 
 CXSparseCholesky::CXSparseCholesky(const OrderingType ordering_type)
     : ordering_type_(ordering_type),
-      symbolic_factor_(NULL),
-      numeric_factor_(NULL) {}
+      symbolic_factor_(nullptr),
+      numeric_factor_(nullptr) {}
 
 CXSparseCholesky::~CXSparseCholesky() {
   FreeSymbolicFactorization();
@@ -217,14 +217,14 @@
 LinearSolverTerminationType CXSparseCholesky::Factorize(
     CompressedRowSparseMatrix* lhs, std::string* message) {
   CHECK_EQ(lhs->storage_type(), StorageType());
-  if (lhs == NULL) {
-    *message = "Failure: Input lhs is NULL.";
+  if (lhs == nullptr) {
+    *message = "Failure: Input lhs is nullptr.";
     return LINEAR_SOLVER_FATAL_ERROR;
   }
 
   cs_di cs_lhs = cs_.CreateSparseMatrixTransposeView(lhs);
 
-  if (symbolic_factor_ == NULL) {
+  if (symbolic_factor_ == nullptr) {
     if (ordering_type_ == NATURAL) {
       symbolic_factor_ = cs_.AnalyzeCholeskyWithNaturalOrdering(&cs_lhs);
     } else {
@@ -236,7 +236,7 @@
       }
     }
 
-    if (symbolic_factor_ == NULL) {
+    if (symbolic_factor_ == nullptr) {
       *message = "CXSparse Failure : Symbolic factorization failed.";
       return LINEAR_SOLVER_FATAL_ERROR;
     }
@@ -244,7 +244,7 @@
 
   FreeNumericFactorization();
   numeric_factor_ = cs_.Cholesky(&cs_lhs, symbolic_factor_);
-  if (numeric_factor_ == NULL) {
+  if (numeric_factor_ == nullptr) {
     *message = "CXSparse Failure : Numeric factorization failed.";
     return LINEAR_SOLVER_FAILURE;
   }
@@ -255,7 +255,7 @@
 LinearSolverTerminationType CXSparseCholesky::Solve(const double* rhs,
                                                     double* solution,
                                                     std::string* message) {
-  CHECK(numeric_factor_ != NULL)
+  CHECK(numeric_factor_ != nullptr)
       << "Solve called without a call to Factorize first.";
   const int num_cols = numeric_factor_->L->n;
   memcpy(solution, rhs, num_cols * sizeof(*solution));
@@ -264,16 +264,16 @@
 }
 
 void CXSparseCholesky::FreeSymbolicFactorization() {
-  if (symbolic_factor_ != NULL) {
+  if (symbolic_factor_ != nullptr) {
     cs_.Free(symbolic_factor_);
-    symbolic_factor_ = NULL;
+    symbolic_factor_ = nullptr;
   }
 }
 
 void CXSparseCholesky::FreeNumericFactorization() {
-  if (numeric_factor_ != NULL) {
+  if (numeric_factor_ != nullptr) {
     cs_.Free(numeric_factor_);
-    numeric_factor_ = NULL;
+    numeric_factor_ = nullptr;
   }
 }
 
diff --git a/internal/ceres/cxsparse.h b/internal/ceres/cxsparse.h
index d1d14ec..63dddb5 100644
--- a/internal/ceres/cxsparse.h
+++ b/internal/ceres/cxsparse.h
@@ -80,7 +80,7 @@
   cs_di CreateSparseMatrixTransposeView(CompressedRowSparseMatrix* A);
 
   // Creates a new matrix from a triplet form. Deallocate the returned matrix
-  // with Free. May return NULL if the compression or allocation fails.
+  // with Free. May return nullptr if the compression or allocation fails.
   cs_di* CreateSparseMatrix(TripletSparseMatrix* A);
 
   // B = A'
@@ -122,7 +122,7 @@
                                const std::vector<int>& col_blocks);
 
   // Compute an fill-reducing approximate minimum degree ordering of
-  // the matrix A. ordering should be non-NULL and should point to
+  // the matrix A. ordering should be non-nullptr and should point to
   // enough memory to hold the ordering for the rows of A.
   void ApproximateMinimumDegreeOrdering(cs_di* A, int* ordering);
 
diff --git a/internal/ceres/dense_jacobian_writer.h b/internal/ceres/dense_jacobian_writer.h
index efecf35..0d86819 100644
--- a/internal/ceres/dense_jacobian_writer.h
+++ b/internal/ceres/dense_jacobian_writer.h
@@ -58,9 +58,9 @@
     return ScratchEvaluatePreparer::Create(*program_, num_threads);
   }
 
-  SparseMatrix* CreateJacobian() const {
-    return new DenseSparseMatrix(program_->NumResiduals(),
-                                 program_->NumEffectiveParameters());
+  std::unique_ptr<SparseMatrix> CreateJacobian() const {
+    return std::make_unique<DenseSparseMatrix>(
+        program_->NumResiduals(), program_->NumEffectiveParameters());
   }
 
   void Write(int residual_id,
diff --git a/internal/ceres/dense_linear_solver_test.cc b/internal/ceres/dense_linear_solver_test.cc
index 4dff5af..8110d8d 100644
--- a/internal/ceres/dense_linear_solver_test.cc
+++ b/internal/ceres/dense_linear_solver_test.cc
@@ -62,8 +62,8 @@
   Param param = GetParam();
   const bool regularized = testing::get<2>(param);
 
-  std::unique_ptr<LinearLeastSquaresProblem> problem(
-      CreateLinearLeastSquaresProblemFromId(testing::get<3>(param)));
+  std::unique_ptr<LinearLeastSquaresProblem> problem =
+      CreateLinearLeastSquaresProblemFromId(testing::get<3>(param));
   DenseSparseMatrix lhs(*down_cast<TripletSparseMatrix*>(problem->A.get()));
 
   const int num_cols = lhs.num_cols();
diff --git a/internal/ceres/dense_normal_cholesky_solver.cc b/internal/ceres/dense_normal_cholesky_solver.cc
index b208d58..2d3521c 100644
--- a/internal/ceres/dense_normal_cholesky_solver.cc
+++ b/internal/ceres/dense_normal_cholesky_solver.cc
@@ -72,7 +72,7 @@
   //   rhs = A'b
   Vector rhs = A->matrix().transpose() * ConstVectorRef(b, num_rows);
 
-  if (per_solve_options.D != NULL) {
+  if (per_solve_options.D != nullptr) {
     ConstVectorRef D(per_solve_options.D, num_cols);
     lhs += D.array().square().matrix().asDiagonal();
   }
diff --git a/internal/ceres/dense_sparse_matrix_test.cc b/internal/ceres/dense_sparse_matrix_test.cc
index 2fa7216..1bfd6c6 100644
--- a/internal/ceres/dense_sparse_matrix_test.cc
+++ b/internal/ceres/dense_sparse_matrix_test.cc
@@ -70,13 +70,13 @@
 class DenseSparseMatrixTest : public ::testing::Test {
  protected:
   void SetUp() final {
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(1));
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(1);
 
     CHECK(problem != nullptr);
 
     tsm.reset(down_cast<TripletSparseMatrix*>(problem->A.release()));
-    dsm.reset(new DenseSparseMatrix(*tsm));
+    dsm = std::make_unique<DenseSparseMatrix>(*tsm);
 
     num_rows = tsm->num_rows();
     num_cols = tsm->num_cols();
diff --git a/internal/ceres/dogleg_strategy.cc b/internal/ceres/dogleg_strategy.cc
index 03ae22f..65f7ccd 100644
--- a/internal/ceres/dogleg_strategy.cc
+++ b/internal/ceres/dogleg_strategy.cc
@@ -480,7 +480,7 @@
 
   // Find the real parts y_i of its roots (not only the real roots).
   Vector roots_real;
-  if (!FindPolynomialRoots(polynomial, &roots_real, NULL)) {
+  if (!FindPolynomialRoots(polynomial, &roots_real, nullptr)) {
     // Failed to find the roots of the polynomial, i.e. the candidate
     // solutions of the constrained problem. Report this back to the caller.
     return false;
diff --git a/internal/ceres/dogleg_strategy_test.cc b/internal/ceres/dogleg_strategy_test.cc
index 0c20f25..cd5fe02 100644
--- a/internal/ceres/dogleg_strategy_test.cc
+++ b/internal/ceres/dogleg_strategy_test.cc
@@ -79,7 +79,7 @@
 
     Matrix sqrtD = Ddiag.array().sqrt().matrix().asDiagonal();
     Matrix jacobian = sqrtD * basis;
-    jacobian_.reset(new DenseSparseMatrix(jacobian));
+    jacobian_ = std::make_unique<DenseSparseMatrix>(jacobian);
 
     Vector minimum(6);
     minimum << 1.0, 1.0, 1.0, 1.0, 1.0, 1.0;
@@ -107,7 +107,7 @@
     Ddiag << 1.0, 2.0, 4.0, 8.0, 16.0, 32.0;
 
     Matrix jacobian = Ddiag.asDiagonal();
-    jacobian_.reset(new DenseSparseMatrix(jacobian));
+    jacobian_ = std::make_unique<DenseSparseMatrix>(jacobian);
 
     Vector minimum(6);
     minimum << 0.0, 0.0, 1.0, 0.0, 0.0, 0.0;
diff --git a/internal/ceres/dynamic_autodiff_cost_function_test.cc b/internal/ceres/dynamic_autodiff_cost_function_test.cc
index 55d3fe1..7da81a9 100644
--- a/internal/ceres/dynamic_autodiff_cost_function_test.cc
+++ b/internal/ceres/dynamic_autodiff_cost_function_test.cc
@@ -89,7 +89,7 @@
   parameter_blocks[0] = &param_block_0[0];
   parameter_blocks[1] = &param_block_1[0];
   EXPECT_TRUE(
-      cost_function.Evaluate(&parameter_blocks[0], residuals.data(), NULL));
+      cost_function.Evaluate(&parameter_blocks[0], residuals.data(), nullptr));
   for (int r = 0; r < 10; ++r) {
     EXPECT_EQ(1.0 * r, residuals.at(r * 2));
     EXPECT_EQ(-1.0 * r, residuals.at(r * 2 + 1));
@@ -189,7 +189,7 @@
   jacobian_vect[0].resize(21 * 10, -100000);
   jacobian_vect[1].resize(21 * 5, -100000);
   vector<double*> jacobian;
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
   jacobian.push_back(jacobian_vect[1].data());
 
   // Test jacobian computation.
@@ -240,7 +240,7 @@
   jacobian_vect[1].resize(21 * 5, -100000);
   vector<double*> jacobian;
   jacobian.push_back(jacobian_vect[0].data());
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
 
   // Test jacobian computation.
   EXPECT_TRUE(cost_function.Evaluate(
@@ -329,15 +329,14 @@
     // Prepare the cost function.
     typedef DynamicAutoDiffCostFunction<MyThreeParameterCostFunctor, 3>
         DynamicMyThreeParameterCostFunction;
-    DynamicMyThreeParameterCostFunction* cost_function =
-        new DynamicMyThreeParameterCostFunction(
-            new MyThreeParameterCostFunctor());
+    auto cost_function = std::make_unique<DynamicMyThreeParameterCostFunction>(
+        new MyThreeParameterCostFunctor());
     cost_function->AddParameterBlock(1);
     cost_function->AddParameterBlock(2);
     cost_function->AddParameterBlock(3);
     cost_function->SetNumResiduals(7);
 
-    cost_function_.reset(cost_function);
+    cost_function_ = std::move(cost_function);
 
     // Setup jacobian data.
     jacobian_vect_.resize(3);
@@ -430,7 +429,7 @@
 TEST_F(ThreeParameterCostFunctorTest, TestThreeParameterResiduals) {
   vector<double> residuals(7, -100000);
   EXPECT_TRUE(cost_function_->Evaluate(
-      parameter_blocks_.data(), residuals.data(), NULL));
+      parameter_blocks_.data(), residuals.data(), nullptr));
   for (int i = 0; i < 7; ++i) {
     EXPECT_EQ(expected_residuals_[i], residuals[i]);
   }
@@ -469,9 +468,9 @@
   vector<double> residuals(7, -100000);
 
   vector<double*> jacobian;
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
   jacobian.push_back(jacobian_vect_[1].data());
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
 
   EXPECT_TRUE(cost_function_->Evaluate(
       parameter_blocks_.data(), residuals.data(), jacobian.data()));
@@ -491,7 +490,7 @@
 
   vector<double*> jacobian;
   jacobian.push_back(jacobian_vect_[0].data());
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
   jacobian.push_back(jacobian_vect_[2].data());
 
   EXPECT_TRUE(cost_function_->Evaluate(
@@ -562,14 +561,14 @@
     // Prepare the cost function.
     typedef DynamicAutoDiffCostFunction<MySixParameterCostFunctor, 3>
         DynamicMySixParameterCostFunction;
-    DynamicMySixParameterCostFunction* cost_function =
-        new DynamicMySixParameterCostFunction(new MySixParameterCostFunctor());
+    auto cost_function = std::make_unique<DynamicMySixParameterCostFunction>(
+        new MySixParameterCostFunctor());
     for (int i = 0; i < 6; ++i) {
       cost_function->AddParameterBlock(1);
     }
     cost_function->SetNumResiduals(7);
 
-    cost_function_.reset(cost_function);
+    cost_function_ = std::move(cost_function);
 
     // Setup jacobian data.
     jacobian_vect_.resize(6);
@@ -669,7 +668,7 @@
 TEST_F(SixParameterCostFunctorTest, TestSixParameterResiduals) {
   vector<double> residuals(7, -100000);
   EXPECT_TRUE(cost_function_->Evaluate(
-      parameter_blocks_.data(), residuals.data(), NULL));
+      parameter_blocks_.data(), residuals.data(), nullptr));
   for (int i = 0; i < 7; ++i) {
     EXPECT_EQ(expected_residuals_[i], residuals[i]);
   }
@@ -706,10 +705,10 @@
   vector<double*> jacobian;
   jacobian.push_back(jacobian_vect_[0].data());
   jacobian.push_back(jacobian_vect_[1].data());
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
   jacobian.push_back(jacobian_vect_[3].data());
   jacobian.push_back(jacobian_vect_[4].data());
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
 
   EXPECT_TRUE(cost_function_->Evaluate(
       parameter_blocks_.data(), residuals.data(), jacobian.data()));
@@ -735,10 +734,10 @@
 
   vector<double*> jacobian;
   jacobian.push_back(jacobian_vect_[0].data());
-  jacobian.push_back(NULL);
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
+  jacobian.push_back(nullptr);
   jacobian.push_back(jacobian_vect_[3].data());
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
   jacobian.push_back(jacobian_vect_[5].data());
 
   EXPECT_TRUE(cost_function_->Evaluate(
diff --git a/internal/ceres/dynamic_compressed_row_jacobian_writer.cc b/internal/ceres/dynamic_compressed_row_jacobian_writer.cc
index 9f709a3..f6bb3b3 100644
--- a/internal/ceres/dynamic_compressed_row_jacobian_writer.cc
+++ b/internal/ceres/dynamic_compressed_row_jacobian_writer.cc
@@ -48,12 +48,12 @@
   return ScratchEvaluatePreparer::Create(*program_, num_threads);
 }
 
-SparseMatrix* DynamicCompressedRowJacobianWriter::CreateJacobian() const {
-  DynamicCompressedRowSparseMatrix* jacobian =
-      new DynamicCompressedRowSparseMatrix(program_->NumResiduals(),
-                                           program_->NumEffectiveParameters(),
-                                           0 /* max_num_nonzeros */);
-  return jacobian;
+std::unique_ptr<SparseMatrix>
+DynamicCompressedRowJacobianWriter::CreateJacobian() const {
+  return std::make_unique<DynamicCompressedRowSparseMatrix>(
+      program_->NumResiduals(),
+      program_->NumEffectiveParameters(),
+      0 /* max_num_nonzeros */);
 }
 
 void DynamicCompressedRowJacobianWriter::Write(int residual_id,
diff --git a/internal/ceres/dynamic_compressed_row_jacobian_writer.h b/internal/ceres/dynamic_compressed_row_jacobian_writer.h
index ef8fa25..b9858ba 100644
--- a/internal/ceres/dynamic_compressed_row_jacobian_writer.h
+++ b/internal/ceres/dynamic_compressed_row_jacobian_writer.h
@@ -60,7 +60,7 @@
   // Return a `DynamicCompressedRowSparseMatrix` which is filled by
   // `Write`. Note that `Finalize` must be called to make the
   // `CompressedRowSparseMatrix` interface valid.
-  SparseMatrix* CreateJacobian() const;
+  std::unique_ptr<SparseMatrix> CreateJacobian() const;
 
   // Write only the non-zero jacobian entries for a residual block
   // (specified by `residual_id`) into `base_jacobian`, starting at the row
diff --git a/internal/ceres/dynamic_compressed_row_sparse_matrix_test.cc b/internal/ceres/dynamic_compressed_row_sparse_matrix_test.cc
index 95dc807..3b67389 100644
--- a/internal/ceres/dynamic_compressed_row_sparse_matrix_test.cc
+++ b/internal/ceres/dynamic_compressed_row_sparse_matrix_test.cc
@@ -61,7 +61,8 @@
     InitialiseDenseReference();
     InitialiseSparseMatrixReferences();
 
-    dcrsm.reset(new DynamicCompressedRowSparseMatrix(num_rows, num_cols, 0));
+    dcrsm = std::make_unique<DynamicCompressedRowSparseMatrix>(
+        num_rows, num_cols, 0);
   }
 
   void Finalize() { dcrsm->Finalize(num_additional_elements); }
@@ -93,8 +94,8 @@
     }
     ASSERT_EQ(values.size(), expected_num_nonzeros);
 
-    tsm.reset(
-        new TripletSparseMatrix(num_rows, num_cols, expected_num_nonzeros));
+    tsm = std::make_unique<TripletSparseMatrix>(
+        num_rows, num_cols, expected_num_nonzeros);
     copy(rows.begin(), rows.end(), tsm->mutable_rows());
     copy(cols.begin(), cols.end(), tsm->mutable_cols());
     copy(values.begin(), values.end(), tsm->mutable_values());
@@ -104,7 +105,7 @@
     tsm->ToDenseMatrix(&dense_from_tsm);
     ASSERT_TRUE((dense.array() == dense_from_tsm.array()).all());
 
-    crsm.reset(CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm));
+    crsm = CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm);
     Matrix dense_from_crsm;
     crsm->ToDenseMatrix(&dense_from_crsm);
     ASSERT_TRUE((dense.array() == dense_from_crsm.array()).all());
diff --git a/internal/ceres/dynamic_numeric_diff_cost_function_test.cc b/internal/ceres/dynamic_numeric_diff_cost_function_test.cc
index 0150f5e..ad3f479 100644
--- a/internal/ceres/dynamic_numeric_diff_cost_function_test.cc
+++ b/internal/ceres/dynamic_numeric_diff_cost_function_test.cc
@@ -89,7 +89,7 @@
   parameter_blocks[0] = &param_block_0[0];
   parameter_blocks[1] = &param_block_1[0];
   EXPECT_TRUE(
-      cost_function.Evaluate(&parameter_blocks[0], residuals.data(), NULL));
+      cost_function.Evaluate(&parameter_blocks[0], residuals.data(), nullptr));
   for (int r = 0; r < 10; ++r) {
     EXPECT_EQ(1.0 * r, residuals.at(r * 2));
     EXPECT_EQ(-1.0 * r, residuals.at(r * 2 + 1));
@@ -190,7 +190,7 @@
   jacobian_vect[0].resize(21 * 10, -100000);
   jacobian_vect[1].resize(21 * 5, -100000);
   vector<double*> jacobian;
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
   jacobian.push_back(jacobian_vect[1].data());
 
   // Test jacobian computation.
@@ -241,7 +241,7 @@
   jacobian_vect[1].resize(21 * 5, -100000);
   vector<double*> jacobian;
   jacobian.push_back(jacobian_vect[0].data());
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
 
   // Test jacobian computation.
   EXPECT_TRUE(cost_function.Evaluate(
@@ -330,15 +330,14 @@
     // Prepare the cost function.
     typedef DynamicNumericDiffCostFunction<MyThreeParameterCostFunctor>
         DynamicMyThreeParameterCostFunction;
-    DynamicMyThreeParameterCostFunction* cost_function =
-        new DynamicMyThreeParameterCostFunction(
-            new MyThreeParameterCostFunctor());
+    auto cost_function = std::make_unique<DynamicMyThreeParameterCostFunction>(
+        new MyThreeParameterCostFunctor());
     cost_function->AddParameterBlock(1);
     cost_function->AddParameterBlock(2);
     cost_function->AddParameterBlock(3);
     cost_function->SetNumResiduals(7);
 
-    cost_function_.reset(cost_function);
+    cost_function_ = std::move(cost_function);
 
     // Setup jacobian data.
     jacobian_vect_.resize(3);
@@ -431,7 +430,7 @@
 TEST_F(ThreeParameterCostFunctorTest, TestThreeParameterResiduals) {
   vector<double> residuals(7, -100000);
   EXPECT_TRUE(cost_function_->Evaluate(
-      parameter_blocks_.data(), residuals.data(), NULL));
+      parameter_blocks_.data(), residuals.data(), nullptr));
   for (int i = 0; i < 7; ++i) {
     EXPECT_EQ(expected_residuals_[i], residuals[i]);
   }
@@ -470,9 +469,9 @@
   vector<double> residuals(7, -100000);
 
   vector<double*> jacobian;
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
   jacobian.push_back(jacobian_vect_[1].data());
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
 
   EXPECT_TRUE(cost_function_->Evaluate(
       parameter_blocks_.data(), residuals.data(), jacobian.data()));
@@ -492,7 +491,7 @@
 
   vector<double*> jacobian;
   jacobian.push_back(jacobian_vect_[0].data());
-  jacobian.push_back(NULL);
+  jacobian.push_back(nullptr);
   jacobian.push_back(jacobian_vect_[2].data());
 
   EXPECT_TRUE(cost_function_->Evaluate(
diff --git a/internal/ceres/dynamic_sparse_normal_cholesky_solver.cc b/internal/ceres/dynamic_sparse_normal_cholesky_solver.cc
index 87cc904..d101aef 100644
--- a/internal/ceres/dynamic_sparse_normal_cholesky_solver.cc
+++ b/internal/ceres/dynamic_sparse_normal_cholesky_solver.cc
@@ -71,11 +71,11 @@
     // it before returning the matrix to the user.
     std::unique_ptr<CompressedRowSparseMatrix> regularizer;
     if (!A->col_blocks().empty()) {
-      regularizer.reset(CompressedRowSparseMatrix::CreateBlockDiagonalMatrix(
-          per_solve_options.D, A->col_blocks()));
+      regularizer = CompressedRowSparseMatrix::CreateBlockDiagonalMatrix(
+          per_solve_options.D, A->col_blocks());
     } else {
-      regularizer.reset(
-          new CompressedRowSparseMatrix(per_solve_options.D, num_cols));
+      regularizer = std::make_unique<CompressedRowSparseMatrix>(
+          per_solve_options.D, num_cols);
     }
     A->AppendRows(*regularizer);
   }
diff --git a/internal/ceres/dynamic_sparse_normal_cholesky_solver_test.cc b/internal/ceres/dynamic_sparse_normal_cholesky_solver_test.cc
index 8bf609e..f915d32 100644
--- a/internal/ceres/dynamic_sparse_normal_cholesky_solver_test.cc
+++ b/internal/ceres/dynamic_sparse_normal_cholesky_solver_test.cc
@@ -50,19 +50,19 @@
 class DynamicSparseNormalCholeskySolverTest : public ::testing::Test {
  protected:
   void SetUp() final {
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(1));
-    A_.reset(CompressedRowSparseMatrix::FromTripletSparseMatrix(
-        *down_cast<TripletSparseMatrix*>(problem->A.get())));
-    b_.reset(problem->b.release());
-    D_.reset(problem->D.release());
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(1);
+    A_ = CompressedRowSparseMatrix::FromTripletSparseMatrix(
+        *down_cast<TripletSparseMatrix*>(problem->A.get()));
+    b_ = std::move(problem->b);
+    D_ = std::move(problem->D);
   }
 
   void TestSolver(const LinearSolver::Options& options, double* D) {
     Matrix dense_A;
     A_->ToDenseMatrix(&dense_A);
     Matrix lhs = dense_A.transpose() * dense_A;
-    if (D != NULL) {
+    if (D != nullptr) {
       lhs += (ConstVectorRef(D, A_->num_cols()).array() *
               ConstVectorRef(D, A_->num_cols()).array())
                  .matrix()
@@ -100,7 +100,7 @@
         sparse_linear_algebra_library_type;
     ContextImpl context;
     options.context = &context;
-    TestSolver(options, NULL);
+    TestSolver(options, nullptr);
     TestSolver(options, D_.get());
   }
 
diff --git a/internal/ceres/dynamic_sparsity_test.cc b/internal/ceres/dynamic_sparsity_test.cc
index 12e62ef..6c7b24c 100644
--- a/internal/ceres/dynamic_sparsity_test.cc
+++ b/internal/ceres/dynamic_sparsity_test.cc
@@ -307,16 +307,16 @@
     residuals[0] = y_[0] - ((1.0 - u) * x[1 + i0][0] + u * x[1 + i1][0]);
     residuals[1] = y_[1] - ((1.0 - u) * x[1 + i0][1] + u * x[1 + i1][1]);
 
-    if (jacobians == NULL) {
+    if (jacobians == nullptr) {
       return true;
     }
 
-    if (jacobians[0] != NULL) {
+    if (jacobians[0] != nullptr) {
       jacobians[0][0] = x[1 + i0][0] - x[1 + i1][0];
       jacobians[0][1] = x[1 + i0][1] - x[1 + i1][1];
     }
     for (int i = 0; i < num_segments_; ++i) {
-      if (jacobians[i + 1] != NULL) {
+      if (jacobians[i + 1] != nullptr) {
         MatrixRef(jacobians[i + 1], 2, 2).setZero();
         if (i == i0) {
           jacobians[i + 1][0] = -(1.0 - u);
@@ -403,7 +403,7 @@
   // For each data point add a residual which measures its distance to its
   // corresponding position on the line segment contour.
   std::vector<double*> parameter_blocks(1 + num_segments);
-  parameter_blocks[0] = NULL;
+  parameter_blocks[0] = nullptr;
   for (int i = 0; i < num_segments; ++i) {
     parameter_blocks[i + 1] = X.data() + 2 * i;
   }
@@ -411,7 +411,7 @@
     parameter_blocks[0] = &t[i];
     problem.AddResidualBlock(
         PointToLineSegmentContourCostFunction::Create(num_segments, kY.row(i)),
-        NULL,
+        nullptr,
         parameter_blocks);
   }
 
@@ -419,7 +419,7 @@
   for (int i = 0; i < num_segments; ++i) {
     problem.AddResidualBlock(
         EuclideanDistanceFunctor::Create(sqrt(regularization_weight)),
-        NULL,
+        nullptr,
         X.data() + 2 * i,
         X.data() + 2 * ((i + 1) % num_segments));
   }
diff --git a/internal/ceres/eigensparse.cc b/internal/ceres/eigensparse.cc
index 1c47a02..ba8e05a 100644
--- a/internal/ceres/eigensparse.cc
+++ b/internal/ceres/eigensparse.cc
@@ -109,7 +109,7 @@
                                         std::string* message) final {
     CHECK_EQ(lhs->storage_type(), StorageType());
 
-    typename Solver::Scalar* values_ptr = NULL;
+    typename Solver::Scalar* values_ptr = nullptr;
     if (std::is_same<typename Solver::Scalar, double>::value) {
       values_ptr =
           reinterpret_cast<typename Solver::Scalar*>(lhs->mutable_values());
@@ -141,8 +141,6 @@
 
 std::unique_ptr<SparseCholesky> EigenSparseCholesky::Create(
     const OrderingType ordering_type) {
-  std::unique_ptr<SparseCholesky> sparse_cholesky;
-
   typedef Eigen::SimplicialLDLT<Eigen::SparseMatrix<double>,
                                 Eigen::Upper,
                                 Eigen::AMDOrdering<int>>
@@ -151,20 +149,18 @@
                                 Eigen::Upper,
                                 Eigen::NaturalOrdering<int>>
       WithNaturalOrdering;
+
   if (ordering_type == AMD) {
-    sparse_cholesky.reset(new EigenSparseCholeskyTemplate<WithAMDOrdering>());
+    return std::make_unique<EigenSparseCholeskyTemplate<WithAMDOrdering>>();
   } else {
-    sparse_cholesky.reset(
-        new EigenSparseCholeskyTemplate<WithNaturalOrdering>());
+    return std::make_unique<EigenSparseCholeskyTemplate<WithNaturalOrdering>>();
   }
-  return sparse_cholesky;
 }
 
 EigenSparseCholesky::~EigenSparseCholesky() = default;
 
 std::unique_ptr<SparseCholesky> FloatEigenSparseCholesky::Create(
     const OrderingType ordering_type) {
-  std::unique_ptr<SparseCholesky> sparse_cholesky;
   typedef Eigen::SimplicialLDLT<Eigen::SparseMatrix<float>,
                                 Eigen::Upper,
                                 Eigen::AMDOrdering<int>>
@@ -174,12 +170,10 @@
                                 Eigen::NaturalOrdering<int>>
       WithNaturalOrdering;
   if (ordering_type == AMD) {
-    sparse_cholesky.reset(new EigenSparseCholeskyTemplate<WithAMDOrdering>());
+    return std::make_unique<EigenSparseCholeskyTemplate<WithAMDOrdering>>();
   } else {
-    sparse_cholesky.reset(
-        new EigenSparseCholeskyTemplate<WithNaturalOrdering>());
+    return std::make_unique<EigenSparseCholeskyTemplate<WithNaturalOrdering>>();
   }
-  return sparse_cholesky;
 }
 
 FloatEigenSparseCholesky::~FloatEigenSparseCholesky() = default;
diff --git a/internal/ceres/evaluation_callback_test.cc b/internal/ceres/evaluation_callback_test.cc
index f81f3bd..84fff8a 100644
--- a/internal/ceres/evaluation_callback_test.cc
+++ b/internal/ceres/evaluation_callback_test.cc
@@ -132,7 +132,7 @@
     double y = (*parameters)[1];
     residuals[0] = y - a * sin(x);
     residuals[1] = x;
-    if (jacobians != NULL) {
+    if (jacobians != nullptr) {
       (*jacobians)[2 * 0 + 0] = -a * cos(x);  // df1/dx
       (*jacobians)[2 * 0 + 1] = 1.0;          // df1/dy
       (*jacobians)[2 * 1 + 0] = 1.0;          // df2/dx
@@ -157,7 +157,7 @@
     EXPECT_EQ(prepare_parameter_hash, incoming_parameter_hash);
 
     // Check: jacobians are requested if they were in PrepareForEvaluation().
-    EXPECT_EQ(prepare_requested_jacobians, jacobians != NULL);
+    EXPECT_EQ(prepare_requested_jacobians, jacobians != nullptr);
 
     evaluate_num_calls++;
     evaluate_last_parameter_hash = incoming_parameter_hash;
@@ -196,7 +196,7 @@
   problem_options.evaluation_callback = &cost_function;
   problem_options.cost_function_ownership = DO_NOT_TAKE_OWNERSHIP;
   Problem problem(problem_options);
-  problem.AddResidualBlock(&cost_function, NULL, parameters);
+  problem.AddResidualBlock(&cost_function, nullptr, parameters);
 
   Solver::Options options;
   options.linear_solver_type = DENSE_QR;
@@ -322,7 +322,7 @@
   problem_options.evaluation_callback = &cost_function;
   problem_options.cost_function_ownership = DO_NOT_TAKE_OWNERSHIP;
   Problem problem(problem_options);
-  problem.AddResidualBlock(&cost_function, NULL, parameters);
+  problem.AddResidualBlock(&cost_function, nullptr, parameters);
 
   Solver::Options options;
   options.linear_solver_type = DENSE_QR;
diff --git a/internal/ceres/evaluator.cc b/internal/ceres/evaluator.cc
index 4d69f96..f8d1121 100644
--- a/internal/ceres/evaluator.cc
+++ b/internal/ceres/evaluator.cc
@@ -50,36 +50,40 @@
 
 Evaluator::~Evaluator() = default;
 
-Evaluator* Evaluator::Create(const Evaluator::Options& options,
-                             Program* program,
-                             std::string* error) {
-  CHECK(options.context != NULL);
+std::unique_ptr<Evaluator> Evaluator::Create(const Evaluator::Options& options,
+                                             Program* program,
+                                             std::string* error) {
+  CHECK(options.context != nullptr);
 
   switch (options.linear_solver_type) {
     case DENSE_QR:
     case DENSE_NORMAL_CHOLESKY:
-      return new ProgramEvaluator<ScratchEvaluatePreparer, DenseJacobianWriter>(
+      return std::make_unique<
+          ProgramEvaluator<ScratchEvaluatePreparer, DenseJacobianWriter>>(
           options, program);
     case DENSE_SCHUR:
     case SPARSE_SCHUR:
     case ITERATIVE_SCHUR:
     case CGNR:
-      return new ProgramEvaluator<BlockEvaluatePreparer, BlockJacobianWriter>(
+      return std::make_unique<
+          ProgramEvaluator<BlockEvaluatePreparer, BlockJacobianWriter>>(
           options, program);
     case SPARSE_NORMAL_CHOLESKY:
       if (options.dynamic_sparsity) {
-        return new ProgramEvaluator<ScratchEvaluatePreparer,
-                                    DynamicCompressedRowJacobianWriter,
-                                    DynamicCompressedRowJacobianFinalizer>(
-            options, program);
+        return std::make_unique<
+            ProgramEvaluator<ScratchEvaluatePreparer,
+                             DynamicCompressedRowJacobianWriter,
+                             DynamicCompressedRowJacobianFinalizer>>(options,
+                                                                     program);
       } else {
-        return new ProgramEvaluator<BlockEvaluatePreparer, BlockJacobianWriter>(
+        return std::make_unique<
+            ProgramEvaluator<BlockEvaluatePreparer, BlockJacobianWriter>>(
             options, program);
       }
 
     default:
       *error = "Invalid Linear Solver Type. Unable to create evaluator.";
-      return NULL;
+      return nullptr;
   }
 }
 
diff --git a/internal/ceres/evaluator.h b/internal/ceres/evaluator.h
index 5c9cd56..e642551 100644
--- a/internal/ceres/evaluator.h
+++ b/internal/ceres/evaluator.h
@@ -68,9 +68,9 @@
     EvaluationCallback* evaluation_callback = nullptr;
   };
 
-  static Evaluator* Create(const Options& options,
-                           Program* program,
-                           std::string* error);
+  static std::unique_ptr<Evaluator> Create(const Options& options,
+                                           Program* program,
+                                           std::string* error);
 
   // Build and return a sparse matrix for storing and working with the Jacobian
   // of the objective function. The jacobian has dimensions
@@ -88,7 +88,7 @@
   // the jacobian for use with CHOLMOD, where as BlockOptimizationProblem
   // creates a BlockSparseMatrix representation of the jacobian for use in the
   // Schur complement based methods.
-  virtual SparseMatrix* CreateJacobian() const = 0;
+  virtual std::unique_ptr<SparseMatrix> CreateJacobian() const = 0;
 
   // Options struct to control Evaluator::Evaluate;
   struct EvaluateOptions {
@@ -102,10 +102,10 @@
 
   // Evaluate the cost function for the given state. Returns the cost,
   // residuals, and jacobian in the corresponding arguments. Both residuals and
-  // jacobian are optional; to avoid computing them, pass NULL.
+  // jacobian are optional; to avoid computing them, pass nullptr.
   //
-  // If non-NULL, the Jacobian must have a suitable sparsity pattern; only the
-  // values array of the jacobian is modified.
+  // If non-nullptr, the Jacobian must have a suitable sparsity pattern; only
+  // the values array of the jacobian is modified.
   //
   // state is an array of size NumParameters(), cost is a pointer to a single
   // double, and residuals is an array of doubles of size NumResiduals().
diff --git a/internal/ceres/evaluator_test.cc b/internal/ceres/evaluator_test.cc
index 7aaf1b0..f5703f7 100644
--- a/internal/ceres/evaluator_test.cc
+++ b/internal/ceres/evaluator_test.cc
@@ -117,7 +117,7 @@
 };
 
 struct EvaluatorTest : public ::testing::TestWithParam<EvaluatorTestOptions> {
-  Evaluator* CreateEvaluator(Program* program) {
+  std::unique_ptr<Evaluator> CreateEvaluator(Program* program) {
     // This program is straight from the ProblemImpl, and so has no index/offset
     // yet; compute it here as required by the evaluator implementations.
     program->SetParameterOffsetsAndIndex();
@@ -152,8 +152,8 @@
                           const double* expected_residuals,
                           const double* expected_gradient,
                           const double* expected_jacobian) {
-    std::unique_ptr<Evaluator> evaluator(
-        CreateEvaluator(problem->mutable_program()));
+    std::unique_ptr<Evaluator> evaluator =
+        CreateEvaluator(problem->mutable_program());
     int num_residuals = expected_num_rows;
     int num_parameters = expected_num_cols;
 
@@ -608,8 +608,8 @@
   // The values are ignored.
   double state[9];
 
-  std::unique_ptr<Evaluator> evaluator(
-      CreateEvaluator(problem.mutable_program()));
+  std::unique_ptr<Evaluator> evaluator =
+      CreateEvaluator(problem.mutable_program());
   std::unique_ptr<SparseMatrix> jacobian(evaluator->CreateJacobian());
   double cost;
   EXPECT_FALSE(evaluator->Evaluate(state, &cost, nullptr, nullptr, nullptr));
diff --git a/internal/ceres/evaluator_test_utils.cc b/internal/ceres/evaluator_test_utils.cc
index 25801db..f3384bc 100644
--- a/internal/ceres/evaluator_test_utils.cc
+++ b/internal/ceres/evaluator_test_utils.cc
@@ -49,7 +49,7 @@
                         const double* actual_jacobian) {
   EXPECT_EQ(expected_cost, actual_cost);
 
-  if (expected_residuals != NULL) {
+  if (expected_residuals != nullptr) {
     ConstVectorRef expected_residuals_vector(expected_residuals,
                                              expected_num_rows);
     ConstVectorRef actual_residuals_vector(actual_residuals, expected_num_rows);
@@ -61,7 +61,7 @@
         << expected_residuals_vector;
   }
 
-  if (expected_gradient != NULL) {
+  if (expected_gradient != nullptr) {
     ConstVectorRef expected_gradient_vector(expected_gradient,
                                             expected_num_cols);
     ConstVectorRef actual_gradient_vector(actual_gradient, expected_num_cols);
@@ -74,7 +74,7 @@
         << expected_gradient_vector.transpose();
   }
 
-  if (expected_jacobian != NULL) {
+  if (expected_jacobian != nullptr) {
     ConstMatrixRef expected_jacobian_matrix(
         expected_jacobian, expected_num_rows, expected_num_cols);
     ConstMatrixRef actual_jacobian_matrix(
diff --git a/internal/ceres/generate_bundle_adjustment_tests.py b/internal/ceres/generate_bundle_adjustment_tests.py
index 7b0caa3..86b4fcb 100644
--- a/internal/ceres/generate_bundle_adjustment_tests.py
+++ b/internal/ceres/generate_bundle_adjustment_tests.py
@@ -137,7 +137,7 @@
   options->sparse_linear_algebra_library_type = %(sparse_backend)s;
   options->preconditioner_type = %(preconditioner)s;
   if (%(ordering)s) {
-    options->linear_solver_ordering.reset();
+    options->linear_solver_ordering = nullptr;
   }
   Problem* problem = bundle_adjustment_problem.mutable_problem();
   RunSolverForConfigAndExpectResidualsMatch(*options, problem);
diff --git a/internal/ceres/gradient_checker.cc b/internal/ceres/gradient_checker.cc
index c0dcd47..fd302f0 100644
--- a/internal/ceres/gradient_checker.cc
+++ b/internal/ceres/gradient_checker.cc
@@ -134,18 +134,17 @@
     manifolds_[i] = new internal::ManifoldAdapter(local_param);
   }
 
-  DynamicNumericDiffCostFunction<CostFunction, RIDDERS>*
-      finite_diff_cost_function =
-          new DynamicNumericDiffCostFunction<CostFunction, RIDDERS>(
-              function, DO_NOT_TAKE_OWNERSHIP, options);
-  finite_diff_cost_function_.reset(finite_diff_cost_function);
-
+  auto finite_diff_cost_function =
+      std::make_unique<DynamicNumericDiffCostFunction<CostFunction, RIDDERS>>(
+          function, DO_NOT_TAKE_OWNERSHIP, options);
   const vector<int32_t>& parameter_block_sizes =
       function->parameter_block_sizes();
   for (int32_t parameter_block_size : parameter_block_sizes) {
     finite_diff_cost_function->AddParameterBlock(parameter_block_size);
   }
   finite_diff_cost_function->SetNumResiduals(function->num_residuals());
+
+  finite_diff_cost_function_ = std::move(finite_diff_cost_function);
 }
 
 GradientChecker::GradientChecker(const CostFunction* function,
@@ -158,12 +157,10 @@
   } else {
     manifolds_.resize(function->parameter_block_sizes().size(), nullptr);
   }
-  DynamicNumericDiffCostFunction<CostFunction, RIDDERS>*
-      finite_diff_cost_function =
-          new DynamicNumericDiffCostFunction<CostFunction, RIDDERS>(
-              function, DO_NOT_TAKE_OWNERSHIP, options);
-  finite_diff_cost_function_.reset(finite_diff_cost_function);
 
+  auto finite_diff_cost_function =
+      std::make_unique<DynamicNumericDiffCostFunction<CostFunction, RIDDERS>>(
+          function, DO_NOT_TAKE_OWNERSHIP, options);
   const vector<int32_t>& parameter_block_sizes =
       function->parameter_block_sizes();
   const int num_parameter_blocks = parameter_block_sizes.size();
@@ -171,6 +168,8 @@
     finite_diff_cost_function->AddParameterBlock(parameter_block_sizes[i]);
   }
   finite_diff_cost_function->SetNumResiduals(function->num_residuals());
+
+  finite_diff_cost_function_ = std::move(finite_diff_cost_function);
 }
 
 GradientChecker::~GradientChecker() {
diff --git a/internal/ceres/gradient_checking_cost_function.cc b/internal/ceres/gradient_checking_cost_function.cc
index f786b83..bbe68b8 100644
--- a/internal/ceres/gradient_checking_cost_function.cc
+++ b/internal/ceres/gradient_checking_cost_function.cc
@@ -87,7 +87,7 @@
                 double** jacobians) const final {
     if (!jacobians) {
       // Nothing to check in this case; just forward.
-      return function_->Evaluate(parameters, residuals, NULL);
+      return function_->Evaluate(parameters, residuals, nullptr);
     }
 
     GradientChecker::ProbeResults results;
@@ -107,7 +107,7 @@
     // Copy the original jacobian blocks into the jacobians array.
     const vector<int32_t>& block_sizes = function_->parameter_block_sizes();
     for (int k = 0; k < block_sizes.size(); k++) {
-      if (jacobians[k] != NULL) {
+      if (jacobians[k] != nullptr) {
         MatrixRef(jacobians[k],
                   results.jacobians[k].rows(),
                   results.jacobians[k].cols()) = results.jacobians[k];
@@ -169,7 +169,7 @@
                                           callback);
 }
 
-ProblemImpl* CreateGradientCheckingProblemImpl(
+std::unique_ptr<ProblemImpl> CreateGradientCheckingProblemImpl(
     ProblemImpl* problem_impl,
     double relative_step_size,
     double relative_precision,
@@ -190,8 +190,8 @@
   NumericDiffOptions numeric_diff_options;
   numeric_diff_options.relative_step_size = relative_step_size;
 
-  ProblemImpl* gradient_checking_problem_impl =
-      new ProblemImpl(gradient_checking_problem_options);
+  auto gradient_checking_problem_impl =
+      std::make_unique<ProblemImpl>(gradient_checking_problem_options);
 
   Program* program = problem_impl->mutable_program();
 
diff --git a/internal/ceres/gradient_checking_cost_function.h b/internal/ceres/gradient_checking_cost_function.h
index 46cf4dd..b21d113 100644
--- a/internal/ceres/gradient_checking_cost_function.h
+++ b/internal/ceres/gradient_checking_cost_function.h
@@ -92,8 +92,6 @@
 // iteration, the respective cost function will notify the
 // GradientCheckingIterationCallback.
 //
-// The caller owns the returned ProblemImpl object.
-//
 // Note: This is quite inefficient and is intended only for debugging.
 //
 // relative_step_size and relative_precision are parameters to control
@@ -102,11 +100,11 @@
 // jacobians obtained by numerically differentiating them. See the
 // documentation of 'numeric_derivative_relative_step_size' in solver.h for a
 // better explanation.
-CERES_EXPORT_INTERNAL ProblemImpl* CreateGradientCheckingProblemImpl(
-    ProblemImpl* problem_impl,
-    double relative_step_size,
-    double relative_precision,
-    GradientCheckingIterationCallback* callback);
+CERES_EXPORT_INTERNAL std::unique_ptr<ProblemImpl>
+CreateGradientCheckingProblemImpl(ProblemImpl* problem_impl,
+                                  double relative_step_size,
+                                  double relative_precision,
+                                  GradientCheckingIterationCallback* callback);
 
 }  // namespace internal
 }  // namespace ceres
diff --git a/internal/ceres/gradient_checking_cost_function_test.cc b/internal/ceres/gradient_checking_cost_function_test.cc
index 264a858..5630c32 100644
--- a/internal/ceres/gradient_checking_cost_function_test.cc
+++ b/internal/ceres/gradient_checking_cost_function_test.cc
@@ -366,8 +366,8 @@
   // clang-format on
 
   GradientCheckingIterationCallback callback;
-  std::unique_ptr<ProblemImpl> gradient_checking_problem_impl(
-      CreateGradientCheckingProblemImpl(&problem_impl, 1.0, 1.0, &callback));
+  std::unique_ptr<ProblemImpl> gradient_checking_problem_impl =
+      CreateGradientCheckingProblemImpl(&problem_impl, 1.0, 1.0, &callback);
 
   // The dimensions of the two problems match.
   EXPECT_EQ(problem_impl.NumParameterBlocks(),
@@ -444,8 +444,8 @@
   // clang-format on
 
   GradientCheckingIterationCallback callback;
-  std::unique_ptr<ProblemImpl> gradient_checking_problem_impl(
-      CreateGradientCheckingProblemImpl(&problem_impl, 1.0, 1.0, &callback));
+  std::unique_ptr<ProblemImpl> gradient_checking_problem_impl =
+      CreateGradientCheckingProblemImpl(&problem_impl, 1.0, 1.0, &callback);
 
   // The dimensions of the two problems match.
   EXPECT_EQ(problem_impl.NumParameterBlocks(),
@@ -505,8 +505,8 @@
   problem_impl.SetParameterUpperBound(x, 1, 2.5);
 
   GradientCheckingIterationCallback callback;
-  std::unique_ptr<ProblemImpl> gradient_checking_problem_impl(
-      CreateGradientCheckingProblemImpl(&problem_impl, 1.0, 1.0, &callback));
+  std::unique_ptr<ProblemImpl> gradient_checking_problem_impl =
+      CreateGradientCheckingProblemImpl(&problem_impl, 1.0, 1.0, &callback);
 
   // The dimensions of the two problems match.
   EXPECT_EQ(problem_impl.NumParameterBlocks(),
diff --git a/internal/ceres/gradient_problem.cc b/internal/ceres/gradient_problem.cc
index 3ef8e4f..93b18f5 100644
--- a/internal/ceres/gradient_problem.cc
+++ b/internal/ceres/gradient_problem.cc
@@ -53,9 +53,10 @@
       scratch_(new double[function_->NumParameters()]) {
   CHECK(function != nullptr);
   if (parameterization != nullptr) {
-    manifold_.reset(new internal::ManifoldAdapter(parameterization_.get()));
+    manifold_ =
+        std::make_unique<internal::ManifoldAdapter>(parameterization_.get());
   } else {
-    manifold_.reset(new EuclideanManifold(function_->NumParameters()));
+    manifold_ = std::make_unique<EuclideanManifold>(function_->NumParameters());
   }
   CHECK_EQ(function_->NumParameters(), manifold_->AmbientSize());
 }
diff --git a/internal/ceres/gradient_problem_evaluator.h b/internal/ceres/gradient_problem_evaluator.h
index a510b25..f0aba94 100644
--- a/internal/ceres/gradient_problem_evaluator.h
+++ b/internal/ceres/gradient_problem_evaluator.h
@@ -32,12 +32,14 @@
 #define CERES_INTERNAL_GRADIENT_PROBLEM_EVALUATOR_H_
 
 #include <map>
+#include <memory>
 #include <string>
 
 #include "ceres/evaluator.h"
 #include "ceres/execution_summary.h"
 #include "ceres/gradient_problem.h"
 #include "ceres/internal/port.h"
+#include "ceres/sparse_matrix.h"
 #include "ceres/wall_time.h"
 
 namespace ceres {
@@ -47,15 +49,18 @@
  public:
   explicit GradientProblemEvaluator(const GradientProblem& problem)
       : problem_(problem) {}
+
   ~GradientProblemEvaluator() override = default;
-  SparseMatrix* CreateJacobian() const final { return nullptr; }
+
+  std::unique_ptr<SparseMatrix> CreateJacobian() const final { return nullptr; }
+
   bool Evaluate(const EvaluateOptions& evaluate_options,
                 const double* state,
                 double* cost,
                 double* residuals,
                 double* gradient,
                 SparseMatrix* jacobian) final {
-    CHECK(jacobian == NULL);
+    CHECK(jacobian == nullptr);
     ScopedExecutionTimer total_timer("Evaluator::Total", &execution_summary_);
     // The reason we use Residual and Jacobian here even when we are
     // only computing the cost and gradient has to do with the fact
@@ -65,7 +70,7 @@
     // to be consistent across the code base for the time accounting
     // to work.
     ScopedExecutionTimer call_type_timer(
-        gradient == NULL ? "Evaluator::Residual" : "Evaluator::Jacobian",
+        gradient == nullptr ? "Evaluator::Residual" : "Evaluator::Jacobian",
         &execution_summary_);
     return problem_.Evaluate(state, cost, gradient);
   }
diff --git a/internal/ceres/gradient_problem_solver.cc b/internal/ceres/gradient_problem_solver.cc
index f754274..582895d 100644
--- a/internal/ceres/gradient_problem_solver.cc
+++ b/internal/ceres/gradient_problem_solver.cc
@@ -135,21 +135,22 @@
   // now.
   Minimizer::Options minimizer_options =
       Minimizer::Options(GradientProblemSolverOptionsToSolverOptions(options));
-  minimizer_options.evaluator.reset(new GradientProblemEvaluator(problem));
+  minimizer_options.evaluator =
+      std::make_unique<GradientProblemEvaluator>(problem);
 
   std::unique_ptr<IterationCallback> logging_callback;
   if (options.logging_type != SILENT) {
-    logging_callback.reset(
-        new LoggingCallback(LINE_SEARCH, options.minimizer_progress_to_stdout));
+    logging_callback = std::make_unique<LoggingCallback>(
+        LINE_SEARCH, options.minimizer_progress_to_stdout);
     minimizer_options.callbacks.insert(minimizer_options.callbacks.begin(),
                                        logging_callback.get());
   }
 
   std::unique_ptr<IterationCallback> state_updating_callback;
   if (options.update_state_every_iteration) {
-    state_updating_callback.reset(
-        new GradientProblemSolverStateUpdatingCallback(
-            problem.NumParameters(), solution.data(), parameters_ptr));
+    state_updating_callback =
+        std::make_unique<GradientProblemSolverStateUpdatingCallback>(
+            problem.NumParameters(), solution.data(), parameters_ptr);
     minimizer_options.callbacks.insert(minimizer_options.callbacks.begin(),
                                        state_updating_callback.get());
   }
diff --git a/internal/ceres/gradient_problem_solver_test.cc b/internal/ceres/gradient_problem_solver_test.cc
index e3b4085..5e33b31 100644
--- a/internal/ceres/gradient_problem_solver_test.cc
+++ b/internal/ceres/gradient_problem_solver_test.cc
@@ -48,7 +48,7 @@
     const double y = parameters[1];
 
     cost[0] = (1.0 - x) * (1.0 - x) + 100.0 * (y - x * x) * (y - x * x);
-    if (gradient != NULL) {
+    if (gradient != nullptr) {
       gradient[0] = -2.0 * (1.0 - x) - 200.0 * (y - x * x) * 2.0 * x;
       gradient[1] = 200.0 * (y - x * x);
     }
@@ -79,7 +79,7 @@
                 double* gradient) const final {
     const double x = parameters[0];
     *cost = 0.5 * (5.0 - x) * (5.0 - x);
-    if (gradient != NULL) {
+    if (gradient != nullptr) {
       gradient[0] = x - 5.0;
     }
 
diff --git a/internal/ceres/implicit_schur_complement.cc b/internal/ceres/implicit_schur_complement.cc
index bb2da17..4e712b9 100644
--- a/internal/ceres/implicit_schur_complement.cc
+++ b/internal/ceres/implicit_schur_complement.cc
@@ -43,7 +43,7 @@
 
 ImplicitSchurComplement::ImplicitSchurComplement(
     const LinearSolver::Options& options)
-    : options_(options), D_(NULL), b_(NULL) {}
+    : options_(options), D_(nullptr), b_(nullptr) {}
 
 ImplicitSchurComplement::~ImplicitSchurComplement() = default;
 
@@ -52,8 +52,8 @@
                                    const double* b) {
   // Since initialization is reasonably heavy, perhaps we can save on
   // constructing a new object everytime.
-  if (A_ == NULL) {
-    A_.reset(PartitionedMatrixViewBase::Create(options_, A));
+  if (A_ == nullptr) {
+    A_ = PartitionedMatrixViewBase::Create(options_, A);
   }
 
   D_ = D;
@@ -61,10 +61,10 @@
 
   // Initialize temporary storage and compute the block diagonals of
   // E'E and F'E.
-  if (block_diagonal_EtE_inverse_ == NULL) {
-    block_diagonal_EtE_inverse_.reset(A_->CreateBlockDiagonalEtE());
+  if (block_diagonal_EtE_inverse_ == nullptr) {
+    block_diagonal_EtE_inverse_ = A_->CreateBlockDiagonalEtE();
     if (options_.preconditioner_type == JACOBI) {
-      block_diagonal_FtF_inverse_.reset(A_->CreateBlockDiagonalFtF());
+      block_diagonal_FtF_inverse_ = A_->CreateBlockDiagonalFtF();
     }
     rhs_.resize(A_->num_cols_f());
     rhs_.setZero();
@@ -84,7 +84,7 @@
   // the block diagonals and invert them.
   AddDiagonalAndInvert(D_, block_diagonal_EtE_inverse_.get());
   if (options_.preconditioner_type == JACOBI) {
-    AddDiagonalAndInvert((D_ == NULL) ? NULL : D_ + A_->num_cols_e(),
+    AddDiagonalAndInvert((D_ == nullptr) ? nullptr : D_ + A_->num_cols_e(),
                          block_diagonal_FtF_inverse_.get());
   }
 
@@ -118,7 +118,7 @@
   A_->RightMultiplyE(tmp_e_cols_2_.data(), tmp_rows_.data());
 
   // y5 = D * x
-  if (D_ != NULL) {
+  if (D_ != nullptr) {
     ConstVectorRef Dref(D_ + A_->num_cols_e(), num_cols());
     VectorRef(y, num_cols()) =
         (Dref.array().square() * ConstVectorRef(x, num_cols()).array())
@@ -146,7 +146,7 @@
                 row_block_size,
                 row_block_size);
 
-    if (D != NULL) {
+    if (D != nullptr) {
       ConstVectorRef d(D + row_block_pos, row_block_size);
       m += d.array().square().matrix().asDiagonal();
     }
diff --git a/internal/ceres/implicit_schur_complement_test.cc b/internal/ceres/implicit_schur_complement_test.cc
index b6d886f..b4f618c 100644
--- a/internal/ceres/implicit_schur_complement_test.cc
+++ b/internal/ceres/implicit_schur_complement_test.cc
@@ -57,13 +57,13 @@
 class ImplicitSchurComplementTest : public ::testing::Test {
  protected:
   void SetUp() final {
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(2));
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(2);
 
     CHECK(problem != nullptr);
     A_.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
-    b_.reset(problem->b.release());
-    D_.reset(problem->D.release());
+    b_ = std::move(problem->b);
+    D_ = std::move(problem->D);
 
     num_cols_ = A_->num_cols();
     num_rows_ = A_->num_rows();
@@ -90,8 +90,8 @@
     ContextImpl context;
     options.context = &context;
 
-    std::unique_ptr<SchurEliminatorBase> eliminator(
-        SchurEliminatorBase::Create(options));
+    std::unique_ptr<SchurEliminatorBase> eliminator =
+        SchurEliminatorBase::Create(options);
     CHECK(eliminator != nullptr);
     const bool kFullRankETE = true;
     eliminator->Init(num_eliminate_blocks_, kFullRankETE, bs);
@@ -202,7 +202,7 @@
 // We do this with and without regularization to check that the
 // support for the LM diagonal is correct.
 TEST_F(ImplicitSchurComplementTest, SchurMatrixValuesTest) {
-  EXPECT_TRUE(TestImplicitSchurComplement(NULL));
+  EXPECT_TRUE(TestImplicitSchurComplement(nullptr));
   EXPECT_TRUE(TestImplicitSchurComplement(D_.get()));
 }
 
diff --git a/internal/ceres/inner_product_computer.cc b/internal/ceres/inner_product_computer.cc
index ef38b7b..1a3a1a1 100644
--- a/internal/ceres/inner_product_computer.cc
+++ b/internal/ceres/inner_product_computer.cc
@@ -44,11 +44,12 @@
 // or the lower triangular part of the product.
 //
 // num_nonzeros is the number of non-zeros in the result matrix.
-CompressedRowSparseMatrix* InnerProductComputer::CreateResultMatrix(
+std::unique_ptr<CompressedRowSparseMatrix>
+InnerProductComputer::CreateResultMatrix(
     const CompressedRowSparseMatrix::StorageType storage_type,
     const int num_nonzeros) {
-  CompressedRowSparseMatrix* matrix =
-      new CompressedRowSparseMatrix(m_.num_cols(), m_.num_cols(), num_nonzeros);
+  auto matrix = std::make_unique<CompressedRowSparseMatrix>(
+      m_.num_cols(), m_.num_cols(), num_nonzeros);
   matrix->set_storage_type(storage_type);
 
   const CompressedRowBlockStructure* bs = m_.block_structure();
@@ -116,14 +117,14 @@
 //
 // product_storage_type controls the form of the output matrix. It
 // can be LOWER_TRIANGULAR or UPPER_TRIANGULAR.
-InnerProductComputer* InnerProductComputer::Create(
+std::unique_ptr<InnerProductComputer> InnerProductComputer::Create(
     const BlockSparseMatrix& m,
     CompressedRowSparseMatrix::StorageType product_storage_type) {
   return InnerProductComputer::Create(
       m, 0, m.block_structure()->rows.size(), product_storage_type);
 }
 
-InnerProductComputer* InnerProductComputer::Create(
+std::unique_ptr<InnerProductComputer> InnerProductComputer::Create(
     const BlockSparseMatrix& m,
     const int start_row_block,
     const int end_row_block,
@@ -132,8 +133,8 @@
         product_storage_type == CompressedRowSparseMatrix::UPPER_TRIANGULAR);
   CHECK_GT(m.num_nonzeros(), 0)
       << "Congratulations, you found a bug in Ceres. Please report it.";
-  InnerProductComputer* inner_product_computer =
-      new InnerProductComputer(m, start_row_block, end_row_block);
+  std::unique_ptr<InnerProductComputer> inner_product_computer(
+      new InnerProductComputer(m, start_row_block, end_row_block));
   inner_product_computer->Init(product_storage_type);
   return inner_product_computer;
 }
@@ -183,7 +184,7 @@
   std::vector<int> row_block_nnz;
   const int num_nonzeros = ComputeNonzeros(product_terms, &row_block_nnz);
 
-  result_.reset(CreateResultMatrix(product_storage_type, num_nonzeros));
+  result_ = CreateResultMatrix(product_storage_type, num_nonzeros);
 
   // Populate the row non-zero counts in the result matrix.
   int* crsm_rows = result_->mutable_rows();
diff --git a/internal/ceres/inner_product_computer.h b/internal/ceres/inner_product_computer.h
index 04ec1d1..abf81be 100644
--- a/internal/ceres/inner_product_computer.h
+++ b/internal/ceres/inner_product_computer.h
@@ -74,7 +74,7 @@
   //
   // The user must ensure that the matrix m is valid for the life time
   // of this object.
-  static InnerProductComputer* Create(
+  static std::unique_ptr<InnerProductComputer> Create(
       const BlockSparseMatrix& m,
       CompressedRowSparseMatrix::StorageType storage_type);
 
@@ -83,7 +83,7 @@
   //
   // a = m(start_row_block : end_row_block, :);
   // result = a' * a;
-  static InnerProductComputer* Create(
+  static std::unique_ptr<InnerProductComputer> Create(
       const BlockSparseMatrix& m,
       int start_row_block,
       int end_row_block,
@@ -127,7 +127,7 @@
 
   void Init(CompressedRowSparseMatrix::StorageType storage_type);
 
-  CompressedRowSparseMatrix* CreateResultMatrix(
+  std::unique_ptr<CompressedRowSparseMatrix> CreateResultMatrix(
       const CompressedRowSparseMatrix::StorageType storage_type,
       int num_nonzeros);
 
diff --git a/internal/ceres/inner_product_computer_test.cc b/internal/ceres/inner_product_computer_test.cc
index f65c8a3..b672f8c 100644
--- a/internal/ceres/inner_product_computer_test.cc
+++ b/internal/ceres/inner_product_computer_test.cc
@@ -128,11 +128,11 @@
 
         std::unique_ptr<InnerProductComputer> inner_product_computer;
 
-        inner_product_computer.reset(InnerProductComputer::Create(
-            *random_matrix, CompressedRowSparseMatrix::LOWER_TRIANGULAR));
+        inner_product_computer = InnerProductComputer::Create(
+            *random_matrix, CompressedRowSparseMatrix::LOWER_TRIANGULAR);
         COMPUTE_AND_COMPARE;
-        inner_product_computer.reset(InnerProductComputer::Create(
-            *random_matrix, CompressedRowSparseMatrix::UPPER_TRIANGULAR));
+        inner_product_computer = InnerProductComputer::Create(
+            *random_matrix, CompressedRowSparseMatrix::UPPER_TRIANGULAR);
         COMPUTE_AND_COMPARE;
       }
     }
@@ -202,17 +202,17 @@
             eigen_random_matrix.transpose() * eigen_random_matrix;
 
         std::unique_ptr<InnerProductComputer> inner_product_computer;
-        inner_product_computer.reset(InnerProductComputer::Create(
+        inner_product_computer = InnerProductComputer::Create(
             *random_matrix,
             start_row_block,
             end_row_block,
-            CompressedRowSparseMatrix::LOWER_TRIANGULAR));
+            CompressedRowSparseMatrix::LOWER_TRIANGULAR);
         COMPUTE_AND_COMPARE;
-        inner_product_computer.reset(InnerProductComputer::Create(
+        inner_product_computer = InnerProductComputer::Create(
             *random_matrix,
             start_row_block,
             end_row_block,
-            CompressedRowSparseMatrix::UPPER_TRIANGULAR));
+            CompressedRowSparseMatrix::UPPER_TRIANGULAR);
         COMPUTE_AND_COMPARE;
       }
     }
diff --git a/internal/ceres/is_close.h b/internal/ceres/is_close.h
index b781a44..82dc7e9 100644
--- a/internal/ceres/is_close.h
+++ b/internal/ceres/is_close.h
@@ -39,7 +39,7 @@
 namespace internal {
 // Returns true if x and y have a relative (unsigned) difference less than
 // relative_precision and false otherwise. Stores the relative and absolute
-// difference in relative/absolute_error if non-NULL. If one of the two values
+// difference in relative/absolute_error if non-nullptr. If one of the two values
 // is exactly zero, the absolute difference will be compared, and relative_error
 // will be set to the absolute difference.
 CERES_EXPORT_INTERNAL bool IsClose(double x,
diff --git a/internal/ceres/iterative_schur_complement_solver.cc b/internal/ceres/iterative_schur_complement_solver.cc
index e6340df..6ff84b5 100644
--- a/internal/ceres/iterative_schur_complement_solver.cc
+++ b/internal/ceres/iterative_schur_complement_solver.cc
@@ -69,13 +69,13 @@
   CHECK(A->block_structure() != nullptr);
   const int num_eliminate_blocks = options_.elimination_groups[0];
   // Initialize a ImplicitSchurComplement object.
-  if (schur_complement_ == NULL) {
+  if (schur_complement_ == nullptr) {
     DetectStructure(*(A->block_structure()),
                     num_eliminate_blocks,
                     &options_.row_block_size,
                     &options_.e_block_size,
                     &options_.f_block_size);
-    schur_complement_.reset(new ImplicitSchurComplement(options_));
+    schur_complement_ = std::make_unique<ImplicitSchurComplement>(options_);
   }
   schur_complement_->Init(*A, per_solve_options.D, b);
 
@@ -86,7 +86,7 @@
     LinearSolver::Summary summary;
     summary.num_iterations = 0;
     summary.termination_type = LINEAR_SOLVER_SUCCESS;
-    schur_complement_->BackSubstitute(NULL, x);
+    schur_complement_->BackSubstitute(nullptr, x);
     return summary;
   }
 
@@ -104,7 +104,7 @@
   cg_per_solve_options.q_tolerance = per_solve_options.q_tolerance;
 
   CreatePreconditioner(A);
-  if (preconditioner_.get() != NULL) {
+  if (preconditioner_.get() != nullptr) {
     if (!preconditioner_->Update(*A, per_solve_options.D)) {
       LinearSolver::Summary summary;
       summary.num_iterations = 0;
@@ -134,7 +134,7 @@
 void IterativeSchurComplementSolver::CreatePreconditioner(
     BlockSparseMatrix* A) {
   if (options_.preconditioner_type == IDENTITY ||
-      preconditioner_.get() != NULL) {
+      preconditioner_.get() != nullptr) {
     return;
   }
 
@@ -149,22 +149,22 @@
   preconditioner_options.e_block_size = options_.e_block_size;
   preconditioner_options.f_block_size = options_.f_block_size;
   preconditioner_options.elimination_groups = options_.elimination_groups;
-  CHECK(options_.context != NULL);
+  CHECK(options_.context != nullptr);
   preconditioner_options.context = options_.context;
 
   switch (options_.preconditioner_type) {
     case JACOBI:
-      preconditioner_.reset(new SparseMatrixPreconditionerWrapper(
-          schur_complement_->block_diagonal_FtF_inverse()));
+      preconditioner_ = std::make_unique<SparseMatrixPreconditionerWrapper>(
+          schur_complement_->block_diagonal_FtF_inverse());
       break;
     case SCHUR_JACOBI:
-      preconditioner_.reset(new SchurJacobiPreconditioner(
-          *A->block_structure(), preconditioner_options));
+      preconditioner_ = std::make_unique<SchurJacobiPreconditioner>(
+          *A->block_structure(), preconditioner_options);
       break;
     case CLUSTER_JACOBI:
     case CLUSTER_TRIDIAGONAL:
-      preconditioner_.reset(new VisibilityBasedPreconditioner(
-          *A->block_structure(), preconditioner_options));
+      preconditioner_ = std::make_unique<VisibilityBasedPreconditioner>(
+          *A->block_structure(), preconditioner_options);
       break;
     default:
       LOG(FATAL) << "Unknown Preconditioner Type";
diff --git a/internal/ceres/iterative_schur_complement_solver_test.cc b/internal/ceres/iterative_schur_complement_solver_test.cc
index fdd65c7..80e388a 100644
--- a/internal/ceres/iterative_schur_complement_solver_test.cc
+++ b/internal/ceres/iterative_schur_complement_solver_test.cc
@@ -61,13 +61,13 @@
 class IterativeSchurComplementSolverTest : public ::testing::Test {
  protected:
   void SetUpProblem(int problem_id) {
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(problem_id));
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(problem_id);
 
     CHECK(problem != nullptr);
     A_.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
-    b_.reset(problem->b.release());
-    D_.reset(problem->D.release());
+    b_ = std::move(problem->b);
+    D_ = std::move(problem->D);
 
     num_cols_ = A_->num_cols();
     num_rows_ = A_->num_rows();
@@ -121,13 +121,13 @@
 
 TEST_F(IterativeSchurComplementSolverTest, NormalProblem) {
   SetUpProblem(2);
-  EXPECT_TRUE(TestSolver(NULL));
+  EXPECT_TRUE(TestSolver(nullptr));
   EXPECT_TRUE(TestSolver(D_.get()));
 }
 
 TEST_F(IterativeSchurComplementSolverTest, ProblemWithNoFBlocks) {
   SetUpProblem(3);
-  EXPECT_TRUE(TestSolver(NULL));
+  EXPECT_TRUE(TestSolver(nullptr));
   EXPECT_TRUE(TestSolver(D_.get()));
 }
 
diff --git a/internal/ceres/levenberg_marquardt_strategy_test.cc b/internal/ceres/levenberg_marquardt_strategy_test.cc
index c05dad1..dfb7302 100644
--- a/internal/ceres/levenberg_marquardt_strategy_test.cc
+++ b/internal/ceres/levenberg_marquardt_strategy_test.cc
@@ -87,7 +87,7 @@
 
   // We need a non-null pointer here, so anything should do.
   std::unique_ptr<LinearSolver> linear_solver(
-      new RegularizationCheckingLinearSolver(0, NULL));
+      new RegularizationCheckingLinearSolver(0, nullptr));
   options.linear_solver = linear_solver.get();
 
   LevenbergMarquardtStrategy lms(options);
diff --git a/internal/ceres/line_search.cc b/internal/ceres/line_search.cc
index 7e871a2..0141015 100644
--- a/internal/ceres/line_search.cc
+++ b/internal/ceres/line_search.cc
@@ -68,24 +68,21 @@
 LineSearch::LineSearch(const LineSearch::Options& options)
     : options_(options) {}
 
-LineSearch* LineSearch::Create(const LineSearchType line_search_type,
-                               const LineSearch::Options& options,
-                               string* error) {
-  LineSearch* line_search = NULL;
+std::unique_ptr<LineSearch> LineSearch::Create(
+    const LineSearchType line_search_type,
+    const LineSearch::Options& options,
+    string* error) {
   switch (line_search_type) {
     case ceres::ARMIJO:
-      line_search = new ArmijoLineSearch(options);
-      break;
+      return std::make_unique<ArmijoLineSearch>(options);
     case ceres::WOLFE:
-      line_search = new WolfeLineSearch(options);
-      break;
+      return std::make_unique<WolfeLineSearch>(options);
     default:
       *error = string("Invalid line search algorithm type: ") +
                LineSearchTypeToString(line_search_type) +
                string(", unable to create line search.");
-      return NULL;
   }
-  return line_search;
+  return nullptr;
 }
 
 LineSearchFunction::LineSearchFunction(Evaluator* evaluator)
@@ -119,13 +116,13 @@
   }
   output->vector_x_is_valid = true;
 
-  double* gradient = NULL;
+  double* gradient = nullptr;
   if (evaluate_gradient) {
     output->vector_gradient.resize(direction_.rows(), 1);
     gradient = output->vector_gradient.data();
   }
   const bool eval_status = evaluator_->Evaluate(
-      output->vector_x.data(), &(output->value), NULL, gradient, NULL);
+      output->vector_x.data(), &(output->value), nullptr, gradient, nullptr);
 
   if (!eval_status || !std::isfinite(output->value)) {
     return;
diff --git a/internal/ceres/line_search.h b/internal/ceres/line_search.h
index 0af4884..7d1a852 100644
--- a/internal/ceres/line_search.h
+++ b/internal/ceres/line_search.h
@@ -163,9 +163,10 @@
   explicit LineSearch(const LineSearch::Options& options);
   virtual ~LineSearch() = default;
 
-  static LineSearch* Create(const LineSearchType line_search_type,
-                            const LineSearch::Options& options,
-                            std::string* error);
+  static std::unique_ptr<LineSearch> Create(
+      const LineSearchType line_search_type,
+      const LineSearch::Options& options,
+      std::string* error);
 
   // Perform the line search.
   //
diff --git a/internal/ceres/line_search_direction.cc b/internal/ceres/line_search_direction.cc
index 2b707fb..4d6e641 100644
--- a/internal/ceres/line_search_direction.cc
+++ b/internal/ceres/line_search_direction.cc
@@ -338,32 +338,32 @@
   bool is_positive_definite_;
 };
 
-LineSearchDirection* LineSearchDirection::Create(
+std::unique_ptr<LineSearchDirection> LineSearchDirection::Create(
     const LineSearchDirection::Options& options) {
   if (options.type == STEEPEST_DESCENT) {
-    return new SteepestDescent;
+    return std::make_unique<SteepestDescent>();
   }
 
   if (options.type == NONLINEAR_CONJUGATE_GRADIENT) {
-    return new NonlinearConjugateGradient(
+    return std::make_unique<NonlinearConjugateGradient>(
         options.nonlinear_conjugate_gradient_type, options.function_tolerance);
   }
 
   if (options.type == ceres::LBFGS) {
-    return new ceres::internal::LBFGS(
+    return std::make_unique<ceres::internal::LBFGS>(
         options.num_parameters,
         options.max_lbfgs_rank,
         options.use_approximate_eigenvalue_bfgs_scaling);
   }
 
   if (options.type == ceres::BFGS) {
-    return new ceres::internal::BFGS(
+    return std::make_unique<ceres::internal::BFGS>(
         options.num_parameters,
         options.use_approximate_eigenvalue_bfgs_scaling);
   }
 
   LOG(ERROR) << "Unknown line search direction type: " << options.type;
-  return NULL;
+  return nullptr;
 }
 
 }  // namespace internal
diff --git a/internal/ceres/line_search_direction.h b/internal/ceres/line_search_direction.h
index e8b1139..29127c1 100644
--- a/internal/ceres/line_search_direction.h
+++ b/internal/ceres/line_search_direction.h
@@ -57,7 +57,7 @@
     bool use_approximate_eigenvalue_bfgs_scaling;
   };
 
-  static LineSearchDirection* Create(const Options& options);
+  static std::unique_ptr<LineSearchDirection> Create(const Options& options);
 
   virtual ~LineSearchDirection() = default;
   virtual bool NextDirection(const LineSearchMinimizer::State& previous,
diff --git a/internal/ceres/line_search_minimizer.cc b/internal/ceres/line_search_minimizer.cc
index ea1c507..6768d4b 100644
--- a/internal/ceres/line_search_minimizer.cc
+++ b/internal/ceres/line_search_minimizer.cc
@@ -171,8 +171,8 @@
   line_search_direction_options.max_lbfgs_rank = options.max_lbfgs_rank;
   line_search_direction_options.use_approximate_eigenvalue_bfgs_scaling =
       options.use_approximate_eigenvalue_bfgs_scaling;
-  std::unique_ptr<LineSearchDirection> line_search_direction(
-      LineSearchDirection::Create(line_search_direction_options));
+  std::unique_ptr<LineSearchDirection> line_search_direction =
+      LineSearchDirection::Create(line_search_direction_options);
 
   LineSearchFunction line_search_function(evaluator);
 
@@ -280,8 +280,8 @@
                      << options.max_num_line_search_direction_restarts
                      << " [max].";
       }
-      line_search_direction.reset(
-          LineSearchDirection::Create(line_search_direction_options));
+      line_search_direction =
+          LineSearchDirection::Create(line_search_direction_options);
       current_state.search_direction = -current_state.gradient;
     }
 
diff --git a/internal/ceres/line_search_minimizer_test.cc b/internal/ceres/line_search_minimizer_test.cc
index 2ef27b9..76a4a47 100644
--- a/internal/ceres/line_search_minimizer_test.cc
+++ b/internal/ceres/line_search_minimizer_test.cc
@@ -44,7 +44,7 @@
                 double* cost,
                 double* gradient) const final {
     cost[0] = parameters[0] * parameters[0];
-    if (gradient != NULL) {
+    if (gradient != nullptr) {
       gradient[0] = 2.0 * parameters[0];
     }
     return true;
diff --git a/internal/ceres/line_search_preprocessor.cc b/internal/ceres/line_search_preprocessor.cc
index 465d9a4..02a1a8c 100644
--- a/internal/ceres/line_search_preprocessor.cc
+++ b/internal/ceres/line_search_preprocessor.cc
@@ -63,9 +63,9 @@
   pp->evaluator_options.context = pp->problem->context();
   pp->evaluator_options.evaluation_callback =
       pp->reduced_program->mutable_evaluation_callback();
-  pp->evaluator.reset(Evaluator::Create(
-      pp->evaluator_options, pp->reduced_program.get(), &pp->error));
-  return (pp->evaluator.get() != NULL);
+  pp->evaluator = Evaluator::Create(
+      pp->evaluator_options, pp->reduced_program.get(), &pp->error);
+  return (pp->evaluator.get() != nullptr);
 }
 
 }  // namespace
@@ -85,10 +85,10 @@
     return false;
   }
 
-  pp->reduced_program.reset(program->CreateReducedProgram(
-      &pp->removed_parameter_blocks, &pp->fixed_cost, &pp->error));
+  pp->reduced_program = program->CreateReducedProgram(
+      &pp->removed_parameter_blocks, &pp->fixed_cost, &pp->error);
 
-  if (pp->reduced_program.get() == NULL) {
+  if (pp->reduced_program.get() == nullptr) {
     return false;
   }
 
diff --git a/internal/ceres/line_search_preprocessor_test.cc b/internal/ceres/line_search_preprocessor_test.cc
index b64946c..90cca10 100644
--- a/internal/ceres/line_search_preprocessor_test.cc
+++ b/internal/ceres/line_search_preprocessor_test.cc
@@ -85,7 +85,7 @@
 TEST(LineSearchPreprocessor, RemoveParameterBlocksFailed) {
   ProblemImpl problem;
   double x = 3.0;
-  problem.AddResidualBlock(new FailingCostFunction, NULL, &x);
+  problem.AddResidualBlock(new FailingCostFunction, nullptr, &x);
   problem.SetParameterBlockConstant(&x);
   Solver::Options options;
   options.minimizer_type = LINE_SEARCH;
@@ -121,8 +121,8 @@
   double x = 1.0;
   double y = 1.0;
   double z = 1.0;
-  problem.AddResidualBlock(new DummyCostFunction<1, 1, 1>, NULL, &x, &y);
-  problem.AddResidualBlock(new DummyCostFunction<1, 1, 1>, NULL, &y, &z);
+  problem.AddResidualBlock(new DummyCostFunction<1, 1, 1>, nullptr, &x, &y);
+  problem.AddResidualBlock(new DummyCostFunction<1, 1, 1>, nullptr, &y, &z);
 
   Solver::Options options;
   options.minimizer_type = LINE_SEARCH;
@@ -131,7 +131,7 @@
   PreprocessedProblem pp;
   EXPECT_TRUE(preprocessor.Preprocess(options, &problem, &pp));
   EXPECT_EQ(pp.evaluator_options.linear_solver_type, CGNR);
-  EXPECT_TRUE(pp.evaluator.get() != NULL);
+  EXPECT_TRUE(pp.evaluator.get() != nullptr);
 }
 
 }  // namespace internal
diff --git a/internal/ceres/linear_least_squares_problems.cc b/internal/ceres/linear_least_squares_problems.cc
index 73787d6..4b37e00 100644
--- a/internal/ceres/linear_least_squares_problems.cc
+++ b/internal/ceres/linear_least_squares_problems.cc
@@ -49,7 +49,8 @@
 
 using std::string;
 
-LinearLeastSquaresProblem* CreateLinearLeastSquaresProblemFromId(int id) {
+std::unique_ptr<LinearLeastSquaresProblem>
+CreateLinearLeastSquaresProblemFromId(int id) {
   switch (id) {
     case 0:
       return LinearLeastSquaresProblem0();
@@ -64,7 +65,7 @@
     default:
       LOG(FATAL) << "Unknown problem id requested " << id;
   }
-  return NULL;
+  return nullptr;
 }
 
 /*
@@ -85,15 +86,16 @@
 x_D = [1.78448275;
        2.82327586;]
  */
-LinearLeastSquaresProblem* LinearLeastSquaresProblem0() {
-  LinearLeastSquaresProblem* problem = new LinearLeastSquaresProblem;
+std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem0() {
+  std::unique_ptr<LinearLeastSquaresProblem> problem =
+      std::make_unique<LinearLeastSquaresProblem>();
 
-  TripletSparseMatrix* A = new TripletSparseMatrix(3, 2, 6);
-  problem->b.reset(new double[3]);
-  problem->D.reset(new double[2]);
+  auto A = std::make_unique<TripletSparseMatrix>(3, 2, 6);
+  problem->b = std::make_unique<double[]>(3);
+  problem->D = std::make_unique<double[]>(2);
 
-  problem->x.reset(new double[2]);
-  problem->x_D.reset(new double[2]);
+  problem->x = std::make_unique<double[]>(2);
+  problem->x_D = std::make_unique<double[]>(2);
 
   int* Ai = A->mutable_rows();
   int* Aj = A->mutable_cols();
@@ -115,7 +117,7 @@
   Ax[4] = 6;
   Ax[5] = -10;
   A->set_num_nonzeros(6);
-  problem->A.reset(A);
+  problem->A = std::move(A);
 
   problem->b[0] = 8;
   problem->b[1] = 18;
@@ -181,15 +183,16 @@
 // BlockSparseMatrix version of this problem.
 
 // TripletSparseMatrix version.
-LinearLeastSquaresProblem* LinearLeastSquaresProblem1() {
+std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem1() {
   int num_rows = 6;
   int num_cols = 5;
 
-  LinearLeastSquaresProblem* problem = new LinearLeastSquaresProblem;
-  TripletSparseMatrix* A =
-      new TripletSparseMatrix(num_rows, num_cols, num_rows * num_cols);
-  problem->b.reset(new double[num_rows]);
-  problem->D.reset(new double[num_cols]);
+  std::unique_ptr<LinearLeastSquaresProblem> problem =
+      std::make_unique<LinearLeastSquaresProblem>();
+  auto A = std::make_unique<TripletSparseMatrix>(
+      num_rows, num_cols, num_rows * num_cols);
+  problem->b = std::make_unique<double[]>(num_rows);
+  problem->D = std::make_unique<double[]>(num_cols);
   problem->num_eliminate_blocks = 2;
 
   int* rows = A->mutable_rows();
@@ -271,7 +274,7 @@
   A->set_num_nonzeros(nnz);
   CHECK(A->IsValid());
 
-  problem->A.reset(A);
+  problem->A = std::move(A);
 
   for (int i = 0; i < num_cols; ++i) {
     problem->D.get()[i] = 1;
@@ -285,18 +288,20 @@
 }
 
 // BlockSparseMatrix version
-LinearLeastSquaresProblem* LinearLeastSquaresProblem2() {
+std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem2() {
   int num_rows = 6;
   int num_cols = 5;
 
-  LinearLeastSquaresProblem* problem = new LinearLeastSquaresProblem;
+  std::unique_ptr<LinearLeastSquaresProblem> problem =
+      std::make_unique<LinearLeastSquaresProblem>();
 
-  problem->b.reset(new double[num_rows]);
-  problem->D.reset(new double[num_cols]);
+  problem->b = std::make_unique<double[]>(num_rows);
+  problem->D = std::make_unique<double[]>(num_cols);
   problem->num_eliminate_blocks = 2;
 
   CompressedRowBlockStructure* bs = new CompressedRowBlockStructure;
-  std::unique_ptr<double[]> values(new double[num_rows * num_cols]);
+  std::unique_ptr<double[]> values =
+      std::make_unique<double[]>(num_rows * num_cols);
 
   for (int c = 0; c < num_cols; ++c) {
     bs->cols.push_back(Block());
@@ -386,7 +391,7 @@
     row.cells.push_back(Cell(4, 12));
   }
 
-  BlockSparseMatrix* A = new BlockSparseMatrix(bs);
+  auto A = std::make_unique<BlockSparseMatrix>(bs);
   memcpy(A->mutable_values(), values.get(), nnz * sizeof(*A->values()));
 
   for (int i = 0; i < num_cols; ++i) {
@@ -397,7 +402,7 @@
     problem->b.get()[i] = i;
   }
 
-  problem->A.reset(A);
+  problem->A = std::move(A);
 
   return problem;
 }
@@ -418,18 +423,20 @@
            5]
 */
 // BlockSparseMatrix version
-LinearLeastSquaresProblem* LinearLeastSquaresProblem3() {
+std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem3() {
   int num_rows = 5;
   int num_cols = 2;
 
-  LinearLeastSquaresProblem* problem = new LinearLeastSquaresProblem;
+  std::unique_ptr<LinearLeastSquaresProblem> problem =
+      std::make_unique<LinearLeastSquaresProblem>();
 
-  problem->b.reset(new double[num_rows]);
-  problem->D.reset(new double[num_cols]);
+  problem->b = std::make_unique<double[]>(num_rows);
+  problem->D = std::make_unique<double[]>(num_cols);
   problem->num_eliminate_blocks = 2;
 
   CompressedRowBlockStructure* bs = new CompressedRowBlockStructure;
-  std::unique_ptr<double[]> values(new double[num_rows * num_cols]);
+  std::unique_ptr<double[]> values =
+      std::make_unique<double[]>(num_rows * num_cols);
 
   for (int c = 0; c < num_cols; ++c) {
     bs->cols.push_back(Block());
@@ -489,7 +496,7 @@
     row.cells.push_back(Cell(1, 4));
   }
 
-  BlockSparseMatrix* A = new BlockSparseMatrix(bs);
+  auto A = std::make_unique<BlockSparseMatrix>(bs);
   memcpy(A->mutable_values(), values.get(), nnz * sizeof(*A->values()));
 
   for (int i = 0; i < num_cols; ++i) {
@@ -500,7 +507,7 @@
     problem->b.get()[i] = i;
   }
 
-  problem->A.reset(A);
+  problem->A = std::move(A);
 
   return problem;
 }
@@ -525,18 +532,20 @@
 //
 // NOTE: This problem is too small and rank deficient to be solved without
 // the diagonal regularization.
-LinearLeastSquaresProblem* LinearLeastSquaresProblem4() {
+std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem4() {
   int num_rows = 3;
   int num_cols = 7;
 
-  LinearLeastSquaresProblem* problem = new LinearLeastSquaresProblem;
+  std::unique_ptr<LinearLeastSquaresProblem> problem =
+      std::make_unique<LinearLeastSquaresProblem>();
 
-  problem->b.reset(new double[num_rows]);
-  problem->D.reset(new double[num_cols]);
+  problem->b = std::make_unique<double[]>(num_rows);
+  problem->D = std::make_unique<double[]>(num_cols);
   problem->num_eliminate_blocks = 1;
 
   CompressedRowBlockStructure* bs = new CompressedRowBlockStructure;
-  std::unique_ptr<double[]> values(new double[num_rows * num_cols]);
+  std::unique_ptr<double[]> values =
+      std::make_unique<double[]>(num_rows * num_cols);
 
   // Column block structure
   bs->cols.push_back(Block());
@@ -590,7 +599,7 @@
     values[nnz++] = 1;
   }
 
-  BlockSparseMatrix* A = new BlockSparseMatrix(bs);
+  auto A = std::make_unique<BlockSparseMatrix>(bs);
   memcpy(A->mutable_values(), values.get(), nnz * sizeof(*A->values()));
 
   for (int i = 0; i < num_cols; ++i) {
@@ -601,7 +610,7 @@
     problem->b.get()[i] = i;
   }
 
-  problem->A.reset(A);
+  problem->A = std::move(A);
   return problem;
 }
 
@@ -616,15 +625,15 @@
   A->ToDenseMatrix(&AA);
   LOG(INFO) << "A^T: \n" << AA.transpose();
 
-  if (D != NULL) {
+  if (D != nullptr) {
     LOG(INFO) << "A's appended diagonal:\n" << ConstVectorRef(D, A->num_cols());
   }
 
-  if (b != NULL) {
+  if (b != nullptr) {
     LOG(INFO) << "b: \n" << ConstVectorRef(b, A->num_rows());
   }
 
-  if (x != NULL) {
+  if (x != nullptr) {
     LOG(INFO) << "x: \n" << ConstVectorRef(x, A->num_cols());
   }
   return true;
@@ -673,21 +682,21 @@
         A->num_cols());
   }
 
-  if (D != NULL) {
+  if (D != nullptr) {
     string filename = filename_base + "_D.txt";
     WriteArrayToFileOrDie(filename, D, A->num_cols());
     StringAppendF(
         &matlab_script, "lsqp.D = load('%s', '-ascii');\n", filename.c_str());
   }
 
-  if (b != NULL) {
+  if (b != nullptr) {
     string filename = filename_base + "_b.txt";
     WriteArrayToFileOrDie(filename, b, A->num_rows());
     StringAppendF(
         &matlab_script, "lsqp.b = load('%s', '-ascii');\n", filename.c_str());
   }
 
-  if (x != NULL) {
+  if (x != nullptr) {
     string filename = filename_base + "_x.txt";
     WriteArrayToFileOrDie(filename, x, A->num_cols());
     StringAppendF(
diff --git a/internal/ceres/linear_least_squares_problems.h b/internal/ceres/linear_least_squares_problems.h
index cddaa9f..2120cc2 100644
--- a/internal/ceres/linear_least_squares_problems.h
+++ b/internal/ceres/linear_least_squares_problems.h
@@ -60,14 +60,14 @@
 };
 
 // Factories for linear least squares problem.
-CERES_EXPORT_INTERNAL LinearLeastSquaresProblem*
+CERES_EXPORT_INTERNAL std::unique_ptr<LinearLeastSquaresProblem>
 CreateLinearLeastSquaresProblemFromId(int id);
 
-LinearLeastSquaresProblem* LinearLeastSquaresProblem0();
-LinearLeastSquaresProblem* LinearLeastSquaresProblem1();
-LinearLeastSquaresProblem* LinearLeastSquaresProblem2();
-LinearLeastSquaresProblem* LinearLeastSquaresProblem3();
-LinearLeastSquaresProblem* LinearLeastSquaresProblem4();
+std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem0();
+std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem1();
+std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem2();
+std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem3();
+std::unique_ptr<LinearLeastSquaresProblem> LinearLeastSquaresProblem4();
 
 // Write the linear least squares problem to disk. The exact format
 // depends on dump_format_type.
diff --git a/internal/ceres/linear_solver.cc b/internal/ceres/linear_solver.cc
index befaa14..cf358bd 100644
--- a/internal/ceres/linear_solver.cc
+++ b/internal/ceres/linear_solver.cc
@@ -69,50 +69,51 @@
   return linear_solver_type;
 }
 
-LinearSolver* LinearSolver::Create(const LinearSolver::Options& options) {
-  CHECK(options.context != NULL);
+std::unique_ptr<LinearSolver> LinearSolver::Create(
+    const LinearSolver::Options& options) {
+  CHECK(options.context != nullptr);
 
   switch (options.type) {
     case CGNR:
-      return new CgnrSolver(options);
+      return std::make_unique<CgnrSolver>(options);
 
     case SPARSE_NORMAL_CHOLESKY:
 #if defined(CERES_NO_SPARSE)
-      return NULL;
+      return nullptr;
 #else
       if (options.dynamic_sparsity) {
-        return new DynamicSparseNormalCholeskySolver(options);
+        return std::make_unique<DynamicSparseNormalCholeskySolver>(options);
       }
 
-      return new SparseNormalCholeskySolver(options);
+      return std::make_unique<SparseNormalCholeskySolver>(options);
 #endif
 
     case SPARSE_SCHUR:
 #if defined(CERES_NO_SPARSE)
-      return NULL;
+      return nullptr;
 #else
-      return new SparseSchurComplementSolver(options);
+      return std::make_unique<SparseSchurComplementSolver>(options);
 #endif
 
     case DENSE_SCHUR:
-      return new DenseSchurComplementSolver(options);
+      return std::make_unique<DenseSchurComplementSolver>(options);
 
     case ITERATIVE_SCHUR:
       if (options.use_explicit_schur_complement) {
-        return new SparseSchurComplementSolver(options);
+        return std::make_unique<SparseSchurComplementSolver>(options);
       } else {
-        return new IterativeSchurComplementSolver(options);
+        return std::make_unique<IterativeSchurComplementSolver>(options);
       }
 
     case DENSE_QR:
-      return new DenseQRSolver(options);
+      return std::make_unique<DenseQRSolver>(options);
 
     case DENSE_NORMAL_CHOLESKY:
-      return new DenseNormalCholeskySolver(options);
+      return std::make_unique<DenseNormalCholeskySolver>(options);
 
     default:
       LOG(FATAL) << "Unknown linear solver type :" << options.type;
-      return NULL;  // MSVC doesn't understand that LOG(FATAL) never returns.
+      return nullptr;  // MSVC doesn't understand that LOG(FATAL) never returns.
   }
 }
 
diff --git a/internal/ceres/linear_solver.h b/internal/ceres/linear_solver.h
index f4616cd..ea44f3b 100644
--- a/internal/ceres/linear_solver.h
+++ b/internal/ceres/linear_solver.h
@@ -288,7 +288,7 @@
   }
 
   // Factory
-  static LinearSolver* Create(const Options& options);
+  static std::unique_ptr<LinearSolver> Create(const Options& options);
 };
 
 // This templated subclass of LinearSolver serves as a base class for
diff --git a/internal/ceres/local_parameterization_test.cc b/internal/ceres/local_parameterization_test.cc
index 2321ce7..cb2ad74 100644
--- a/internal/ceres/local_parameterization_test.cc
+++ b/internal/ceres/local_parameterization_test.cc
@@ -283,7 +283,7 @@
   double jacobian_ref[12];
   double zero_delta[kLocalSize] = {0.0, 0.0, 0.0};
   const double* parameters[2] = {x, zero_delta};
-  double* jacobian_array[2] = {NULL, jacobian_ref};
+  double* jacobian_array[2] = {nullptr, jacobian_ref};
 
   // Autodiff jacobian at delta_x = 0.
   internal::AutoDifferentiate<kGlobalSize,
@@ -779,27 +779,27 @@
     const int global_size1 = 5;
     std::vector<int> constant_parameters1;
     constant_parameters1.push_back(2);
-    param1_.reset(
-        new SubsetParameterization(global_size1, constant_parameters1));
+    param1_ = std::make_unique<SubsetParameterization>(global_size1,
+                                                       constant_parameters1);
 
     const int global_size2 = 3;
     std::vector<int> constant_parameters2;
     constant_parameters2.push_back(0);
     constant_parameters2.push_back(1);
-    param2_.reset(
-        new SubsetParameterization(global_size2, constant_parameters2));
+    param2_ = std::make_unique<SubsetParameterization>(global_size2,
+                                                       constant_parameters2);
 
     const int global_size3 = 4;
     std::vector<int> constant_parameters3;
     constant_parameters3.push_back(1);
-    param3_.reset(
-        new SubsetParameterization(global_size3, constant_parameters3));
+    param3_ = std::make_unique<SubsetParameterization>(global_size3,
+                                                       constant_parameters3);
 
     const int global_size4 = 2;
     std::vector<int> constant_parameters4;
     constant_parameters4.push_back(1);
-    param4_.reset(
-        new SubsetParameterization(global_size4, constant_parameters4));
+    param4_ = std::make_unique<SubsetParameterization>(global_size4,
+                                                       constant_parameters4);
   }
 
   std::unique_ptr<LocalParameterization> param1_;
diff --git a/internal/ceres/loss_function.cc b/internal/ceres/loss_function.cc
index 353f29a..f4ea0f7 100644
--- a/internal/ceres/loss_function.cc
+++ b/internal/ceres/loss_function.cc
@@ -161,7 +161,7 @@
 }
 
 void ScaledLoss::Evaluate(double s, double rho[3]) const {
-  if (rho_.get() == NULL) {
+  if (rho_.get() == nullptr) {
     rho[0] = a_ * s;
     rho[1] = a_;
     rho[2] = 0.0;
diff --git a/internal/ceres/loss_function_test.cc b/internal/ceres/loss_function_test.cc
index 638c0c9..e5de95f 100644
--- a/internal/ceres/loss_function_test.cc
+++ b/internal/ceres/loss_function_test.cc
@@ -195,7 +195,7 @@
   // construction with the call to AssertLossFunctionIsValid() because Apple's
   // GCC is unable to eliminate the copy of ScaledLoss, which is not copyable.
   {
-    ScaledLoss scaled_loss(NULL, 6, TAKE_OWNERSHIP);
+    ScaledLoss scaled_loss(nullptr, 6, TAKE_OWNERSHIP);
     AssertLossFunctionIsValid(scaled_loss, 0.323);
   }
   {
@@ -265,17 +265,17 @@
     EXPECT_NEAR(rho[i], rho_gold[i], 1e-12);
   }
 
-  // Set to NULL
+  // Set to nullptr
   TrivialLoss loss_function4;
-  loss_function_wrapper.Reset(NULL, TAKE_OWNERSHIP);
+  loss_function_wrapper.Reset(nullptr, TAKE_OWNERSHIP);
   loss_function_wrapper.Evaluate(s, rho);
   loss_function4.Evaluate(s, rho_gold);
   for (int i = 0; i < 3; ++i) {
     EXPECT_NEAR(rho[i], rho_gold[i], 1e-12);
   }
 
-  // Set to NULL, not taking ownership
-  loss_function_wrapper.Reset(NULL, DO_NOT_TAKE_OWNERSHIP);
+  // Set to nullptr, not taking ownership
+  loss_function_wrapper.Reset(nullptr, DO_NOT_TAKE_OWNERSHIP);
   loss_function_wrapper.Evaluate(s, rho);
   loss_function4.Evaluate(s, rho_gold);
   for (int i = 0; i < 3; ++i) {
diff --git a/internal/ceres/minimizer.cc b/internal/ceres/minimizer.cc
index 8e27c7b..8562968 100644
--- a/internal/ceres/minimizer.cc
+++ b/internal/ceres/minimizer.cc
@@ -48,7 +48,7 @@
   }
 
   LOG(FATAL) << "Unknown minimizer_type: " << minimizer_type;
-  return NULL;
+  return nullptr;
 }
 
 Minimizer::~Minimizer() = default;
diff --git a/internal/ceres/normal_prior.cc b/internal/ceres/normal_prior.cc
index 4a62132..473d05c 100644
--- a/internal/ceres/normal_prior.cc
+++ b/internal/ceres/normal_prior.cc
@@ -56,7 +56,7 @@
   // r = A_ * (p - b_);
   // The extra eval is to get around a bug in the eigen library.
   r = A_ * (p - b_).eval();
-  if ((jacobians != NULL) && (jacobians[0] != NULL)) {
+  if ((jacobians != nullptr) && (jacobians[0] != nullptr)) {
     MatrixRef(jacobians[0], num_residuals(), parameter_block_sizes()[0]) = A_;
   }
   return true;
diff --git a/internal/ceres/normal_prior_test.cc b/internal/ceres/normal_prior_test.cc
index 518c18e..39a7eb6 100644
--- a/internal/ceres/normal_prior_test.cc
+++ b/internal/ceres/normal_prior_test.cc
@@ -106,7 +106,7 @@
       for (int i = 0; i < num_cols; ++i) x[i] = 2 * RandDouble() - 1;
 
       double* jacobians[1];
-      jacobians[0] = NULL;
+      jacobians[0] = nullptr;
 
       Vector residuals(num_rows);
 
@@ -118,7 +118,7 @@
           (residuals - A * (VectorRef(x, num_cols) - b)).squaredNorm();
       EXPECT_NEAR(residual_diff_norm, 0, 1e-10);
 
-      prior.Evaluate(&x, residuals.data(), NULL);
+      prior.Evaluate(&x, residuals.data(), nullptr);
       // Compare the norm of the residual
       residual_diff_norm =
           (residuals - A * (VectorRef(x, num_cols) - b)).squaredNorm();
diff --git a/internal/ceres/numeric_diff_cost_function_test.cc b/internal/ceres/numeric_diff_cost_function_test.cc
index a5f7a15..b9a0beb 100644
--- a/internal/ceres/numeric_diff_cost_function_test.cc
+++ b/internal/ceres/numeric_diff_cost_function_test.cc
@@ -49,100 +49,102 @@
 namespace internal {
 
 TEST(NumericDiffCostFunction, EasyCaseFunctorCentralDifferences) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<EasyFunctor,
-                                                  CENTRAL,
-                                                  3,  // number of residuals
-                                                  5,  // size of x1
-                                                  5   // size of x2
-                                                  >(new EasyFunctor));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<EasyFunctor,
+                                               CENTRAL,
+                                               3,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(new EasyFunctor);
   EasyFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, CENTRAL);
 }
 
 TEST(NumericDiffCostFunction, EasyCaseFunctorForwardDifferences) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<EasyFunctor,
-                                                  FORWARD,
-                                                  3,  // number of residuals
-                                                  5,  // size of x1
-                                                  5   // size of x2
-                                                  >(new EasyFunctor));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<EasyFunctor,
+                                               FORWARD,
+                                               3,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(new EasyFunctor);
   EasyFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, FORWARD);
 }
 
 TEST(NumericDiffCostFunction, EasyCaseFunctorRidders) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<EasyFunctor,
-                                                  RIDDERS,
-                                                  3,  // number of residuals
-                                                  5,  // size of x1
-                                                  5   // size of x2
-                                                  >(new EasyFunctor));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<EasyFunctor,
+                                               RIDDERS,
+                                               3,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(new EasyFunctor);
   EasyFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, RIDDERS);
 }
 
 TEST(NumericDiffCostFunction, EasyCaseCostFunctionCentralDifferences) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(
-      new NumericDiffCostFunction<EasyCostFunction,
-                                  CENTRAL,
-                                  3,  // number of residuals
-                                  5,  // size of x1
-                                  5   // size of x2
-                                  >(new EasyCostFunction, TAKE_OWNERSHIP));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<EasyCostFunction,
+                                               CENTRAL,
+                                               3,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(new EasyCostFunction,
+                                                  TAKE_OWNERSHIP);
   EasyFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, CENTRAL);
 }
 
 TEST(NumericDiffCostFunction, EasyCaseCostFunctionForwardDifferences) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(
-      new NumericDiffCostFunction<EasyCostFunction,
-                                  FORWARD,
-                                  3,  // number of residuals
-                                  5,  // size of x1
-                                  5   // size of x2
-                                  >(new EasyCostFunction, TAKE_OWNERSHIP));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<EasyCostFunction,
+                                               FORWARD,
+                                               3,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(new EasyCostFunction,
+                                                  TAKE_OWNERSHIP);
   EasyFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, FORWARD);
 }
 
 TEST(NumericDiffCostFunction, EasyCaseCostFunctionRidders) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(
-      new NumericDiffCostFunction<EasyCostFunction,
-                                  RIDDERS,
-                                  3,  // number of residuals
-                                  5,  // size of x1
-                                  5   // size of x2
-                                  >(new EasyCostFunction, TAKE_OWNERSHIP));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<EasyCostFunction,
+                                               RIDDERS,
+                                               3,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(new EasyCostFunction,
+                                                  TAKE_OWNERSHIP);
+
   EasyFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, RIDDERS);
 }
 
 TEST(NumericDiffCostFunction, TranscendentalCaseFunctorCentralDifferences) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<TranscendentalFunctor,
-                                                  CENTRAL,
-                                                  2,  // number of residuals
-                                                  5,  // size of x1
-                                                  5   // size of x2
-                                                  >(new TranscendentalFunctor));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<TranscendentalFunctor,
+                                               CENTRAL,
+                                               2,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(new TranscendentalFunctor);
   TranscendentalFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, CENTRAL);
 }
 
 TEST(NumericDiffCostFunction, TranscendentalCaseFunctorForwardDifferences) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<TranscendentalFunctor,
-                                                  FORWARD,
-                                                  2,  // number of residuals
-                                                  5,  // size of x1
-                                                  5   // size of x2
-                                                  >(new TranscendentalFunctor));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<TranscendentalFunctor,
+                                               FORWARD,
+                                               2,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(new TranscendentalFunctor);
+
   TranscendentalFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, FORWARD);
 }
@@ -153,43 +155,43 @@
   // Using a smaller initial step size to overcome oscillatory function
   // behavior.
   options.ridders_relative_initial_step_size = 1e-3;
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<TranscendentalFunctor,
+                                               RIDDERS,
+                                               2,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(
+          new TranscendentalFunctor, TAKE_OWNERSHIP, 2, options);
 
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<TranscendentalFunctor,
-                                                  RIDDERS,
-                                                  2,  // number of residuals
-                                                  5,  // size of x1
-                                                  5   // size of x2
-                                                  >(
-      new TranscendentalFunctor, TAKE_OWNERSHIP, 2, options));
   TranscendentalFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, RIDDERS);
 }
 
 TEST(NumericDiffCostFunction,
      TranscendentalCaseCostFunctionCentralDifferences) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<TranscendentalCostFunction,
-                                                  CENTRAL,
-                                                  2,  // number of residuals
-                                                  5,  // size of x1
-                                                  5   // size of x2
-                                                  >(
-      new TranscendentalCostFunction, TAKE_OWNERSHIP));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<TranscendentalCostFunction,
+                                               CENTRAL,
+                                               2,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(
+          new TranscendentalCostFunction, TAKE_OWNERSHIP);
   TranscendentalFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, CENTRAL);
 }
 
 TEST(NumericDiffCostFunction,
      TranscendentalCaseCostFunctionForwardDifferences) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<TranscendentalCostFunction,
-                                                  FORWARD,
-                                                  2,  // number of residuals
-                                                  5,  // size of x1
-                                                  5   // size of x2
-                                                  >(
-      new TranscendentalCostFunction, TAKE_OWNERSHIP));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<TranscendentalCostFunction,
+                                               FORWARD,
+                                               2,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(
+          new TranscendentalCostFunction, TAKE_OWNERSHIP);
   TranscendentalFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, FORWARD);
 }
@@ -201,14 +203,14 @@
   // behavior.
   options.ridders_relative_initial_step_size = 1e-3;
 
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<TranscendentalCostFunction,
-                                                  RIDDERS,
-                                                  2,  // number of residuals
-                                                  5,  // size of x1
-                                                  5   // size of x2
-                                                  >(
-      new TranscendentalCostFunction, TAKE_OWNERSHIP, 2, options));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<TranscendentalCostFunction,
+                                               RIDDERS,
+                                               2,  // number of residuals
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(
+          new TranscendentalCostFunction, TAKE_OWNERSHIP, 2, options);
   TranscendentalFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, RIDDERS);
 }
@@ -230,121 +232,120 @@
 // templates are instantiated for various shapes of the Jacobian
 // matrix.
 TEST(NumericDiffCostFunction, EigenRowMajorColMajorTest) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(
-      new NumericDiffCostFunction<SizeTestingCostFunction<1, 1>, CENTRAL, 1, 1>(
-          new SizeTestingCostFunction<1, 1>, ceres::TAKE_OWNERSHIP));
+  std::unique_ptr<CostFunction> cost_function = std::make_unique<
+      NumericDiffCostFunction<SizeTestingCostFunction<1, 1>, CENTRAL, 1, 1>>(
+      new SizeTestingCostFunction<1, 1>, ceres::TAKE_OWNERSHIP);
 
-  cost_function.reset(
-      new NumericDiffCostFunction<SizeTestingCostFunction<2, 1>, CENTRAL, 2, 1>(
-          new SizeTestingCostFunction<2, 1>, ceres::TAKE_OWNERSHIP));
+  cost_function = std::make_unique<
+      NumericDiffCostFunction<SizeTestingCostFunction<2, 1>, CENTRAL, 2, 1>>(
+      new SizeTestingCostFunction<2, 1>, ceres::TAKE_OWNERSHIP);
 
-  cost_function.reset(
-      new NumericDiffCostFunction<SizeTestingCostFunction<1, 2>, CENTRAL, 1, 2>(
-          new SizeTestingCostFunction<1, 2>, ceres::TAKE_OWNERSHIP));
+  cost_function = std::make_unique<
+      NumericDiffCostFunction<SizeTestingCostFunction<1, 2>, CENTRAL, 1, 2>>(
+      new SizeTestingCostFunction<1, 2>, ceres::TAKE_OWNERSHIP);
 
-  cost_function.reset(
-      new NumericDiffCostFunction<SizeTestingCostFunction<2, 2>, CENTRAL, 2, 2>(
-          new SizeTestingCostFunction<2, 2>, ceres::TAKE_OWNERSHIP));
+  cost_function = std::make_unique<
+      NumericDiffCostFunction<SizeTestingCostFunction<2, 2>, CENTRAL, 2, 2>>(
+      new SizeTestingCostFunction<2, 2>, ceres::TAKE_OWNERSHIP);
 
-  cost_function.reset(
-      new NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 1, 1>(
-          new EasyFunctor, TAKE_OWNERSHIP, 1));
+  cost_function = std::make_unique<
+      NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 1, 1>>(
+      new EasyFunctor, TAKE_OWNERSHIP, 1);
 
-  cost_function.reset(
-      new NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 1, 1>(
-          new EasyFunctor, TAKE_OWNERSHIP, 2));
+  cost_function = std::make_unique<
+      NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 1, 1>>(
+      new EasyFunctor, TAKE_OWNERSHIP, 2);
 
-  cost_function.reset(
-      new NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 1, 2>(
-          new EasyFunctor, TAKE_OWNERSHIP, 1));
+  cost_function = std::make_unique<
+      NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 1, 2>>(
+      new EasyFunctor, TAKE_OWNERSHIP, 1);
 
-  cost_function.reset(
-      new NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 1, 2>(
-          new EasyFunctor, TAKE_OWNERSHIP, 2));
+  cost_function = std::make_unique<
+      NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 1, 2>>(
+      new EasyFunctor, TAKE_OWNERSHIP, 2);
 
-  cost_function.reset(
-      new NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 2, 1>(
-          new EasyFunctor, TAKE_OWNERSHIP, 1));
+  cost_function = std::make_unique<
+      NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 2, 1>>(
+      new EasyFunctor, TAKE_OWNERSHIP, 1);
 
-  cost_function.reset(
-      new NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 2, 1>(
-          new EasyFunctor, TAKE_OWNERSHIP, 2));
+  cost_function = std::make_unique<
+      NumericDiffCostFunction<EasyFunctor, CENTRAL, ceres::DYNAMIC, 2, 1>>(
+      new EasyFunctor, TAKE_OWNERSHIP, 2);
 }
 
 TEST(NumericDiffCostFunction,
      EasyCaseFunctorCentralDifferencesAndDynamicNumResiduals) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(
-      new NumericDiffCostFunction<EasyFunctor,
-                                  CENTRAL,
-                                  ceres::DYNAMIC,
-                                  5,  // size of x1
-                                  5   // size of x2
-                                  >(new EasyFunctor, TAKE_OWNERSHIP, 3));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<EasyFunctor,
+                                               CENTRAL,
+                                               ceres::DYNAMIC,
+                                               5,  // size of x1
+                                               5   // size of x2
+                                               >>(
+          new EasyFunctor, TAKE_OWNERSHIP, 3);
   EasyFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, CENTRAL);
 }
 
 TEST(NumericDiffCostFunction, ExponentialFunctorRidders) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<ExponentialFunctor,
-                                                  RIDDERS,
-                                                  1,  // number of residuals
-                                                  1   // size of x1
-                                                  >(new ExponentialFunctor));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<ExponentialFunctor,
+                                               RIDDERS,
+                                               1,  // number of residuals
+                                               1   // size of x1
+                                               >>(new ExponentialFunctor);
   ExponentialFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function);
 }
 
 TEST(NumericDiffCostFunction, ExponentialCostFunctionRidders) {
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(
-      new NumericDiffCostFunction<ExponentialCostFunction,
-                                  RIDDERS,
-                                  1,  // number of residuals
-                                  1   // size of x1
-                                  >(new ExponentialCostFunction));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<ExponentialCostFunction,
+                                               RIDDERS,
+                                               1,  // number of residuals
+                                               1   // size of x1
+                                               >>(new ExponentialCostFunction);
   ExponentialFunctor functor;
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function);
 }
 
 TEST(NumericDiffCostFunction, RandomizedFunctorRidders) {
-  std::unique_ptr<CostFunction> cost_function;
   NumericDiffOptions options;
   // Larger initial step size is chosen to produce robust results in the
   // presence of random noise.
   options.ridders_relative_initial_step_size = 10.0;
 
-  cost_function.reset(new NumericDiffCostFunction<RandomizedFunctor,
-                                                  RIDDERS,
-                                                  1,  // number of residuals
-                                                  1   // size of x1
-                                                  >(
-      new RandomizedFunctor(kNoiseFactor, kRandomSeed),
-      TAKE_OWNERSHIP,
-      1,
-      options));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<RandomizedFunctor,
+                                               RIDDERS,
+                                               1,  // number of residuals
+                                               1   // size of x1
+                                               >>(
+          new RandomizedFunctor(kNoiseFactor, kRandomSeed),
+          TAKE_OWNERSHIP,
+          1,
+          options);
   RandomizedFunctor functor(kNoiseFactor, kRandomSeed);
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function);
 }
 
 TEST(NumericDiffCostFunction, RandomizedCostFunctionRidders) {
-  std::unique_ptr<CostFunction> cost_function;
   NumericDiffOptions options;
   // Larger initial step size is chosen to produce robust results in the
   // presence of random noise.
   options.ridders_relative_initial_step_size = 10.0;
 
-  cost_function.reset(new NumericDiffCostFunction<RandomizedCostFunction,
-                                                  RIDDERS,
-                                                  1,  // number of residuals
-                                                  1   // size of x1
-                                                  >(
-      new RandomizedCostFunction(kNoiseFactor, kRandomSeed),
-      TAKE_OWNERSHIP,
-      1,
-      options));
+  auto cost_function =
+      std::make_unique<NumericDiffCostFunction<RandomizedCostFunction,
+                                               RIDDERS,
+                                               1,  // number of residuals
+                                               1   // size of x1
+                                               >>(
+          new RandomizedCostFunction(kNoiseFactor, kRandomSeed),
+          TAKE_OWNERSHIP,
+          1,
+          options);
+
   RandomizedFunctor functor(kNoiseFactor, kRandomSeed);
   functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function);
 }
@@ -363,15 +364,15 @@
   double* parameters[] = {&parameter};
   double* jacobians[] = {jacobian};
 
-  std::unique_ptr<CostFunction> cost_function(
-      new NumericDiffCostFunction<OnlyFillsOneOutputFunctor, CENTRAL, 2, 1>(
-          new OnlyFillsOneOutputFunctor));
+  auto cost_function = std::make_unique<
+      NumericDiffCostFunction<OnlyFillsOneOutputFunctor, CENTRAL, 2, 1>>(
+      new OnlyFillsOneOutputFunctor);
   InvalidateArray(2, jacobian);
   InvalidateArray(2, residuals);
   EXPECT_TRUE(cost_function->Evaluate(parameters, residuals, jacobians));
   EXPECT_FALSE(IsArrayValid(2, residuals));
   InvalidateArray(2, residuals);
-  EXPECT_TRUE(cost_function->Evaluate(parameters, residuals, NULL));
+  EXPECT_TRUE(cost_function->Evaluate(parameters, residuals, nullptr));
   // We are only testing residuals here, because the Jacobians are
   // computed using finite differencing from the residuals, so unless
   // we introduce a validation step after every evaluation of
@@ -385,12 +386,9 @@
   constexpr int kX1 = 5;
   constexpr int kX2 = 5;
 
-  std::unique_ptr<CostFunction> cost_function;
-  cost_function.reset(new NumericDiffCostFunction<EasyFunctor,
-                                                  CENTRAL,
-                                                  kNumResiduals,
-                                                  kX1,
-                                                  kX2>(new EasyFunctor));
+  auto cost_function = std::make_unique<
+      NumericDiffCostFunction<EasyFunctor, CENTRAL, kNumResiduals, kX1, kX2>>(
+      new EasyFunctor);
 
   // Prepare the parameters and residuals.
   std::array<double, kX1> x1{1e-64, 2.0, 3.0, 4.0, 5.0};
diff --git a/internal/ceres/parallel_for_cxx.cc b/internal/ceres/parallel_for_cxx.cc
index 4da40c0..a697d80 100644
--- a/internal/ceres/parallel_for_cxx.cc
+++ b/internal/ceres/parallel_for_cxx.cc
@@ -125,7 +125,7 @@
                  int num_threads,
                  const std::function<void(int)>& function) {
   CHECK_GT(num_threads, 0);
-  CHECK(context != NULL);
+  CHECK(context != nullptr);
   if (end <= start) {
     return;
   }
@@ -167,7 +167,7 @@
                  int num_threads,
                  const std::function<void(int thread_id, int i)>& function) {
   CHECK_GT(num_threads, 0);
-  CHECK(context != NULL);
+  CHECK(context != nullptr);
   if (end <= start) {
     return;
   }
diff --git a/internal/ceres/parallel_for_nothreads.cc b/internal/ceres/parallel_for_nothreads.cc
index d036569..7931445 100644
--- a/internal/ceres/parallel_for_nothreads.cc
+++ b/internal/ceres/parallel_for_nothreads.cc
@@ -47,7 +47,7 @@
                  int num_threads,
                  const std::function<void(int)>& function) {
   CHECK_GT(num_threads, 0);
-  CHECK(context != NULL);
+  CHECK(context != nullptr);
   if (end <= start) {
     return;
   }
@@ -62,7 +62,7 @@
                  int num_threads,
                  const std::function<void(int thread_id, int i)>& function) {
   CHECK_GT(num_threads, 0);
-  CHECK(context != NULL);
+  CHECK(context != nullptr);
   if (end <= start) {
     return;
   }
diff --git a/internal/ceres/parallel_for_openmp.cc b/internal/ceres/parallel_for_openmp.cc
index eb9d905..882f244 100644
--- a/internal/ceres/parallel_for_openmp.cc
+++ b/internal/ceres/parallel_for_openmp.cc
@@ -50,7 +50,7 @@
                  int num_threads,
                  const std::function<void(int)>& function) {
   CHECK_GT(num_threads, 0);
-  CHECK(context != NULL);
+  CHECK(context != nullptr);
   if (end <= start) {
     return;
   }
@@ -69,7 +69,7 @@
                  int end,
                  int num_threads,
                  const std::function<void(int thread_id, int i)>& function) {
-  CHECK(context != NULL);
+  CHECK(context != nullptr);
 
   ThreadTokenProvider thread_token_provider(num_threads);
   ParallelFor(context, start, end, num_threads, [&](int i) {
diff --git a/internal/ceres/parameter_block.h b/internal/ceres/parameter_block.h
index 824745c..304b769 100644
--- a/internal/ceres/parameter_block.h
+++ b/internal/ceres/parameter_block.h
@@ -166,7 +166,7 @@
 
     if (new_manifold == nullptr) {
       manifold_ = nullptr;
-      plus_jacobian_.reset(nullptr);
+      plus_jacobian_ = nullptr;
       return;
     }
 
@@ -180,8 +180,8 @@
         << "non-negative dimensional tangent space.";
 
     manifold_ = new_manifold;
-    plus_jacobian_.reset(
-        new double[manifold_->AmbientSize() * manifold_->TangentSize()]);
+    plus_jacobian_ = std::make_unique<double[]>(manifold_->AmbientSize() *
+                                                manifold_->TangentSize());
     CHECK(UpdatePlusJacobian())
         << "Manifold::PlusJacobian computation failed for x: "
         << ConstVectorRef(state_, Size()).transpose();
@@ -195,7 +195,7 @@
     }
 
     if (!upper_bounds_) {
-      upper_bounds_.reset(new double[size_]);
+      upper_bounds_ = std::make_unique<double[]>(size_);
       std::fill(upper_bounds_.get(),
                 upper_bounds_.get() + size_,
                 std::numeric_limits<double>::max());
@@ -212,7 +212,7 @@
     }
 
     if (!lower_bounds_) {
-      lower_bounds_.reset(new double[size_]);
+      lower_bounds_ = std::make_unique<double[]>(size_);
       std::fill(lower_bounds_.get(),
                 lower_bounds_.get() + size_,
                 -std::numeric_limits<double>::max());
@@ -269,7 +269,7 @@
     CHECK(residual_blocks_.get() == nullptr)
         << "Ceres bug: There is already a residual block collection "
         << "for parameter block: " << ToString();
-    residual_blocks_.reset(new ResidualBlockSet);
+    residual_blocks_ = std::make_unique<ResidualBlockSet>();
   }
 
   void AddResidualBlock(ResidualBlock* residual_block) {
diff --git a/internal/ceres/parameter_block_ordering.cc b/internal/ceres/parameter_block_ordering.cc
index 9899c24..d16e6dd 100644
--- a/internal/ceres/parameter_block_ordering.cc
+++ b/internal/ceres/parameter_block_ordering.cc
@@ -163,7 +163,7 @@
                           vector<int>* group_sizes) {
   CHECK(group_sizes != nullptr);
   group_sizes->clear();
-  if (ordering == NULL) {
+  if (ordering == nullptr) {
     return;
   }
 
diff --git a/internal/ceres/parameter_block_ordering_test.cc b/internal/ceres/parameter_block_ordering_test.cc
index 1078893..fd24839 100644
--- a/internal/ceres/parameter_block_ordering_test.cc
+++ b/internal/ceres/parameter_block_ordering_test.cc
@@ -71,12 +71,12 @@
     problem_.AddParameterBlock(z_, 5);
     problem_.AddParameterBlock(w_, 6);
 
-    problem_.AddResidualBlock(new DummyCostFunction<2, 3>, NULL, x_);
-    problem_.AddResidualBlock(new DummyCostFunction<6, 5, 4>, NULL, z_, y_);
-    problem_.AddResidualBlock(new DummyCostFunction<3, 3, 5>, NULL, x_, z_);
-    problem_.AddResidualBlock(new DummyCostFunction<7, 5, 3>, NULL, z_, x_);
+    problem_.AddResidualBlock(new DummyCostFunction<2, 3>, nullptr, x_);
+    problem_.AddResidualBlock(new DummyCostFunction<6, 5, 4>, nullptr, z_, y_);
+    problem_.AddResidualBlock(new DummyCostFunction<3, 3, 5>, nullptr, x_, z_);
+    problem_.AddResidualBlock(new DummyCostFunction<7, 5, 3>, nullptr, z_, x_);
     problem_.AddResidualBlock(
-        new DummyCostFunction<1, 5, 3, 6>, NULL, z_, x_, w_);
+        new DummyCostFunction<1, 5, 3, 6>, nullptr, z_, x_, w_);
   }
 
   ProblemImpl problem_;
diff --git a/internal/ceres/partitioned_matrix_view.cc b/internal/ceres/partitioned_matrix_view.cc
index b67bc90..595b701 100644
--- a/internal/ceres/partitioned_matrix_view.cc
+++ b/internal/ceres/partitioned_matrix_view.cc
@@ -45,137 +45,137 @@
 namespace ceres {
 namespace internal {
 
-PartitionedMatrixViewBase* PartitionedMatrixViewBase::Create(
+std::unique_ptr<PartitionedMatrixViewBase> PartitionedMatrixViewBase::Create(
     const LinearSolver::Options& options, const BlockSparseMatrix& matrix) {
 #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 2) &&
      (options.f_block_size == 2)) {
-    return new PartitionedMatrixView<2, 2, 2>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,2, 2>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 2) &&
      (options.f_block_size == 3)) {
-    return new PartitionedMatrixView<2, 2, 3>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,2, 3>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 2) &&
      (options.f_block_size == 4)) {
-    return new PartitionedMatrixView<2, 2, 4>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,2, 4>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 2)) {
-    return new PartitionedMatrixView<2, 2, Eigen::Dynamic>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,2, Eigen::Dynamic>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 3) &&
      (options.f_block_size == 3)) {
-    return new PartitionedMatrixView<2, 3, 3>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,3, 3>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 3) &&
      (options.f_block_size == 4)) {
-    return new PartitionedMatrixView<2, 3, 4>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,3, 4>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 3) &&
      (options.f_block_size == 6)) {
-    return new PartitionedMatrixView<2, 3, 6>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,3, 6>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 3) &&
      (options.f_block_size == 9)) {
-    return new PartitionedMatrixView<2, 3, 9>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,3, 9>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 3)) {
-    return new PartitionedMatrixView<2, 3, Eigen::Dynamic>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,3, Eigen::Dynamic>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 3)) {
-    return new PartitionedMatrixView<2, 4, 3>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,4, 3>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 4)) {
-    return new PartitionedMatrixView<2, 4, 4>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,4, 4>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 6)) {
-    return new PartitionedMatrixView<2, 4, 6>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,4, 6>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 8)) {
-    return new PartitionedMatrixView<2, 4, 8>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,4, 8>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 9)) {
-    return new PartitionedMatrixView<2, 4, 9>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,4, 9>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4)) {
-    return new PartitionedMatrixView<2, 4, Eigen::Dynamic>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,4, Eigen::Dynamic>>(
+                   matrix, options.elimination_groups[0]);
   }
   if (options.row_block_size == 2) {
-    return new PartitionedMatrixView<2, Eigen::Dynamic, Eigen::Dynamic>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<2,Eigen::Dynamic, Eigen::Dynamic>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 3) &&
      (options.e_block_size == 3) &&
      (options.f_block_size == 3)) {
-    return new PartitionedMatrixView<3, 3, 3>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<3,3, 3>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 4) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 2)) {
-    return new PartitionedMatrixView<4, 4, 2>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<4,4, 2>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 4) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 3)) {
-    return new PartitionedMatrixView<4, 4, 3>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<4,4, 3>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 4) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 4)) {
-    return new PartitionedMatrixView<4, 4, 4>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<4,4, 4>>(
+                   matrix, options.elimination_groups[0]);
   }
   if ((options.row_block_size == 4) &&
      (options.e_block_size == 4)) {
-    return new PartitionedMatrixView<4, 4, Eigen::Dynamic>(matrix,
-                                              options.elimination_groups[0]);
+    return std::make_unique<PartitionedMatrixView<4,4, Eigen::Dynamic>>(
+                   matrix, options.elimination_groups[0]);
   }
 
 #endif
   VLOG(1) << "Template specializations not found for <"
           << options.row_block_size << "," << options.e_block_size << ","
           << options.f_block_size << ">";
-  return new PartitionedMatrixView<Eigen::Dynamic,
-                                   Eigen::Dynamic,
-                                   Eigen::Dynamic>(
+  return std::make_unique<PartitionedMatrixView<Eigen::Dynamic,
+                                                Eigen::Dynamic,
+                                                Eigen::Dynamic>>(
       matrix, options.elimination_groups[0]);
 };
 
diff --git a/internal/ceres/partitioned_matrix_view.h b/internal/ceres/partitioned_matrix_view.h
index 4761050..36cf0d4 100644
--- a/internal/ceres/partitioned_matrix_view.h
+++ b/internal/ceres/partitioned_matrix_view.h
@@ -77,11 +77,11 @@
   virtual void RightMultiplyF(const double* x, double* y) const = 0;
 
   // Create and return the block diagonal of the matrix E'E.
-  virtual BlockSparseMatrix* CreateBlockDiagonalEtE() const = 0;
+  virtual std::unique_ptr<BlockSparseMatrix> CreateBlockDiagonalEtE() const = 0;
 
   // Create and return the block diagonal of the matrix F'F. Caller
   // owns the result.
-  virtual BlockSparseMatrix* CreateBlockDiagonalFtF() const = 0;
+  virtual std::unique_ptr<BlockSparseMatrix> CreateBlockDiagonalFtF() const = 0;
 
   // Compute the block diagonal of the matrix E'E and store it in
   // block_diagonal. The matrix block_diagonal is expected to have a
@@ -108,8 +108,8 @@
   virtual int num_cols()         const = 0;
   // clang-format on
 
-  static PartitionedMatrixViewBase* Create(const LinearSolver::Options& options,
-                                           const BlockSparseMatrix& matrix);
+  static std::unique_ptr<PartitionedMatrixViewBase> Create(
+      const LinearSolver::Options& options, const BlockSparseMatrix& matrix);
 };
 
 template <int kRowBlockSize = Eigen::Dynamic,
@@ -126,8 +126,8 @@
   void LeftMultiplyF(const double* x, double* y) const final;
   void RightMultiplyE(const double* x, double* y) const final;
   void RightMultiplyF(const double* x, double* y) const final;
-  BlockSparseMatrix* CreateBlockDiagonalEtE() const final;
-  BlockSparseMatrix* CreateBlockDiagonalFtF() const final;
+  std::unique_ptr<BlockSparseMatrix> CreateBlockDiagonalEtE() const final;
+  std::unique_ptr<BlockSparseMatrix> CreateBlockDiagonalFtF() const final;
   void UpdateBlockDiagonalEtE(BlockSparseMatrix* block_diagonal) const final;
   void UpdateBlockDiagonalFtF(BlockSparseMatrix* block_diagonal) const final;
   // clang-format off
@@ -140,8 +140,8 @@
   // clang-format on
 
  private:
-  BlockSparseMatrix* CreateBlockDiagonalMatrixLayout(int start_col_block,
-                                                     int end_col_block) const;
+  std::unique_ptr<BlockSparseMatrix> CreateBlockDiagonalMatrixLayout(
+      int start_col_block, int end_col_block) const;
 
   const BlockSparseMatrix& matrix_;
   int num_row_blocks_e_;
diff --git a/internal/ceres/partitioned_matrix_view_impl.h b/internal/ceres/partitioned_matrix_view_impl.h
index 22594ef..4dd8d70 100644
--- a/internal/ceres/partitioned_matrix_view_impl.h
+++ b/internal/ceres/partitioned_matrix_view_impl.h
@@ -235,7 +235,7 @@
 // and return a BlockSparseMatrix with the this block structure. The
 // caller owns the result.
 template <int kRowBlockSize, int kEBlockSize, int kFBlockSize>
-BlockSparseMatrix*
+std::unique_ptr<BlockSparseMatrix>
 PartitionedMatrixView<kRowBlockSize, kEBlockSize, kFBlockSize>::
     CreateBlockDiagonalMatrixLayout(int start_col_block,
                                     int end_col_block) const {
@@ -270,28 +270,27 @@
 
   // Build a BlockSparseMatrix with the just computed block
   // structure.
-  return new BlockSparseMatrix(block_diagonal_structure);
+  return std::make_unique<BlockSparseMatrix>(block_diagonal_structure);
 }
 
 template <int kRowBlockSize, int kEBlockSize, int kFBlockSize>
-BlockSparseMatrix* PartitionedMatrixView<kRowBlockSize,
-                                         kEBlockSize,
-                                         kFBlockSize>::CreateBlockDiagonalEtE()
-    const {
-  BlockSparseMatrix* block_diagonal =
+std::unique_ptr<BlockSparseMatrix>
+PartitionedMatrixView<kRowBlockSize, kEBlockSize, kFBlockSize>::
+    CreateBlockDiagonalEtE() const {
+  std::unique_ptr<BlockSparseMatrix> block_diagonal =
       CreateBlockDiagonalMatrixLayout(0, num_col_blocks_e_);
-  UpdateBlockDiagonalEtE(block_diagonal);
+  UpdateBlockDiagonalEtE(block_diagonal.get());
   return block_diagonal;
 }
 
 template <int kRowBlockSize, int kEBlockSize, int kFBlockSize>
-BlockSparseMatrix* PartitionedMatrixView<kRowBlockSize,
-                                         kEBlockSize,
-                                         kFBlockSize>::CreateBlockDiagonalFtF()
-    const {
-  BlockSparseMatrix* block_diagonal = CreateBlockDiagonalMatrixLayout(
-      num_col_blocks_e_, num_col_blocks_e_ + num_col_blocks_f_);
-  UpdateBlockDiagonalFtF(block_diagonal);
+std::unique_ptr<BlockSparseMatrix>
+PartitionedMatrixView<kRowBlockSize, kEBlockSize, kFBlockSize>::
+    CreateBlockDiagonalFtF() const {
+  std::unique_ptr<BlockSparseMatrix> block_diagonal =
+      CreateBlockDiagonalMatrixLayout(num_col_blocks_e_,
+                                      num_col_blocks_e_ + num_col_blocks_f_);
+  UpdateBlockDiagonalFtF(block_diagonal.get());
   return block_diagonal;
 }
 
diff --git a/internal/ceres/partitioned_matrix_view_template.py b/internal/ceres/partitioned_matrix_view_template.py
index 05a25bf..9ab56cf 100644
--- a/internal/ceres/partitioned_matrix_view_template.py
+++ b/internal/ceres/partitioned_matrix_view_template.py
@@ -128,21 +128,21 @@
 namespace ceres {
 namespace internal {
 
-PartitionedMatrixViewBase* PartitionedMatrixViewBase::Create(
+std::unique_ptr<PartitionedMatrixViewBase> PartitionedMatrixViewBase::Create(
     const LinearSolver::Options& options, const BlockSparseMatrix& matrix) {
 #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
 """
-FACTORY = """  return new PartitionedMatrixView<%s, %s, %s>(matrix,
-                                              options.elimination_groups[0]);"""
+FACTORY = """  return std::make_unique<PartitionedMatrixView<%s,%s, %s>>(
+                   matrix, options.elimination_groups[0]);"""
 
 FACTORY_FOOTER = """
 #endif
   VLOG(1) << "Template specializations not found for <"
           << options.row_block_size << "," << options.e_block_size << ","
           << options.f_block_size << ">";
-  return new PartitionedMatrixView<Eigen::Dynamic,
-                                   Eigen::Dynamic,
-                                   Eigen::Dynamic>(
+  return std::make_unique<PartitionedMatrixView<Eigen::Dynamic,
+                                                Eigen::Dynamic,
+                                                Eigen::Dynamic>>(
       matrix, options.elimination_groups[0]);
 };
 
diff --git a/internal/ceres/partitioned_matrix_view_test.cc b/internal/ceres/partitioned_matrix_view_test.cc
index b66d0b8..d01dd3b 100644
--- a/internal/ceres/partitioned_matrix_view_test.cc
+++ b/internal/ceres/partitioned_matrix_view_test.cc
@@ -51,18 +51,18 @@
  protected:
   void SetUp() final {
     srand(5);
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(2));
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(2);
     CHECK(problem != nullptr);
-    A_.reset(problem->A.release());
+    A_ = std::move(problem->A);
 
     num_cols_ = A_->num_cols();
     num_rows_ = A_->num_rows();
     num_eliminate_blocks_ = problem->num_eliminate_blocks;
     LinearSolver::Options options;
     options.elimination_groups.push_back(num_eliminate_blocks_);
-    pmv_.reset(PartitionedMatrixViewBase::Create(
-        options, *down_cast<BlockSparseMatrix*>(A_.get())));
+    pmv_ = PartitionedMatrixViewBase::Create(
+        options, *down_cast<BlockSparseMatrix*>(A_.get()));
   }
 
   int num_rows_;
diff --git a/internal/ceres/polynomial.cc b/internal/ceres/polynomial.cc
index 20812f4..feb1222 100644
--- a/internal/ceres/polynomial.cc
+++ b/internal/ceres/polynomial.cc
@@ -128,12 +128,12 @@
                                Vector* real,
                                Vector* imaginary) {
   CHECK_EQ(polynomial.size(), 2);
-  if (real != NULL) {
+  if (real != nullptr) {
     real->resize(1);
     (*real)(0) = -polynomial(1) / polynomial(0);
   }
 
-  if (imaginary != NULL) {
+  if (imaginary != nullptr) {
     imaginary->setZero(1);
   }
 }
@@ -147,16 +147,16 @@
   const double c = polynomial(2);
   const double D = b * b - 4 * a * c;
   const double sqrt_D = sqrt(fabs(D));
-  if (real != NULL) {
+  if (real != nullptr) {
     real->setZero(2);
   }
-  if (imaginary != NULL) {
+  if (imaginary != nullptr) {
     imaginary->setZero(2);
   }
 
   // Real roots.
   if (D >= 0) {
-    if (real != NULL) {
+    if (real != nullptr) {
       // Stable quadratic roots according to BKP Horn.
       // http://people.csail.mit.edu/bkph/articles/Quadratics.pdf
       if (b >= 0) {
@@ -171,11 +171,11 @@
   }
 
   // Use the normal quadratic formula for the complex case.
-  if (real != NULL) {
+  if (real != nullptr) {
     (*real)(0) = -b / (2.0 * a);
     (*real)(1) = -b / (2.0 * a);
   }
-  if (imaginary != NULL) {
+  if (imaginary != nullptr) {
     (*imaginary)(0) = sqrt_D / (2.0 * a);
     (*imaginary)(1) = -sqrt_D / (2.0 * a);
   }
@@ -240,14 +240,14 @@
   }
 
   // Output roots
-  if (real != NULL) {
+  if (real != nullptr) {
     *real = solver.eigenvalues().real();
   } else {
-    LOG(WARNING) << "NULL pointer passed as real argument to "
+    LOG(WARNING) << "nullptr pointer passed as real argument to "
                  << "FindPolynomialRoots. Real parts of the roots will not "
                  << "be returned.";
   }
-  if (imaginary != NULL) {
+  if (imaginary != nullptr) {
     *imaginary = solver.eigenvalues().imag();
   }
   return true;
@@ -304,7 +304,7 @@
 
   const Vector derivative = DifferentiatePolynomial(polynomial);
   Vector roots_real;
-  if (!FindPolynomialRoots(derivative, &roots_real, NULL)) {
+  if (!FindPolynomialRoots(derivative, &roots_real, nullptr)) {
     LOG(WARNING) << "Unable to find the critical points of "
                  << "the interpolating polynomial.";
     return;
diff --git a/internal/ceres/polynomial.h b/internal/ceres/polynomial.h
index 20071f2..3d43284 100644
--- a/internal/ceres/polynomial.h
+++ b/internal/ceres/polynomial.h
@@ -64,8 +64,8 @@
 // Failure indicates that the polynomial is invalid (of size 0) or
 // that the eigenvalues of the companion matrix could not be computed.
 // On failure, a more detailed message will be written to LOG(ERROR).
-// If real is not NULL, the real parts of the roots will be returned in it.
-// Likewise, if imaginary is not NULL, imaginary parts will be returned in it.
+// If real is not nullptr, the real parts of the roots will be returned in it.
+// Likewise, if imaginary is not nullptr, imaginary parts will be returned in it.
 CERES_EXPORT_INTERNAL bool FindPolynomialRoots(const Vector& polynomial,
                                                Vector* real,
                                                Vector* imaginary);
diff --git a/internal/ceres/polynomial_test.cc b/internal/ceres/polynomial_test.cc
index 0ff73ea..c45557e 100644
--- a/internal/ceres/polynomial_test.cc
+++ b/internal/ceres/polynomial_test.cc
@@ -88,8 +88,8 @@
 }
 
 // Run a test with the polynomial defined by the N real roots in roots_real.
-// If use_real is false, NULL is passed as the real argument to
-// FindPolynomialRoots. If use_imaginary is false, NULL is passed as the
+// If use_real is false, nullptr is passed as the real argument to
+// FindPolynomialRoots. If use_imaginary is false, nullptr is passed as the
 // imaginary argument to FindPolynomialRoots.
 template <int N>
 void RunPolynomialTestRealRoots(const double (&real_roots)[N],
@@ -102,8 +102,8 @@
   for (int i = 0; i < N; ++i) {
     poly = AddRealRoot(poly, real_roots[i]);
   }
-  Vector* const real_ptr = use_real ? &real : NULL;
-  Vector* const imaginary_ptr = use_imaginary ? &imaginary : NULL;
+  Vector* const real_ptr = use_real ? &real : nullptr;
+  Vector* const imaginary_ptr = use_imaginary ? &imaginary : nullptr;
   bool success = FindPolynomialRoots(poly, real_ptr, imaginary_ptr);
 
   EXPECT_EQ(success, true);
diff --git a/internal/ceres/preconditioner.h b/internal/ceres/preconditioner.h
index 6a6bc61..e0eb88d 100644
--- a/internal/ceres/preconditioner.h
+++ b/internal/ceres/preconditioner.h
@@ -126,7 +126,7 @@
   // for some vector b. It is important that the matrix A have the
   // same block structure as the one used to construct this object.
   //
-  // D can be NULL, in which case its interpreted as a diagonal matrix
+  // D can be nullptr, in which case its interpreted as a diagonal matrix
   // of size zero.
   virtual bool Update(const LinearOperator& A, const double* D) = 0;
 
diff --git a/internal/ceres/preprocessor.cc b/internal/ceres/preprocessor.cc
index 097ac64..1fcd74a 100644
--- a/internal/ceres/preprocessor.cc
+++ b/internal/ceres/preprocessor.cc
@@ -51,7 +51,7 @@
   }
 
   LOG(FATAL) << "Unknown minimizer_type: " << minimizer_type;
-  return NULL;
+  return nullptr;
 }
 
 Preprocessor::~Preprocessor() = default;
@@ -85,15 +85,15 @@
   minimizer_options.evaluator = pp->evaluator;
 
   if (options.logging_type != SILENT) {
-    pp->logging_callback.reset(new LoggingCallback(
-        options.minimizer_type, options.minimizer_progress_to_stdout));
+    pp->logging_callback = std::make_unique<LoggingCallback>(
+        options.minimizer_type, options.minimizer_progress_to_stdout);
     minimizer_options.callbacks.insert(minimizer_options.callbacks.begin(),
                                        pp->logging_callback.get());
   }
 
   if (options.update_state_every_iteration) {
-    pp->state_updating_callback.reset(
-        new StateUpdatingCallback(program, reduced_parameters));
+    pp->state_updating_callback =
+        std::make_unique<StateUpdatingCallback>(program, reduced_parameters);
     // This must get pushed to the front of the callbacks so that it
     // is run before any of the user callbacks.
     minimizer_options.callbacks.insert(minimizer_options.callbacks.begin(),
diff --git a/internal/ceres/problem_impl.cc b/internal/ceres/problem_impl.cc
index a49cd5e..f256aab 100644
--- a/internal/ceres/problem_impl.cc
+++ b/internal/ceres/problem_impl.cc
@@ -763,8 +763,8 @@
 
   std::unique_ptr<CompressedRowSparseMatrix> tmp_jacobian;
   if (jacobian != nullptr) {
-    tmp_jacobian.reset(
-        down_cast<CompressedRowSparseMatrix*>(evaluator->CreateJacobian()));
+    tmp_jacobian.reset(down_cast<CompressedRowSparseMatrix*>(
+        evaluator->CreateJacobian().release()));
   }
 
   // Point the state pointers to the user state pointers. This is
diff --git a/internal/ceres/problem_test.cc b/internal/ceres/problem_test.cc
index 483ae07..1987e13 100644
--- a/internal/ceres/problem_test.cc
+++ b/internal/ceres/problem_test.cc
@@ -429,7 +429,7 @@
   DynamicProblem() {
     Problem::Options options;
     options.enable_fast_removal = GetParam();
-    problem.reset(new ProblemImpl(options));
+    problem = std::make_unique<ProblemImpl>(options);
   }
 
   ParameterBlock* GetParameterBlock(int block) {
diff --git a/internal/ceres/program.cc b/internal/ceres/program.cc
index 516d58d..adfff0b 100644
--- a/internal/ceres/program.cc
+++ b/internal/ceres/program.cc
@@ -279,7 +279,7 @@
   return true;
 }
 
-Program* Program::CreateReducedProgram(
+std::unique_ptr<Program> Program::CreateReducedProgram(
     std::vector<double*>* removed_parameter_blocks,
     double* fixed_cost,
     std::string* error) const {
@@ -287,14 +287,14 @@
   CHECK(fixed_cost != nullptr);
   CHECK(error != nullptr);
 
-  std::unique_ptr<Program> reduced_program(new Program(*this));
+  std::unique_ptr<Program> reduced_program = std::make_unique<Program>(*this);
   if (!reduced_program->RemoveFixedBlocks(
           removed_parameter_blocks, fixed_cost, error)) {
     return nullptr;
   }
 
   reduced_program->SetParameterOffsetsAndIndex();
-  return reduced_program.release();
+  return reduced_program;
 }
 
 bool Program::RemoveFixedBlocks(std::vector<double*>* removed_parameter_blocks,
@@ -305,8 +305,8 @@
   CHECK(error != nullptr);
 
   std::unique_ptr<double[]> residual_block_evaluate_scratch;
-  residual_block_evaluate_scratch.reset(
-      new double[MaxScratchDoublesNeededForEvaluate()]);
+  residual_block_evaluate_scratch =
+      std::make_unique<double[]>(MaxScratchDoublesNeededForEvaluate());
   *fixed_cost = 0.0;
 
   bool need_to_call_prepare_for_evaluation = evaluation_callback_ != nullptr;
diff --git a/internal/ceres/program.h b/internal/ceres/program.h
index 343cf8e..ffd5db7 100644
--- a/internal/ceres/program.h
+++ b/internal/ceres/program.h
@@ -146,12 +146,13 @@
   // fixed_cost will be equal to the sum of the costs of the residual
   // blocks that were removed.
   //
-  // If there was a problem, then the function will return a NULL
+  // If there was a problem, then the function will return a nullptr
   // pointer and error will contain a human readable description of
   // the problem.
-  Program* CreateReducedProgram(std::vector<double*>* removed_parameter_blocks,
-                                double* fixed_cost,
-                                std::string* error) const;
+  std::unique_ptr<Program> CreateReducedProgram(
+      std::vector<double*>* removed_parameter_blocks,
+      double* fixed_cost,
+      std::string* error) const;
 
   // See problem.h for what these do.
   int NumParameterBlocks() const;
diff --git a/internal/ceres/program_evaluator.h b/internal/ceres/program_evaluator.h
index 4ab557f..2ab52da 100644
--- a/internal/ceres/program_evaluator.h
+++ b/internal/ceres/program_evaluator.h
@@ -59,7 +59,7 @@
 //   class JacobianWriter {
 //     // Create a jacobian that this writer can write. Same as
 //     // Evaluator::CreateJacobian.
-//     SparseMatrix* CreateJacobian() const;
+//     std::unique_ptr<SparseMatrix> CreateJacobian() const;
 //
 //     // Create num_threads evaluate preparers. Caller owns result which must
 //     // be freed with delete[]. Resulting preparers are valid while *this is.
@@ -127,12 +127,12 @@
 #endif  // CERES_NO_THREADS
 
     BuildResidualLayout(*program, &residual_layout_);
-    evaluate_scratch_.reset(
-        CreateEvaluatorScratch(*program, options.num_threads));
+    evaluate_scratch_ =
+        std::move(CreateEvaluatorScratch(*program, options.num_threads));
   }
 
   // Implementation of Evaluator interface.
-  SparseMatrix* CreateJacobian() const final {
+  std::unique_ptr<SparseMatrix> CreateJacobian() const final {
     return jacobian_writer_.CreateJacobian();
   }
 
@@ -309,13 +309,14 @@
               int max_scratch_doubles_needed_for_evaluate,
               int max_residuals_per_residual_block,
               int num_parameters) {
-      residual_block_evaluate_scratch.reset(
-          new double[max_scratch_doubles_needed_for_evaluate]);
-      gradient.reset(new double[num_parameters]);
+      residual_block_evaluate_scratch =
+          std::make_unique<double[]>(max_scratch_doubles_needed_for_evaluate);
+      gradient = std::make_unique<double[]>(num_parameters);
       VectorRef(gradient.get(), num_parameters).setZero();
-      residual_block_residuals.reset(
-          new double[max_residuals_per_residual_block]);
-      jacobian_block_ptrs.reset(new double*[max_parameters_per_residual_block]);
+      residual_block_residuals =
+          std::make_unique<double[]>(max_residuals_per_residual_block);
+      jacobian_block_ptrs =
+          std::make_unique<double*[]>(max_parameters_per_residual_block);
     }
 
     double cost;
@@ -341,8 +342,8 @@
   }
 
   // Create scratch space for each thread evaluating the program.
-  static EvaluateScratch* CreateEvaluatorScratch(const Program& program,
-                                                 int num_threads) {
+  static std::unique_ptr<EvaluateScratch[]> CreateEvaluatorScratch(
+      const Program& program, int num_threads) {
     int max_parameters_per_residual_block =
         program.MaxParametersPerResidualBlock();
     int max_scratch_doubles_needed_for_evaluate =
@@ -351,7 +352,7 @@
         program.MaxResidualsPerResidualBlock();
     int num_parameters = program.NumEffectiveParameters();
 
-    EvaluateScratch* evaluate_scratch = new EvaluateScratch[num_threads];
+    auto evaluate_scratch = std::make_unique<EvaluateScratch[]>(num_threads);
     for (int i = 0; i < num_threads; i++) {
       evaluate_scratch[i].Init(max_parameters_per_residual_block,
                                max_scratch_doubles_needed_for_evaluate,
diff --git a/internal/ceres/reorder_program.cc b/internal/ceres/reorder_program.cc
index eefb085..2d93487 100644
--- a/internal/ceres/reorder_program.cc
+++ b/internal/ceres/reorder_program.cc
@@ -291,7 +291,7 @@
   // filling is finished, the offset pointerts should have shifted down one
   // entry (this is verified below).
   vector<ResidualBlock*> reordered_residual_blocks(
-      (*residual_blocks).size(), static_cast<ResidualBlock*>(NULL));
+      (*residual_blocks).size(), static_cast<ResidualBlock*>(nullptr));
   for (int i = 0; i < residual_blocks->size(); ++i) {
     int bucket = min_position_per_residual[i];
 
@@ -299,7 +299,7 @@
     offsets[bucket]--;
 
     // Sanity.
-    CHECK(reordered_residual_blocks[offsets[bucket]] == NULL)
+    CHECK(reordered_residual_blocks[offsets[bucket]] == nullptr)
         << "Congratulations, you found a Ceres bug! Please report this error "
         << "to the developers.";
 
@@ -313,9 +313,9 @@
         << "Congratulations, you found a Ceres bug! Please report this error "
         << "to the developers.";
   }
-  // Sanity check #2: No NULL's left behind.
+  // Sanity check #2: No nullptr's left behind.
   for (int i = 0; i < reordered_residual_blocks.size(); ++i) {
-    CHECK(reordered_residual_blocks[i] != NULL)
+    CHECK(reordered_residual_blocks[i] != nullptr)
         << "Congratulations, you found a Ceres bug! Please report this error "
         << "to the developers.";
   }
@@ -441,7 +441,7 @@
 
   if (parameter_block_ordering->NumGroups() == 1) {
     // If the user supplied an parameter_block_ordering with just one
-    // group, it is equivalent to the user supplying NULL as an
+    // group, it is equivalent to the user supplying nullptr as an
     // parameter_block_ordering. Ceres is completely free to choose the
     // parameter block ordering as it sees fit. For Schur type solvers,
     // this means that the user wishes for Ceres to identify the
diff --git a/internal/ceres/reorder_program_test.cc b/internal/ceres/reorder_program_test.cc
index 37a07cb..427334e 100644
--- a/internal/ceres/reorder_program_test.cc
+++ b/internal/ceres/reorder_program_test.cc
@@ -78,14 +78,14 @@
   problem.AddResidualBlock(new BinaryCostFunction(), nullptr, &x, &y);
   problem.AddResidualBlock(new UnaryCostFunction(), nullptr, &y);
 
-  ParameterBlockOrdering* linear_solver_ordering = new ParameterBlockOrdering;
+  auto linear_solver_ordering = std::make_shared<ParameterBlockOrdering>();
   linear_solver_ordering->AddElementToGroup(&x, 0);
   linear_solver_ordering->AddElementToGroup(&y, 0);
   linear_solver_ordering->AddElementToGroup(&z, 1);
 
   Solver::Options options;
   options.linear_solver_type = DENSE_SCHUR;
-  options.linear_solver_ordering.reset(linear_solver_ordering);
+  options.linear_solver_ordering = linear_solver_ordering;
 
   const vector<ResidualBlock*>& residual_blocks =
       problem.program().residual_blocks();
diff --git a/internal/ceres/residual_block.h b/internal/ceres/residual_block.h
index 888a44a..80c8dd6 100644
--- a/internal/ceres/residual_block.h
+++ b/internal/ceres/residual_block.h
@@ -77,9 +77,9 @@
 
   // Evaluates the residual term, storing the scalar cost in *cost, the residual
   // components in *residuals, and the jacobians between the parameters and
-  // residuals in jacobians[i], in row-major order. If residuals is NULL, the
-  // residuals are not computed. If jacobians is NULL, no jacobians are
-  // computed. If jacobians[i] is NULL, then the jacobian for that parameter is
+  // residuals in jacobians[i], in row-major order. If residuals is nullptr, the
+  // residuals are not computed. If jacobians is nullptr, no jacobians are
+  // computed. If jacobians[i] is nullptr, then the jacobian for that parameter is
   // not computed.
   //
   // cost must not be null.
diff --git a/internal/ceres/residual_block_test.cc b/internal/ceres/residual_block_test.cc
index d587058..f01d842 100644
--- a/internal/ceres/residual_block_test.cc
+++ b/internal/ceres/residual_block_test.cc
@@ -64,7 +64,7 @@
     }
     if (jacobians) {
       for (int k = 0; k < 3; ++k) {
-        if (jacobians[k] != NULL) {
+        if (jacobians[k] != nullptr) {
           MatrixRef jacobian(
               jacobians[k], num_residuals(), parameter_block_sizes()[k]);
           jacobian.setConstant(k);
@@ -96,11 +96,11 @@
   TernaryCostFunction cost_function(3, 2, 3, 4);
 
   // Create the object under tests.
-  ResidualBlock residual_block(&cost_function, NULL, parameters, -1);
+  ResidualBlock residual_block(&cost_function, nullptr, parameters, -1);
 
   // Verify getters.
   EXPECT_EQ(&cost_function, residual_block.cost_function());
-  EXPECT_EQ(NULL, residual_block.loss_function());
+  EXPECT_EQ(nullptr, residual_block.loss_function());
   EXPECT_EQ(parameters[0], residual_block.parameter_blocks()[0]);
   EXPECT_EQ(parameters[1], residual_block.parameter_blocks()[1]);
   EXPECT_EQ(parameters[2], residual_block.parameter_blocks()[2]);
@@ -108,12 +108,12 @@
 
   // Verify cost-only evaluation.
   double cost;
-  residual_block.Evaluate(true, &cost, NULL, NULL, scratch);
+  residual_block.Evaluate(true, &cost, nullptr, nullptr, scratch);
   EXPECT_EQ(0.5 * (0 * 0 + 1 * 1 + 2 * 2), cost);
 
   // Verify cost and residual evaluation.
   double residuals[3];
-  residual_block.Evaluate(true, &cost, residuals, NULL, scratch);
+  residual_block.Evaluate(true, &cost, residuals, nullptr, scratch);
   EXPECT_EQ(0.5 * (0 * 0 + 1 * 1 + 2 * 2), cost);
   EXPECT_EQ(0.0, residuals[0]);
   EXPECT_EQ(1.0, residuals[1]);
@@ -151,7 +151,7 @@
   jacobian_ry.setConstant(-1.0);
   jacobian_rz.setConstant(-1.0);
 
-  jacobian_ptrs[1] = NULL;  // Don't compute the jacobian for y.
+  jacobian_ptrs[1] = nullptr;  // Don't compute the jacobian for y.
 
   residual_block.Evaluate(true, &cost, residuals, jacobian_ptrs, scratch);
   EXPECT_EQ(0.5 * (0 * 0 + 1 * 1 + 2 * 2), cost);
@@ -187,7 +187,7 @@
         //   0 1 2 3 4 ...
         //   0 1 2 3 4 ...
         //
-        if (jacobians[k] != NULL) {
+        if (jacobians[k] != nullptr) {
           MatrixRef jacobian(
               jacobians[k], num_residuals(), parameter_block_sizes()[k]);
           for (int j = 0; j < k + 2; ++j) {
@@ -233,11 +233,11 @@
   LocallyParameterizedCostFunction cost_function;
 
   // Create the object under tests.
-  ResidualBlock residual_block(&cost_function, NULL, parameters, -1);
+  ResidualBlock residual_block(&cost_function, nullptr, parameters, -1);
 
   // Verify getters.
   EXPECT_EQ(&cost_function, residual_block.cost_function());
-  EXPECT_EQ(NULL, residual_block.loss_function());
+  EXPECT_EQ(nullptr, residual_block.loss_function());
   EXPECT_EQ(parameters[0], residual_block.parameter_blocks()[0]);
   EXPECT_EQ(parameters[1], residual_block.parameter_blocks()[1]);
   EXPECT_EQ(parameters[2], residual_block.parameter_blocks()[2]);
@@ -245,12 +245,12 @@
 
   // Verify cost-only evaluation.
   double cost;
-  residual_block.Evaluate(true, &cost, NULL, NULL, scratch);
+  residual_block.Evaluate(true, &cost, nullptr, nullptr, scratch);
   EXPECT_EQ(0.5 * (0 * 0 + 1 * 1 + 2 * 2), cost);
 
   // Verify cost and residual evaluation.
   double residuals[3];
-  residual_block.Evaluate(true, &cost, residuals, NULL, scratch);
+  residual_block.Evaluate(true, &cost, residuals, nullptr, scratch);
   EXPECT_EQ(0.5 * (0 * 0 + 1 * 1 + 2 * 2), cost);
   EXPECT_EQ(0.0, residuals[0]);
   EXPECT_EQ(1.0, residuals[1]);
@@ -311,7 +311,7 @@
   jacobian_ry.setConstant(-1.0);
   jacobian_rz.setConstant(-1.0);
 
-  jacobian_ptrs[1] = NULL;  // Don't compute the jacobian for y.
+  jacobian_ptrs[1] = nullptr;  // Don't compute the jacobian for y.
 
   residual_block.Evaluate(true, &cost, residuals, jacobian_ptrs, scratch);
   EXPECT_EQ(0.5 * (0 * 0 + 1 * 1 + 2 * 2), cost);
diff --git a/internal/ceres/residual_block_utils.cc b/internal/ceres/residual_block_utils.cc
index d5b3fa1..17cf619 100644
--- a/internal/ceres/residual_block_utils.cc
+++ b/internal/ceres/residual_block_utils.cc
@@ -56,7 +56,7 @@
 
   InvalidateArray(1, cost);
   InvalidateArray(num_residuals, residuals);
-  if (jacobians != NULL) {
+  if (jacobians != nullptr) {
     for (int i = 0; i < num_parameter_blocks; ++i) {
       const int parameter_block_size = block.parameter_blocks()[i]->Size();
       InvalidateArray(num_residuals * parameter_block_size, jacobians[i]);
@@ -104,9 +104,9 @@
       StringAppendF(&result, "| ");
       for (int k = 0; k < num_residuals; ++k) {
         AppendArrayToString(1,
-                            (jacobians != NULL && jacobians[i] != NULL)
+                            (jacobians != nullptr && jacobians[i] != nullptr)
                                 ? jacobians[i] + k * parameter_block_size + j
-                                : NULL,
+                                : nullptr,
                             &result);
       }
       StringAppendF(&result, "\n");
@@ -129,7 +129,7 @@
     return false;
   }
 
-  if (jacobians != NULL) {
+  if (jacobians != nullptr) {
     for (int i = 0; i < num_parameter_blocks; ++i) {
       const int parameter_block_size = block.parameter_blocks()[i]->Size();
       if (!IsArrayValid(num_residuals * parameter_block_size, jacobians[i])) {
diff --git a/internal/ceres/residual_block_utils.h b/internal/ceres/residual_block_utils.h
index 41ae81a..1ffff8e 100644
--- a/internal/ceres/residual_block_utils.h
+++ b/internal/ceres/residual_block_utils.h
@@ -52,7 +52,7 @@
 
 class ResidualBlock;
 
-// Invalidate cost, resdual and jacobian arrays (if not NULL).
+// Invalidate cost, resdual and jacobian arrays (if not nullptr).
 void InvalidateEvaluation(const ResidualBlock& block,
                           double* cost,
                           double* residuals,
diff --git a/internal/ceres/residual_block_utils_test.cc b/internal/ceres/residual_block_utils_test.cc
index 331f5ab..2254619 100644
--- a/internal/ceres/residual_block_utils_test.cc
+++ b/internal/ceres/residual_block_utils_test.cc
@@ -51,7 +51,7 @@
   std::vector<ParameterBlock*> parameter_blocks;
   parameter_blocks.push_back(&parameter_block);
 
-  ResidualBlock residual_block(&cost_function, NULL, parameter_blocks, -1);
+  ResidualBlock residual_block(&cost_function, nullptr, parameter_blocks, -1);
 
   std::unique_ptr<double[]> scratch(
       new double[residual_block.NumScratchDoublesForEvaluate()]);
@@ -74,7 +74,7 @@
                 double* residuals,
                 double** jacobians) const final {
     residuals[0] = 1;
-    if (jacobians != NULL && jacobians[0] != NULL) {
+    if (jacobians != nullptr && jacobians[0] != nullptr) {
       jacobians[0][0] = 0.0;
     }
     return true;
@@ -90,7 +90,7 @@
                 double** jacobians) const final {
     // Forget to update the residuals.
     // residuals[0] = 1;
-    if (jacobians != NULL && jacobians[0] != NULL) {
+    if (jacobians != nullptr && jacobians[0] != nullptr) {
       jacobians[0][0] = 0.0;
     }
     return true;
@@ -103,7 +103,7 @@
                 double* residuals,
                 double** jacobians) const final {
     residuals[0] = 1;
-    if (jacobians != NULL && jacobians[0] != NULL) {
+    if (jacobians != nullptr && jacobians[0] != nullptr) {
       // Forget to update the jacobians.
       // jacobians[0][0] = 0.0;
     }
@@ -117,7 +117,7 @@
                 double* residuals,
                 double** jacobians) const final {
     residuals[0] = std::numeric_limits<double>::infinity();
-    if (jacobians != NULL && jacobians[0] != NULL) {
+    if (jacobians != nullptr && jacobians[0] != nullptr) {
       jacobians[0][0] = 0.0;
     }
     return true;
@@ -130,7 +130,7 @@
                 double* residuals,
                 double** jacobians) const final {
     residuals[0] = 1.0;
-    if (jacobians != NULL && jacobians[0] != NULL) {
+    if (jacobians != nullptr && jacobians[0] != nullptr) {
       jacobians[0][0] = std::numeric_limits<double>::quiet_NaN();
     }
     return true;
diff --git a/internal/ceres/rotation_test.cc b/internal/ceres/rotation_test.cc
index e28185c..951d7ca 100644
--- a/internal/ceres/rotation_test.cc
+++ b/internal/ceres/rotation_test.cc
@@ -687,7 +687,7 @@
 bool IsClose(double x, double y) {
   EXPECT_FALSE(isnan(x));
   EXPECT_FALSE(isnan(y));
-  return internal::IsClose(x, y, kTolerance, NULL, NULL);
+  return internal::IsClose(x, y, kTolerance, nullptr, nullptr);
 }
 
 }  // namespace
diff --git a/internal/ceres/schur_complement_solver.cc b/internal/ceres/schur_complement_solver.cc
index 57419c2..15c1629 100644
--- a/internal/ceres/schur_complement_solver.cc
+++ b/internal/ceres/schur_complement_solver.cc
@@ -150,9 +150,9 @@
     // mechanism that does not cause binary bloat.
     if (options_.row_block_size == 2 && options_.e_block_size == 3 &&
         options_.f_block_size == 6 && num_f_blocks == 1) {
-      eliminator_.reset(new SchurEliminatorForOneFBlock<2, 3, 6>);
+      eliminator_ = std::make_unique<SchurEliminatorForOneFBlock<2, 3, 6>>();
     } else {
-      eliminator_.reset(SchurEliminatorBase::Create(options_));
+      eliminator_ = SchurEliminatorBase::Create(options_);
     }
 
     CHECK(eliminator_);
@@ -202,8 +202,8 @@
     blocks[j] = bs->cols[i].size;
   }
 
-  set_lhs(new BlockRandomAccessDenseMatrix(blocks));
-  set_rhs(new double[lhs()->num_rows()]);
+  set_lhs(std::make_unique<BlockRandomAccessDenseMatrix>(blocks));
+  set_rhs(std::make_unique<double[]>(lhs()->num_rows()));
 }
 
 // Solve the system Sx = r, assuming that the matrix S is stored in a
@@ -309,8 +309,9 @@
     }
   }
 
-  set_lhs(new BlockRandomAccessSparseMatrix(blocks_, block_pairs));
-  set_rhs(new double[lhs()->num_rows()]);
+  set_lhs(
+      std::make_unique<BlockRandomAccessSparseMatrix>(blocks_, block_pairs));
+  set_rhs(std::make_unique<double[]>(lhs()->num_rows()));
 }
 
 LinearSolver::Summary SparseSchurComplementSolver::SolveReducedLinearSystem(
@@ -335,11 +336,10 @@
   const CompressedRowSparseMatrix::StorageType storage_type =
       sparse_cholesky_->StorageType();
   if (storage_type == CompressedRowSparseMatrix::UPPER_TRIANGULAR) {
-    lhs.reset(CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm));
+    lhs = CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm);
     lhs->set_storage_type(CompressedRowSparseMatrix::UPPER_TRIANGULAR);
   } else {
-    lhs.reset(
-        CompressedRowSparseMatrix::FromTripletSparseMatrixTransposed(*tsm));
+    lhs = CompressedRowSparseMatrix::FromTripletSparseMatrixTransposed(*tsm);
     lhs->set_storage_type(CompressedRowSparseMatrix::LOWER_TRIANGULAR);
   }
 
@@ -371,7 +371,8 @@
   CHECK_EQ(options().preconditioner_type, SCHUR_JACOBI);
 
   if (preconditioner_.get() == nullptr) {
-    preconditioner_.reset(new BlockRandomAccessDiagonalMatrix(blocks_));
+    preconditioner_ =
+        std::make_unique<BlockRandomAccessDiagonalMatrix>(blocks_);
   }
 
   BlockRandomAccessSparseMatrix* sc =
@@ -401,10 +402,11 @@
 
   VectorRef(solution, num_rows).setZero();
 
-  std::unique_ptr<LinearOperator> lhs_adapter(
-      new BlockRandomAccessSparseMatrixAdapter(*sc));
-  std::unique_ptr<LinearOperator> preconditioner_adapter(
-      new BlockRandomAccessDiagonalMatrixAdapter(*preconditioner_));
+  std::unique_ptr<LinearOperator> lhs_adapter =
+      std::make_unique<BlockRandomAccessSparseMatrixAdapter>(*sc);
+  std::unique_ptr<LinearOperator> preconditioner_adapter =
+      std::make_unique<BlockRandomAccessDiagonalMatrixAdapter>(
+          *preconditioner_);
 
   LinearSolver::Options cg_options;
   cg_options.min_num_iterations = options().min_num_iterations;
diff --git a/internal/ceres/schur_complement_solver.h b/internal/ceres/schur_complement_solver.h
index b7cb1d9..3d343bf 100644
--- a/internal/ceres/schur_complement_solver.h
+++ b/internal/ceres/schur_complement_solver.h
@@ -125,11 +125,13 @@
  protected:
   const LinearSolver::Options& options() const { return options_; }
 
-  void set_lhs(BlockRandomAccessMatrix* lhs) { lhs_.reset(lhs); }
+  void set_lhs(std::unique_ptr<BlockRandomAccessMatrix> lhs) {
+    lhs_ = std::move(lhs);
+  }
   const BlockRandomAccessMatrix* lhs() const { return lhs_.get(); }
   BlockRandomAccessMatrix* mutable_lhs() { return lhs_.get(); }
 
-  void set_rhs(double* rhs) { rhs_.reset(rhs); }
+  void set_rhs(std::unique_ptr<double[]> rhs) { rhs_ = std::move(rhs); }
   const double* rhs() const { return rhs_.get(); }
 
  private:
diff --git a/internal/ceres/schur_complement_solver_test.cc b/internal/ceres/schur_complement_solver_test.cc
index 550733e..e943ed1 100644
--- a/internal/ceres/schur_complement_solver_test.cc
+++ b/internal/ceres/schur_complement_solver_test.cc
@@ -51,13 +51,13 @@
 class SchurComplementSolverTest : public ::testing::Test {
  protected:
   void SetUpFromProblemId(int problem_id) {
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(problem_id));
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(problem_id);
 
     CHECK(problem != nullptr);
     A.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
-    b.reset(problem->b.release());
-    D.reset(problem->D.release());
+    b = std::move(problem->b);
+    D = std::move(problem->D);
 
     num_cols = A->num_cols();
     num_rows = A->num_rows();
diff --git a/internal/ceres/schur_eliminator.cc b/internal/ceres/schur_eliminator.cc
index 613ae95..bcffbe6 100644
--- a/internal/ceres/schur_eliminator.cc
+++ b/internal/ceres/schur_eliminator.cc
@@ -45,115 +45,116 @@
 namespace ceres {
 namespace internal {
 
-SchurEliminatorBase* SchurEliminatorBase::Create(
+std::unique_ptr<SchurEliminatorBase> SchurEliminatorBase::Create(
     const LinearSolver::Options& options) {
 #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 2) &&
      (options.f_block_size == 2)) {
-    return new SchurEliminator<2, 2, 2>(options);
+    return std::make_unique<SchurEliminator<2, 2, 2>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 2) &&
      (options.f_block_size == 3)) {
-    return new SchurEliminator<2, 2, 3>(options);
+    return std::make_unique<SchurEliminator<2, 2, 3>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 2) &&
      (options.f_block_size == 4)) {
-    return new SchurEliminator<2, 2, 4>(options);
+    return std::make_unique<SchurEliminator<2, 2, 4>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 2)) {
-    return new SchurEliminator<2, 2, Eigen::Dynamic>(options);
+    return std::make_unique<SchurEliminator<2, 2, Eigen::Dynamic>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 3) &&
      (options.f_block_size == 3)) {
-    return new SchurEliminator<2, 3, 3>(options);
+    return std::make_unique<SchurEliminator<2, 3, 3>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 3) &&
      (options.f_block_size == 4)) {
-    return new SchurEliminator<2, 3, 4>(options);
+    return std::make_unique<SchurEliminator<2, 3, 4>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 3) &&
      (options.f_block_size == 6)) {
-    return new SchurEliminator<2, 3, 6>(options);
+    return std::make_unique<SchurEliminator<2, 3, 6>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 3) &&
      (options.f_block_size == 9)) {
-    return new SchurEliminator<2, 3, 9>(options);
+    return std::make_unique<SchurEliminator<2, 3, 9>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 3)) {
-    return new SchurEliminator<2, 3, Eigen::Dynamic>(options);
+    return std::make_unique<SchurEliminator<2, 3, Eigen::Dynamic>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 3)) {
-    return new SchurEliminator<2, 4, 3>(options);
+    return std::make_unique<SchurEliminator<2, 4, 3>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 4)) {
-    return new SchurEliminator<2, 4, 4>(options);
+    return std::make_unique<SchurEliminator<2, 4, 4>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 6)) {
-    return new SchurEliminator<2, 4, 6>(options);
+    return std::make_unique<SchurEliminator<2, 4, 6>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 8)) {
-    return new SchurEliminator<2, 4, 8>(options);
+    return std::make_unique<SchurEliminator<2, 4, 8>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 9)) {
-    return new SchurEliminator<2, 4, 9>(options);
+    return std::make_unique<SchurEliminator<2, 4, 9>>(options);
   }
   if ((options.row_block_size == 2) &&
      (options.e_block_size == 4)) {
-    return new SchurEliminator<2, 4, Eigen::Dynamic>(options);
+    return std::make_unique<SchurEliminator<2, 4, Eigen::Dynamic>>(options);
   }
   if (options.row_block_size == 2) {
-    return new SchurEliminator<2, Eigen::Dynamic, Eigen::Dynamic>(options);
+    return std::make_unique<SchurEliminator<2, Eigen::Dynamic, Eigen::Dynamic>>(options);
   }
   if ((options.row_block_size == 3) &&
      (options.e_block_size == 3) &&
      (options.f_block_size == 3)) {
-    return new SchurEliminator<3, 3, 3>(options);
+    return std::make_unique<SchurEliminator<3, 3, 3>>(options);
   }
   if ((options.row_block_size == 4) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 2)) {
-    return new SchurEliminator<4, 4, 2>(options);
+    return std::make_unique<SchurEliminator<4, 4, 2>>(options);
   }
   if ((options.row_block_size == 4) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 3)) {
-    return new SchurEliminator<4, 4, 3>(options);
+    return std::make_unique<SchurEliminator<4, 4, 3>>(options);
   }
   if ((options.row_block_size == 4) &&
      (options.e_block_size == 4) &&
      (options.f_block_size == 4)) {
-    return new SchurEliminator<4, 4, 4>(options);
+    return std::make_unique<SchurEliminator<4, 4, 4>>(options);
   }
   if ((options.row_block_size == 4) &&
      (options.e_block_size == 4)) {
-    return new SchurEliminator<4, 4, Eigen::Dynamic>(options);
+    return std::make_unique<SchurEliminator<4, 4, Eigen::Dynamic>>(options);
   }
 
 #endif
   VLOG(1) << "Template specializations not found for <"
           << options.row_block_size << "," << options.e_block_size << ","
           << options.f_block_size << ">";
-  return new SchurEliminator<Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic>(
-      options);
+  return std::make_unique<SchurEliminator<Eigen::Dynamic,
+                                          Eigen::Dynamic,
+                                          Eigen::Dynamic>>(options);
 }
 
 }  // namespace internal
diff --git a/internal/ceres/schur_eliminator.h b/internal/ceres/schur_eliminator.h
index a9eada5..cf7a3e4 100644
--- a/internal/ceres/schur_eliminator.h
+++ b/internal/ceres/schur_eliminator.h
@@ -209,7 +209,8 @@
                               const double* z,
                               double* y) = 0;
   // Factory
-  static SchurEliminatorBase* Create(const LinearSolver::Options& options);
+  static std::unique_ptr<SchurEliminatorBase> Create(
+      const LinearSolver::Options& options);
 };
 
 // Templated implementation of the SchurEliminatorBase interface. The
@@ -483,7 +484,7 @@
       Eigen::Matrix<double, kFBlockSize, 1> f_t_b;
 
       // Add the square of the diagonal to e_t_e.
-      if (D != NULL) {
+      if (D != nullptr) {
         const typename EigenTypes<kEBlockSize>::ConstVectorRef diag(
             D + bs->cols[e_block_id].position, kEBlockSize);
         e_t_e = diag.array().square().matrix().asDiagonal();
diff --git a/internal/ceres/schur_eliminator_benchmark.cc b/internal/ceres/schur_eliminator_benchmark.cc
index 73bdfd9..76ccfaa 100644
--- a/internal/ceres/schur_eliminator_benchmark.cc
+++ b/internal/ceres/schur_eliminator_benchmark.cc
@@ -88,7 +88,7 @@
       }
     }
 
-    matrix_.reset(new BlockSparseMatrix(bs));
+    matrix_ = std::make_unique<BlockSparseMatrix>(bs);
     double* values = matrix_->mutable_values();
     for (int i = 0; i < matrix_->num_nonzeros(); ++i) {
       values[i] = RandNormal();
@@ -98,7 +98,7 @@
     b_.setRandom();
 
     std::vector<int> blocks(1, kFBlockSize);
-    lhs_.reset(new BlockRandomAccessDenseMatrix(blocks));
+    lhs_ = std::make_unique<BlockRandomAccessDenseMatrix>(blocks);
     diagonal_.resize(matrix_->num_cols());
     diagonal_.setOnes();
     rhs_.resize(kFBlockSize);
@@ -192,7 +192,8 @@
   }
 }
 
-static void BM_SchurEliminatorForOneFBlockBackSubstitute(benchmark::State& state) {
+static void BM_SchurEliminatorForOneFBlockBackSubstitute(
+    benchmark::State& state) {
   const int num_e_blocks = state.range(0);
   BenchmarkData data(num_e_blocks);
   SchurEliminatorForOneFBlock<2, 3, 6> eliminator;
diff --git a/internal/ceres/schur_eliminator_impl.h b/internal/ceres/schur_eliminator_impl.h
index 9b2ff0e..271d4cb 100644
--- a/internal/ceres/schur_eliminator_impl.h
+++ b/internal/ceres/schur_eliminator_impl.h
@@ -159,12 +159,13 @@
 
   uneliminated_row_begins_ = chunk.start + chunk.size;
 
-  buffer_.reset(new double[buffer_size_ * num_threads_]);
+  buffer_ = std::make_unique<double[]>(buffer_size_ * num_threads_);
 
   // chunk_outer_product_buffer_ only needs to store e_block_size *
   // f_block_size, which is always less than buffer_size_, so we just
   // allocate buffer_size_ per thread.
-  chunk_outer_product_buffer_.reset(new double[buffer_size_ * num_threads_]);
+  chunk_outer_product_buffer_ =
+      std::make_unique<double[]>(buffer_size_ * num_threads_);
 
   STLDeleteElements(&rhs_locks_);
   rhs_locks_.resize(num_col_blocks - num_eliminate_blocks_);
@@ -191,7 +192,7 @@
   const int num_col_blocks = bs->cols.size();
 
   // Add the diagonal to the schur complement.
-  if (D != NULL) {
+  if (D != nullptr) {
     ParallelFor(context_,
                 num_eliminate_blocks_,
                 num_col_blocks,
@@ -201,7 +202,7 @@
                   int r, c, row_stride, col_stride;
                   CellInfo* cell_info = lhs->GetCell(
                       block_id, block_id, &r, &c, &row_stride, &col_stride);
-                  if (cell_info != NULL) {
+                  if (cell_info != nullptr) {
                     const int block_size = bs->cols[i].size;
                     typename EigenTypes<Eigen::Dynamic>::ConstVectorRef diag(
                         D + bs->cols[i].position, block_size);
@@ -243,7 +244,7 @@
         typename EigenTypes<kEBlockSize, kEBlockSize>::Matrix ete(e_block_size,
                                                                   e_block_size);
 
-        if (D != NULL) {
+        if (D != nullptr) {
           const typename EigenTypes<kEBlockSize>::ConstVectorRef diag(
               D + bs->cols[e_block_id].position, e_block_size);
           ete = diag.array().square().matrix().asDiagonal();
@@ -325,7 +326,7 @@
 
     typename EigenTypes<kEBlockSize, kEBlockSize>::Matrix ete(e_block_size,
                                                               e_block_size);
-    if (D != NULL) {
+    if (D != nullptr) {
       const typename EigenTypes<kEBlockSize>::ConstVectorRef diag(
           D + bs->cols[e_block_id].position, e_block_size);
       ete = diag.array().square().matrix().asDiagonal();
@@ -547,7 +548,7 @@
       int r, c, row_stride, col_stride;
       CellInfo* cell_info =
           lhs->GetCell(block1, block2, &r, &c, &row_stride, &col_stride);
-      if (cell_info != NULL) {
+      if (cell_info != nullptr) {
         const int block2_size = bs->cols[it2->first].size;
         std::lock_guard<std::mutex> l(cell_info->m);
         // clang-format off
@@ -625,7 +626,7 @@
     int r, c, row_stride, col_stride;
     CellInfo* cell_info =
         lhs->GetCell(block1, block1, &r, &c, &row_stride, &col_stride);
-    if (cell_info != NULL) {
+    if (cell_info != nullptr) {
       std::lock_guard<std::mutex> l(cell_info->m);
       // This multiply currently ignores the fact that this is a
       // symmetric outer product.
@@ -645,7 +646,7 @@
       int r, c, row_stride, col_stride;
       CellInfo* cell_info =
           lhs->GetCell(block1, block2, &r, &c, &row_stride, &col_stride);
-      if (cell_info != NULL) {
+      if (cell_info != nullptr) {
         const int block2_size = bs->cols[row.cells[j].block_id].size;
         std::lock_guard<std::mutex> l(cell_info->m);
         // clang-format off
@@ -680,7 +681,7 @@
     int r, c, row_stride, col_stride;
     CellInfo* cell_info =
         lhs->GetCell(block1, block1, &r, &c, &row_stride, &col_stride);
-    if (cell_info != NULL) {
+    if (cell_info != nullptr) {
       std::lock_guard<std::mutex> l(cell_info->m);
       // block += b1.transpose() * b1;
       // clang-format off
@@ -700,7 +701,7 @@
       int r, c, row_stride, col_stride;
       CellInfo* cell_info =
           lhs->GetCell(block1, block2, &r, &c, &row_stride, &col_stride);
-      if (cell_info != NULL) {
+      if (cell_info != nullptr) {
         // block += b1.transpose() * b2;
         std::lock_guard<std::mutex> l(cell_info->m);
         // clang-format off
diff --git a/internal/ceres/schur_eliminator_template.py b/internal/ceres/schur_eliminator_template.py
index 5051595..a6a8d56 100644
--- a/internal/ceres/schur_eliminator_template.py
+++ b/internal/ceres/schur_eliminator_template.py
@@ -130,20 +130,21 @@
 namespace ceres {
 namespace internal {
 
-SchurEliminatorBase* SchurEliminatorBase::Create(
+std::unique_ptr<SchurEliminatorBase> SchurEliminatorBase::Create(
     const LinearSolver::Options& options) {
 #ifndef CERES_RESTRICT_SCHUR_SPECIALIZATION
 """
 
-FACTORY = """  return new SchurEliminator<%s, %s, %s>(options);"""
+FACTORY = """  return std::make_unique<SchurEliminator<%s, %s, %s>>(options);"""
 
 FACTORY_FOOTER = """
 #endif
   VLOG(1) << "Template specializations not found for <"
           << options.row_block_size << "," << options.e_block_size << ","
           << options.f_block_size << ">";
-  return new SchurEliminator<Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic>(
-      options);
+  return std::make_unique<SchurEliminator<Eigen::Dynamic,
+                                          Eigen::Dynamic,
+                                          Eigen::Dynamic>>(options);
 }
 
 }  // namespace internal
diff --git a/internal/ceres/schur_eliminator_test.cc b/internal/ceres/schur_eliminator_test.cc
index 6383ced..f586476 100644
--- a/internal/ceres/schur_eliminator_test.cc
+++ b/internal/ceres/schur_eliminator_test.cc
@@ -57,16 +57,16 @@
 class SchurEliminatorTest : public ::testing::Test {
  protected:
   void SetUpFromId(int id) {
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(id));
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(id);
     CHECK(problem != nullptr);
     SetupHelper(problem.get());
   }
 
   void SetupHelper(LinearLeastSquaresProblem* problem) {
     A.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
-    b.reset(problem->b.release());
-    D.reset(problem->D.release());
+    b = std::move(problem->b);
+    D = std::move(problem->D);
 
     num_eliminate_blocks = problem->num_eliminate_blocks;
     num_eliminate_cols = 0;
@@ -150,8 +150,8 @@
                       &options.f_block_size);
     }
 
-    std::unique_ptr<SchurEliminatorBase> eliminator;
-    eliminator.reset(SchurEliminatorBase::Create(options));
+    std::unique_ptr<SchurEliminatorBase> eliminator =
+        SchurEliminatorBase::Create(options);
     const bool kFullRankETE = true;
     eliminator->Init(num_eliminate_blocks, kFullRankETE, A->block_structure());
     eliminator->Eliminate(
diff --git a/internal/ceres/schur_jacobi_preconditioner.cc b/internal/ceres/schur_jacobi_preconditioner.cc
index 283cd4b..ffab66f 100644
--- a/internal/ceres/schur_jacobi_preconditioner.cc
+++ b/internal/ceres/schur_jacobi_preconditioner.cc
@@ -51,14 +51,14 @@
   const int num_blocks = bs.cols.size() - options_.elimination_groups[0];
   CHECK_GT(num_blocks, 0) << "Jacobian should have at least 1 f_block for "
                           << "SCHUR_JACOBI preconditioner.";
-  CHECK(options_.context != NULL);
+  CHECK(options_.context != nullptr);
 
   std::vector<int> blocks(num_blocks);
   for (int i = 0; i < num_blocks; ++i) {
     blocks[i] = bs.cols[i + options_.elimination_groups[0]].size;
   }
 
-  m_.reset(new BlockRandomAccessDiagonalMatrix(blocks));
+  m_ = std::make_unique<BlockRandomAccessDiagonalMatrix>(blocks);
   InitEliminator(bs);
 }
 
@@ -74,7 +74,7 @@
   eliminator_options.f_block_size = options_.f_block_size;
   eliminator_options.row_block_size = options_.row_block_size;
   eliminator_options.context = options_.context;
-  eliminator_.reset(SchurEliminatorBase::Create(eliminator_options));
+  eliminator_ = SchurEliminatorBase::Create(eliminator_options);
   const bool kFullRankETE = true;
   eliminator_->Init(
       eliminator_options.elimination_groups[0], kFullRankETE, &bs);
diff --git a/internal/ceres/schur_jacobi_preconditioner.h b/internal/ceres/schur_jacobi_preconditioner.h
index 7333988..81f584b 100644
--- a/internal/ceres/schur_jacobi_preconditioner.h
+++ b/internal/ceres/schur_jacobi_preconditioner.h
@@ -69,7 +69,7 @@
 //   options.elimination_groups.push_back(num_cameras);
 //   SchurJacobiPreconditioner preconditioner(
 //      *A.block_structure(), options);
-//   preconditioner.Update(A, NULL);
+//   preconditioner.Update(A, nullptr);
 //   preconditioner.RightMultiply(x, y);
 //
 class SchurJacobiPreconditioner : public BlockSparseMatrixPreconditioner {
diff --git a/internal/ceres/scratch_evaluate_preparer.cc b/internal/ceres/scratch_evaluate_preparer.cc
index d8fee30..a59694e 100644
--- a/internal/ceres/scratch_evaluate_preparer.cc
+++ b/internal/ceres/scratch_evaluate_preparer.cc
@@ -49,7 +49,8 @@
 }
 
 void ScratchEvaluatePreparer::Init(int max_derivatives_per_residual_block) {
-  jacobian_scratch_.reset(new double[max_derivatives_per_residual_block]);
+  jacobian_scratch_ =
+      std::make_unique<double[]>(max_derivatives_per_residual_block);
 }
 
 // Point the jacobian blocks into the scratch area of this evaluate preparer.
@@ -64,7 +65,7 @@
     const ParameterBlock* parameter_block =
         residual_block->parameter_blocks()[j];
     if (parameter_block->IsConstant()) {
-      jacobians[j] = NULL;
+      jacobians[j] = nullptr;
     } else {
       jacobians[j] = jacobian_block_cursor;
       jacobian_block_cursor += num_residuals * parameter_block->TangentSize();
diff --git a/internal/ceres/solver.cc b/internal/ceres/solver.cc
index 491f066..1d2420c 100644
--- a/internal/ceres/solver.cc
+++ b/internal/ceres/solver.cc
@@ -367,7 +367,7 @@
                                  &(summary->inner_iteration_ordering_used));
 
   // clang-format off
-  summary->inner_iterations_used          = pp.inner_iteration_minimizer.get() != NULL;     // NOLINT
+  summary->inner_iterations_used          = pp.inner_iteration_minimizer.get() != nullptr;     // NOLINT
   summary->linear_solver_type_used        = pp.linear_solver_options.type;
   summary->num_threads_used               = pp.options.num_threads;
   summary->preconditioner_type_used       = pp.options.preconditioner_type;
@@ -375,7 +375,7 @@
 
   internal::SetSummaryFinalCost(summary);
 
-  if (pp.reduced_program.get() != NULL) {
+  if (pp.reduced_program.get() != nullptr) {
     SummarizeReducedProgram(*pp.reduced_program, summary);
   }
 
@@ -385,7 +385,7 @@
   // case if the preprocessor failed, or if the reduced problem did
   // not contain any parameter blocks. Thus, only extract the
   // evaluator statistics if one exists.
-  if (pp.evaluator.get() != NULL) {
+  if (pp.evaluator.get() != nullptr) {
     const map<string, CallStatistics>& evaluator_statistics =
         pp.evaluator->Statistics();
     {
@@ -407,7 +407,7 @@
   // Again, like the evaluator, there may or may not be a linear
   // solver from which we can extract run time statistics. In
   // particular the line search solver does not use a linear solver.
-  if (pp.linear_solver.get() != NULL) {
+  if (pp.linear_solver.get() != nullptr) {
     const map<string, CallStatistics>& linear_solver_statistics =
         pp.linear_solver->Statistics();
     const CallStatistics& call_stats = FindWithDefault(
@@ -518,11 +518,11 @@
   Solver::Options modified_options = options;
   if (options.check_gradients) {
     modified_options.callbacks.push_back(&gradient_checking_callback);
-    gradient_checking_problem.reset(CreateGradientCheckingProblemImpl(
+    gradient_checking_problem = CreateGradientCheckingProblemImpl(
         problem_impl,
         options.gradient_check_numeric_derivative_relative_step_size,
         options.gradient_check_relative_precision,
-        &gradient_checking_callback));
+        &gradient_checking_callback);
     problem_impl = gradient_checking_problem.get();
     program = problem_impl->mutable_program();
   }
diff --git a/internal/ceres/sparse_normal_cholesky_solver.cc b/internal/ceres/sparse_normal_cholesky_solver.cc
index 1ffce8f..2e52ae6 100644
--- a/internal/ceres/sparse_normal_cholesky_solver.cc
+++ b/internal/ceres/sparse_normal_cholesky_solver.cc
@@ -75,21 +75,21 @@
   A->LeftMultiply(b, rhs_.data());
   event_logger.AddEvent("Compute RHS");
 
-  if (per_solve_options.D != NULL) {
+  if (per_solve_options.D != nullptr) {
     // Temporarily append a diagonal block to the A matrix, but undo
     // it before returning the matrix to the user.
-    std::unique_ptr<BlockSparseMatrix> regularizer;
-    regularizer.reset(BlockSparseMatrix::CreateDiagonalMatrix(
-        per_solve_options.D, A->block_structure()->cols));
+    std::unique_ptr<BlockSparseMatrix> regularizer =
+        BlockSparseMatrix::CreateDiagonalMatrix(per_solve_options.D,
+                                                A->block_structure()->cols);
     event_logger.AddEvent("Diagonal");
     A->AppendRows(*regularizer);
     event_logger.AddEvent("Append");
   }
   event_logger.AddEvent("Append Rows");
 
-  if (inner_product_computer_.get() == NULL) {
-    inner_product_computer_.reset(
-        InnerProductComputer::Create(*A, sparse_cholesky_->StorageType()));
+  if (inner_product_computer_.get() == nullptr) {
+    inner_product_computer_ =
+        InnerProductComputer::Create(*A, sparse_cholesky_->StorageType());
 
     event_logger.AddEvent("InnerProductComputer::Create");
   }
@@ -97,7 +97,7 @@
   inner_product_computer_->Compute();
   event_logger.AddEvent("InnerProductComputer::Compute");
 
-  if (per_solve_options.D != NULL) {
+  if (per_solve_options.D != nullptr) {
     A->DeleteRowBlocks(A->block_structure()->cols.size());
   }
 
diff --git a/internal/ceres/sparse_normal_cholesky_solver_test.cc b/internal/ceres/sparse_normal_cholesky_solver_test.cc
index 8acb98e..2b00dcd 100644
--- a/internal/ceres/sparse_normal_cholesky_solver_test.cc
+++ b/internal/ceres/sparse_normal_cholesky_solver_test.cc
@@ -54,20 +54,20 @@
 class SparseNormalCholeskySolverTest : public ::testing::Test {
  protected:
   void SetUp() final {
-    std::unique_ptr<LinearLeastSquaresProblem> problem(
-        CreateLinearLeastSquaresProblemFromId(2));
+    std::unique_ptr<LinearLeastSquaresProblem> problem =
+        CreateLinearLeastSquaresProblemFromId(2);
 
     CHECK(problem != nullptr);
     A_.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
-    b_.reset(problem->b.release());
-    D_.reset(problem->D.release());
+    b_ = std::move(problem->b);
+    D_ = std::move(problem->D);
   }
 
   void TestSolver(const LinearSolver::Options& options, double* D) {
     Matrix dense_A;
     A_->ToDenseMatrix(&dense_A);
     Matrix lhs = dense_A.transpose() * dense_A;
-    if (D != NULL) {
+    if (D != nullptr) {
       lhs += (ConstVectorRef(D, A_->num_cols()).array() *
               ConstVectorRef(D, A_->num_cols()).array())
                  .matrix()
@@ -97,7 +97,7 @@
   }
 
   void TestSolver(const LinearSolver::Options& options) {
-    TestSolver(options, NULL);
+    TestSolver(options, nullptr);
     TestSolver(options, D_.get());
   }
 
diff --git a/internal/ceres/stl_util.h b/internal/ceres/stl_util.h
index d3411b7..2af2518 100644
--- a/internal/ceres/stl_util.h
+++ b/internal/ceres/stl_util.h
@@ -73,7 +73,7 @@
 // hash_set, or any other STL container which defines sensible begin(), end(),
 // and clear() methods.
 //
-// If container is NULL, this function is a no-op.
+// If container is nullptr, this function is a no-op.
 //
 // As an alternative to calling STLDeleteElements() directly, consider
 // ElementDeleter (defined below), which ensures that your container's elements
diff --git a/internal/ceres/stringprintf.cc b/internal/ceres/stringprintf.cc
index b0e2acc..def40fe 100644
--- a/internal/ceres/stringprintf.cc
+++ b/internal/ceres/stringprintf.cc
@@ -66,7 +66,7 @@
     // Error or MSVC running out of space.  MSVC 8.0 and higher
     // can be asked about space needed with the special idiom below:
     va_copy(backup_ap, ap);
-    result = vsnprintf(NULL, 0, format, backup_ap);
+    result = vsnprintf(nullptr, 0, format, backup_ap);
     va_end(backup_ap);
 #endif
 
diff --git a/internal/ceres/subset_preconditioner.cc b/internal/ceres/subset_preconditioner.cc
index e5146ce..b6b0c2e 100644
--- a/internal/ceres/subset_preconditioner.cc
+++ b/internal/ceres/subset_preconditioner.cc
@@ -73,7 +73,7 @@
   //     [Q]
 
   // Now add D to A if needed.
-  if (D != NULL) {
+  if (D != nullptr) {
     // A = [P]
     //     [Q]
     //     [D]
@@ -82,19 +82,19 @@
     m->AppendRows(*regularizer);
   }
 
-  if (inner_product_computer_.get() == NULL) {
-    inner_product_computer_.reset(InnerProductComputer::Create(
+  if (inner_product_computer_ == nullptr) {
+    inner_product_computer_ = InnerProductComputer::Create(
         *m,
         options_.subset_preconditioner_start_row_block,
         bs->rows.size(),
-        sparse_cholesky_->StorageType()));
+        sparse_cholesky_->StorageType());
   }
 
   // Compute inner_product = [Q'*Q + D'*D]
   inner_product_computer_->Compute();
 
   // Unappend D if needed.
-  if (D != NULL) {
+  if (D != nullptr) {
     // A = [P]
     //     [Q]
     m->DeleteRowBlocks(bs->cols.size());
diff --git a/internal/ceres/subset_preconditioner_test.cc b/internal/ceres/subset_preconditioner_test.cc
index 202110b..7d606f1 100644
--- a/internal/ceres/subset_preconditioner_test.cc
+++ b/internal/ceres/subset_preconditioner_test.cc
@@ -99,28 +99,28 @@
     options.max_row_block_size = 4;
     options.block_density = 0.9;
 
-    m_.reset(BlockSparseMatrix::CreateRandomMatrix(options));
+    m_ = BlockSparseMatrix::CreateRandomMatrix(options);
     start_row_block_ = m_->block_structure()->rows.size();
 
     // Ensure that the bottom part of the matrix has the same column
     // block structure.
     options.col_blocks = m_->block_structure()->cols;
-    b_.reset(BlockSparseMatrix::CreateRandomMatrix(options));
+    b_ = BlockSparseMatrix::CreateRandomMatrix(options);
     m_->AppendRows(*b_);
 
     // Create a Identity block diagonal matrix with the same column
     // block structure.
     diagonal_ = Vector::Ones(m_->num_cols());
-    block_diagonal_.reset(BlockSparseMatrix::CreateDiagonalMatrix(
-        diagonal_.data(), b_->block_structure()->cols));
+    block_diagonal_ = BlockSparseMatrix::CreateDiagonalMatrix(
+        diagonal_.data(), b_->block_structure()->cols);
 
     // Unconditionally add the block diagonal to the matrix b_,
     // because either it is either part of b_ to make it full rank, or
     // we pass the same diagonal matrix later as the parameter D. In
     // either case the preconditioner matrix is b_' b + D'D.
     b_->AppendRows(*block_diagonal_);
-    inner_product_computer_.reset(InnerProductComputer::Create(
-        *b_, CompressedRowSparseMatrix::UPPER_TRIANGULAR));
+    inner_product_computer_ = InnerProductComputer::Create(
+        *b_, CompressedRowSparseMatrix::UPPER_TRIANGULAR);
     inner_product_computer_->Compute();
   }
 
@@ -138,7 +138,7 @@
   Preconditioner::Options options;
   options.subset_preconditioner_start_row_block = start_row_block_;
   options.sparse_linear_algebra_library_type = ::testing::get<0>(param);
-  preconditioner_.reset(new SubsetPreconditioner(options, *m_));
+  preconditioner_ = std::make_unique<SubsetPreconditioner>(options, *m_);
 
   const bool with_diagonal = ::testing::get<1>(param);
   if (!with_diagonal) {
@@ -146,7 +146,7 @@
   }
 
   EXPECT_TRUE(
-      preconditioner_->Update(*m_, with_diagonal ? diagonal_.data() : NULL));
+      preconditioner_->Update(*m_, with_diagonal ? diagonal_.data() : nullptr));
 
   // Repeatedly apply the preconditioner to random vectors and check
   // that the preconditioned value is the same as one obtained by
diff --git a/internal/ceres/suitesparse.cc b/internal/ceres/suitesparse.cc
index 0d6f6bd..ce8ac65 100644
--- a/internal/ceres/suitesparse.cc
+++ b/internal/ceres/suitesparse.cc
@@ -368,7 +368,7 @@
 LinearSolverTerminationType SuiteSparseCholesky::Factorize(
     CompressedRowSparseMatrix* lhs, string* message) {
   if (lhs == nullptr) {
-    *message = "Failure: Input lhs is NULL.";
+    *message = "Failure: Input lhs is nullptr.";
     return LINEAR_SOLVER_FATAL_ERROR;
   }
 
diff --git a/internal/ceres/suitesparse.h b/internal/ceres/suitesparse.h
index a98c946..8802774 100644
--- a/internal/ceres/suitesparse.h
+++ b/internal/ceres/suitesparse.h
@@ -106,7 +106,7 @@
   cholmod_dense CreateDenseVectorView(const double* x, int size);
 
   // Given a vector x, build a cholmod_dense vector of size out_size
-  // with the first in_size entries copied from x. If x is NULL, then
+  // with the first in_size entries copied from x. If x is nullptr, then
   // an all zeros vector is returned. Caller owns the result.
   cholmod_dense* CreateDenseVector(const double* x, int in_size, int out_size);
 
@@ -123,7 +123,7 @@
   // Create and return a matrix m = A * A'. Caller owns the
   // result. The matrix A is not modified.
   cholmod_sparse* AATranspose(cholmod_sparse* A) {
-    cholmod_sparse* m = cholmod_aat(A, NULL, A->nrow, 1, &cc_);
+    cholmod_sparse* m = cholmod_aat(A, nullptr, A->nrow, 1, &cc_);
     m->stype = 1;  // Pay attention to the upper triangular part.
     return m;
   }
@@ -196,7 +196,7 @@
 
   // Given a Cholesky factorization of a matrix A = LL^T, solve the
   // linear system Ax = b, and return the result. If the Solve fails
-  // NULL is returned. Caller owns the result.
+  // nullptr is returned. Caller owns the result.
   //
   // message contains an explanation of the failures if any.
   cholmod_dense* Solve(cholmod_factor* L,
diff --git a/internal/ceres/system_test.cc b/internal/ceres/system_test.cc
index 11b0504..3f4450a 100644
--- a/internal/ceres/system_test.cc
+++ b/internal/ceres/system_test.cc
@@ -70,13 +70,13 @@
     x_[3] = 1.0;
 
     problem_.AddResidualBlock(
-        new AutoDiffCostFunction<F1, 1, 1, 1>(new F1), NULL, &x_[0], &x_[1]);
+        new AutoDiffCostFunction<F1, 1, 1, 1>(new F1), nullptr, &x_[0], &x_[1]);
     problem_.AddResidualBlock(
-        new AutoDiffCostFunction<F2, 1, 1, 1>(new F2), NULL, &x_[2], &x_[3]);
+        new AutoDiffCostFunction<F2, 1, 1, 1>(new F2), nullptr, &x_[2], &x_[3]);
     problem_.AddResidualBlock(
-        new AutoDiffCostFunction<F3, 1, 1, 1>(new F3), NULL, &x_[1], &x_[2]);
+        new AutoDiffCostFunction<F3, 1, 1, 1>(new F3), nullptr, &x_[1], &x_[2]);
     problem_.AddResidualBlock(
-        new AutoDiffCostFunction<F4, 1, 1, 1>(new F4), NULL, &x_[0], &x_[3]);
+        new AutoDiffCostFunction<F4, 1, 1, 1>(new F4), nullptr, &x_[0], &x_[3]);
 
     // Settings for the reference solution.
     options_.linear_solver_type = ceres::DENSE_QR;
diff --git a/internal/ceres/tiny_solver_cost_function_adapter_test.cc b/internal/ceres/tiny_solver_cost_function_adapter_test.cc
index 6f57193..ff8c070 100644
--- a/internal/ceres/tiny_solver_cost_function_adapter_test.cc
+++ b/internal/ceres/tiny_solver_cost_function_adapter_test.cc
@@ -85,8 +85,8 @@
   double* parameters[1] = {xyz};
 
   // Check that residual only evaluation works.
-  cost_function->Evaluate(parameters, expected_residuals.data(), NULL);
-  cfa(xyz, actual_residuals.data(), NULL);
+  cost_function->Evaluate(parameters, expected_residuals.data(), nullptr);
+  cfa(xyz, actual_residuals.data(), nullptr);
   EXPECT_NEAR(
       (expected_residuals - actual_residuals).norm() / actual_residuals.norm(),
       0.0,
diff --git a/internal/ceres/tiny_solver_test.cc b/internal/ceres/tiny_solver_test.cc
index 2e70694..45c021f 100644
--- a/internal/ceres/tiny_solver_test.cc
+++ b/internal/ceres/tiny_solver_test.cc
@@ -115,7 +115,7 @@
 void TestHelper(const Function& f, const Vector& x0) {
   Vector x = x0;
   Vec2 residuals;
-  f(x.data(), residuals.data(), NULL);
+  f(x.data(), residuals.data(), nullptr);
   EXPECT_GT(residuals.squaredNorm() / 2.0, 1e-10);
 
   TinySolver<Function> solver;
diff --git a/internal/ceres/triplet_sparse_matrix.cc b/internal/ceres/triplet_sparse_matrix.cc
index e4f7f9b..c409a59 100644
--- a/internal/ceres/triplet_sparse_matrix.cc
+++ b/internal/ceres/triplet_sparse_matrix.cc
@@ -123,9 +123,12 @@
   // Nothing to do if we have enough space already.
   if (new_max_num_nonzeros <= max_num_nonzeros_) return;
 
-  int* new_rows = new int[new_max_num_nonzeros];
-  int* new_cols = new int[new_max_num_nonzeros];
-  double* new_values = new double[new_max_num_nonzeros];
+  std::unique_ptr<int[]> new_rows =
+      std::make_unique<int[]>(new_max_num_nonzeros);
+  std::unique_ptr<int[]> new_cols =
+      std::make_unique<int[]>(new_max_num_nonzeros);
+  std::unique_ptr<double[]> new_values =
+      std::make_unique<double[]>(new_max_num_nonzeros);
 
   for (int i = 0; i < num_nonzeros_; ++i) {
     new_rows[i] = rows_[i];
@@ -133,10 +136,9 @@
     new_values[i] = values_[i];
   }
 
-  rows_.reset(new_rows);
-  cols_.reset(new_cols);
-  values_.reset(new_values);
-
+  rows_ = std::move(new_rows);
+  cols_ = std::move(new_cols);
+  values_ = std::move(new_values);
   max_num_nonzeros_ = new_max_num_nonzeros;
 }
 
@@ -152,9 +154,9 @@
 }
 
 void TripletSparseMatrix::AllocateMemory() {
-  rows_.reset(new int[max_num_nonzeros_]);
-  cols_.reset(new int[max_num_nonzeros_]);
-  values_.reset(new double[max_num_nonzeros_]);
+  rows_ = std::make_unique<int[]>(max_num_nonzeros_);
+  cols_ = std::make_unique<int[]>(max_num_nonzeros_);
+  values_ = std::make_unique<double[]>(max_num_nonzeros_);
 }
 
 void TripletSparseMatrix::CopyData(const TripletSparseMatrix& orig) {
@@ -252,10 +254,11 @@
   num_nonzeros_ -= dropped_terms;
 }
 
-TripletSparseMatrix* TripletSparseMatrix::CreateSparseDiagonalMatrix(
-    const double* values, int num_rows) {
-  TripletSparseMatrix* m =
-      new TripletSparseMatrix(num_rows, num_rows, num_rows);
+std::unique_ptr<TripletSparseMatrix>
+TripletSparseMatrix::CreateSparseDiagonalMatrix(const double* values,
+                                                int num_rows) {
+  std::unique_ptr<TripletSparseMatrix> m =
+      std::make_unique<TripletSparseMatrix>(num_rows, num_rows, num_rows);
   for (int i = 0; i < num_rows; ++i) {
     m->mutable_rows()[i] = i;
     m->mutable_cols()[i] = i;
@@ -272,7 +275,7 @@
   }
 }
 
-TripletSparseMatrix* TripletSparseMatrix::CreateRandomMatrix(
+std::unique_ptr<TripletSparseMatrix> TripletSparseMatrix::CreateRandomMatrix(
     const TripletSparseMatrix::RandomMatrixOptions& options) {
   CHECK_GT(options.num_rows, 0);
   CHECK_GT(options.num_cols, 0);
@@ -297,7 +300,7 @@
     }
   }
 
-  return new TripletSparseMatrix(
+  return std::make_unique<TripletSparseMatrix>(
       options.num_rows, options.num_cols, rows, cols, values);
 }
 
diff --git a/internal/ceres/triplet_sparse_matrix.h b/internal/ceres/triplet_sparse_matrix.h
index daa4643..ba426c4 100644
--- a/internal/ceres/triplet_sparse_matrix.h
+++ b/internal/ceres/triplet_sparse_matrix.h
@@ -115,8 +115,8 @@
   // Build a sparse diagonal matrix of size num_rows x num_rows from
   // the array values. Entries of the values array are copied into the
   // sparse matrix.
-  static TripletSparseMatrix* CreateSparseDiagonalMatrix(const double* values,
-                                                         int num_rows);
+  static std::unique_ptr<TripletSparseMatrix> CreateSparseDiagonalMatrix(
+      const double* values, int num_rows);
 
   // Options struct to control the generation of random
   // TripletSparseMatrix objects.
@@ -132,9 +132,7 @@
   // Create a random CompressedRowSparseMatrix whose entries are
   // normally distributed and whose structure is determined by
   // RandomMatrixOptions.
-  //
-  // Caller owns the result.
-  static TripletSparseMatrix* CreateRandomMatrix(
+  static std::unique_ptr<TripletSparseMatrix> CreateRandomMatrix(
       const TripletSparseMatrix::RandomMatrixOptions& options);
 
  private:
diff --git a/internal/ceres/trust_region_minimizer.cc b/internal/ceres/trust_region_minimizer.cc
index 5e292bb..f8e6b29 100644
--- a/internal/ceres/trust_region_minimizer.cc
+++ b/internal/ceres/trust_region_minimizer.cc
@@ -75,11 +75,11 @@
   // Create the TrustRegionStepEvaluator. The construction needs to be
   // delayed to this point because we need the cost for the starting
   // point to initialize the step evaluator.
-  step_evaluator_.reset(new TrustRegionStepEvaluator(
+  step_evaluator_ = std::make_unique<TrustRegionStepEvaluator>(
       x_cost_,
       options_.use_nonmonotonic_steps
           ? options_.max_consecutive_nonmonotonic_steps
-          : 0));
+          : 0);
 
   while (FinalizeIterationAndCheckIfMinimizerCanContinue()) {
     iteration_start_time_in_secs_ = WallTimeInSeconds();
diff --git a/internal/ceres/trust_region_minimizer_test.cc b/internal/ceres/trust_region_minimizer_test.cc
index 7f2c931..d42aab0 100644
--- a/internal/ceres/trust_region_minimizer_test.cc
+++ b/internal/ceres/trust_region_minimizer_test.cc
@@ -79,10 +79,10 @@
   ~PowellEvaluator2() override = default;
 
   // Implementation of Evaluator interface.
-  SparseMatrix* CreateJacobian() const final {
+  std::unique_ptr<SparseMatrix> CreateJacobian() const final {
     CHECK(col1 || col2 || col3 || col4);
-    DenseSparseMatrix* dense_jacobian =
-        new DenseSparseMatrix(NumResiduals(), NumEffectiveParameters());
+    auto dense_jacobian = std::make_unique<DenseSparseMatrix>(
+        NumResiduals(), NumEffectiveParameters());
     dense_jacobian->SetZero();
     return dense_jacobian;
   }
@@ -119,14 +119,14 @@
 
     VLOG(1) << "Cost: " << *cost;
 
-    if (residuals != NULL) {
+    if (residuals != nullptr) {
       residuals[0] = f1;
       residuals[1] = f2;
       residuals[2] = f3;
       residuals[3] = f4;
     }
 
-    if (jacobian != NULL) {
+    if (jacobian != nullptr) {
       DenseSparseMatrix* dense_jacobian;
       dense_jacobian = down_cast<DenseSparseMatrix*>(jacobian);
       dense_jacobian->SetZero();
@@ -176,7 +176,7 @@
       VLOG(1) << "\n" << jacobian_matrix;
     }
 
-    if (gradient != NULL) {
+    if (gradient != nullptr) {
       int column_index = 0;
       if (col1) {
         gradient[column_index++] = f1 + f4 * sqrt(10.0) * 2.0 * (x1 - x4);
@@ -240,10 +240,9 @@
   minimizer_options.gradient_tolerance = 1e-26;
   minimizer_options.function_tolerance = 1e-26;
   minimizer_options.parameter_tolerance = 1e-26;
-  minimizer_options.evaluator.reset(
-      new PowellEvaluator2<col1, col2, col3, col4>);
-  minimizer_options.jacobian.reset(
-      minimizer_options.evaluator->CreateJacobian());
+  minimizer_options.evaluator =
+      std::make_unique<PowellEvaluator2<col1, col2, col3, col4>>();
+  minimizer_options.jacobian = minimizer_options.evaluator->CreateJacobian();
 
   TrustRegionStrategy::Options trust_region_strategy_options;
   trust_region_strategy_options.trust_region_strategy_type = strategy_type;
@@ -252,8 +251,8 @@
   trust_region_strategy_options.max_radius = 1e20;
   trust_region_strategy_options.min_lm_diagonal = 1e-6;
   trust_region_strategy_options.max_lm_diagonal = 1e32;
-  minimizer_options.trust_region_strategy.reset(
-      TrustRegionStrategy::Create(trust_region_strategy_options));
+  minimizer_options.trust_region_strategy =
+      TrustRegionStrategy::Create(trust_region_strategy_options);
 
   TrustRegionMinimizer minimizer;
   Solver::Summary summary;
@@ -343,12 +342,12 @@
       residuals[0] -= sqrt(length);
     }
 
-    if (jacobians == NULL) {
+    if (jacobians == nullptr) {
       return true;
     }
 
     for (int i = 0; i < num_vertices_; ++i) {
-      if (jacobians[i] != NULL) {
+      if (jacobians[i] != nullptr) {
         int prev = (num_vertices_ + i - 1) % num_vertices_;
         int next = (i + 1) % num_vertices_;
 
@@ -398,7 +397,7 @@
   }
 
   Problem problem;
-  problem.AddResidualBlock(new CurveCostFunction(N, 10.), NULL, y);
+  problem.AddResidualBlock(new CurveCostFunction(N, 10.), nullptr, y);
   Solver::Options options;
   options.linear_solver_type = ceres::DENSE_QR;
   Solver::Summary summary;
@@ -425,7 +424,7 @@
 TEST(TrustRegionMinimizer, GradientToleranceConvergenceUpdatesStep) {
   double x = 5;
   Problem problem;
-  problem.AddResidualBlock(ExpCostFunctor::Create(), NULL, &x);
+  problem.AddResidualBlock(ExpCostFunctor::Create(), nullptr, &x);
   problem.SetParameterLowerBound(&x, 0, 3.0);
   Solver::Options options;
   Solver::Summary summary;
diff --git a/internal/ceres/trust_region_preprocessor.cc b/internal/ceres/trust_region_preprocessor.cc
index fc76369..a6a8b9f 100644
--- a/internal/ceres/trust_region_preprocessor.cc
+++ b/internal/ceres/trust_region_preprocessor.cc
@@ -55,9 +55,10 @@
 
 namespace {
 
-ParameterBlockOrdering* CreateDefaultLinearSolverOrdering(
+std::shared_ptr<ParameterBlockOrdering> CreateDefaultLinearSolverOrdering(
     const Program& program) {
-  ParameterBlockOrdering* ordering = new ParameterBlockOrdering;
+  std::shared_ptr<ParameterBlockOrdering> ordering =
+      std::make_shared<ParameterBlockOrdering>();
   const vector<ParameterBlock*>& parameter_blocks = program.parameter_blocks();
   for (int i = 0; i < parameter_blocks.size(); ++i) {
     ordering->AddElementToGroup(
@@ -160,8 +161,8 @@
     // assume that they are giving all the freedom to us in choosing
     // the best possible ordering. This intent can be indicated by
     // putting all the parameter blocks in the same elimination group.
-    options.linear_solver_ordering.reset(
-        CreateDefaultLinearSolverOrdering(*pp->reduced_program));
+    options.linear_solver_ordering =
+        CreateDefaultLinearSolverOrdering(*pp->reduced_program);
   } else {
     // If the user supplied an ordering, then check if the first
     // elimination group is still non-empty after the reduced problem
@@ -247,7 +248,7 @@
     }
   }
 
-  pp->linear_solver.reset(LinearSolver::Create(pp->linear_solver_options));
+  pp->linear_solver = LinearSolver::Create(pp->linear_solver_options);
   return (pp->linear_solver != nullptr);
 }
 
@@ -269,8 +270,8 @@
   pp->evaluator_options.context = pp->problem->context();
   pp->evaluator_options.evaluation_callback =
       pp->reduced_program->mutable_evaluation_callback();
-  pp->evaluator.reset(Evaluator::Create(
-      pp->evaluator_options, pp->reduced_program.get(), &pp->error));
+  pp->evaluator = Evaluator::Create(
+      pp->evaluator_options, pp->reduced_program.get(), &pp->error);
 
   return (pp->evaluator != nullptr);
 }
@@ -316,12 +317,12 @@
     }
   } else {
     // The user did not supply an ordering, so create one.
-    options.inner_iteration_ordering.reset(
-        CoordinateDescentMinimizer::CreateOrdering(*pp->reduced_program));
+    options.inner_iteration_ordering =
+        CoordinateDescentMinimizer::CreateOrdering(*pp->reduced_program);
   }
 
-  pp->inner_iteration_minimizer.reset(
-      new CoordinateDescentMinimizer(pp->problem->context()));
+  pp->inner_iteration_minimizer =
+      std::make_unique<CoordinateDescentMinimizer>(pp->problem->context());
   return pp->inner_iteration_minimizer->Init(*pp->reduced_program,
                                              pp->problem->parameter_map(),
                                              *options.inner_iteration_ordering,
@@ -335,7 +336,7 @@
   SetupCommonMinimizerOptions(pp);
   pp->minimizer_options.is_constrained =
       pp->reduced_program->IsBoundsConstrained();
-  pp->minimizer_options.jacobian.reset(pp->evaluator->CreateJacobian());
+  pp->minimizer_options.jacobian = pp->evaluator->CreateJacobian();
   pp->minimizer_options.inner_iteration_minimizer =
       pp->inner_iteration_minimizer;
 
@@ -348,8 +349,8 @@
   strategy_options.trust_region_strategy_type =
       options.trust_region_strategy_type;
   strategy_options.dogleg_type = options.dogleg_type;
-  pp->minimizer_options.trust_region_strategy.reset(
-      TrustRegionStrategy::Create(strategy_options));
+  pp->minimizer_options.trust_region_strategy =
+      TrustRegionStrategy::Create(strategy_options);
   CHECK(pp->minimizer_options.trust_region_strategy != nullptr);
 }
 
@@ -370,10 +371,10 @@
     return false;
   }
 
-  pp->reduced_program.reset(program->CreateReducedProgram(
-      &pp->removed_parameter_blocks, &pp->fixed_cost, &pp->error));
+  pp->reduced_program = program->CreateReducedProgram(
+      &pp->removed_parameter_blocks, &pp->fixed_cost, &pp->error);
 
-  if (pp->reduced_program.get() == NULL) {
+  if (pp->reduced_program.get() == nullptr) {
     return false;
   }
 
diff --git a/internal/ceres/trust_region_preprocessor_test.cc b/internal/ceres/trust_region_preprocessor_test.cc
index ee93df3..fbec589 100644
--- a/internal/ceres/trust_region_preprocessor_test.cc
+++ b/internal/ceres/trust_region_preprocessor_test.cc
@@ -225,7 +225,7 @@
 TEST_F(LinearSolverAndEvaluatorCreationTest, SchurTypeSolverWithBadOrdering) {
   Solver::Options options;
   options.linear_solver_type = DENSE_SCHUR;
-  options.linear_solver_ordering.reset(new ParameterBlockOrdering);
+  options.linear_solver_ordering = std::make_shared<ParameterBlockOrdering>();
   options.linear_solver_ordering->AddElementToGroup(&x_, 0);
   options.linear_solver_ordering->AddElementToGroup(&y_, 0);
   options.linear_solver_ordering->AddElementToGroup(&z_, 1);
@@ -238,7 +238,7 @@
 TEST_F(LinearSolverAndEvaluatorCreationTest, SchurTypeSolverWithGoodOrdering) {
   Solver::Options options;
   options.linear_solver_type = DENSE_SCHUR;
-  options.linear_solver_ordering.reset(new ParameterBlockOrdering);
+  options.linear_solver_ordering = std::make_shared<ParameterBlockOrdering>();
   options.linear_solver_ordering->AddElementToGroup(&x_, 0);
   options.linear_solver_ordering->AddElementToGroup(&z_, 0);
   options.linear_solver_ordering->AddElementToGroup(&y_, 1);
@@ -260,7 +260,7 @@
 
   Solver::Options options;
   options.linear_solver_type = DENSE_SCHUR;
-  options.linear_solver_ordering.reset(new ParameterBlockOrdering);
+  options.linear_solver_ordering = std::make_shared<ParameterBlockOrdering>();
   options.linear_solver_ordering->AddElementToGroup(&x_, 0);
   options.linear_solver_ordering->AddElementToGroup(&z_, 0);
   options.linear_solver_ordering->AddElementToGroup(&y_, 1);
@@ -281,7 +281,7 @@
 
   Solver::Options options;
   options.linear_solver_type = DENSE_SCHUR;
-  options.linear_solver_ordering.reset(new ParameterBlockOrdering);
+  options.linear_solver_ordering = std::make_shared<ParameterBlockOrdering>();
   options.linear_solver_ordering->AddElementToGroup(&x_, 0);
   options.linear_solver_ordering->AddElementToGroup(&z_, 0);
   options.linear_solver_ordering->AddElementToGroup(&y_, 1);
@@ -328,7 +328,7 @@
 TEST_F(LinearSolverAndEvaluatorCreationTest, InvalidInnerIterationsOrdering) {
   Solver::Options options;
   options.use_inner_iterations = true;
-  options.inner_iteration_ordering.reset(new ParameterBlockOrdering);
+  options.inner_iteration_ordering = std::make_shared<ParameterBlockOrdering>();
   options.inner_iteration_ordering->AddElementToGroup(&x_, 0);
   options.inner_iteration_ordering->AddElementToGroup(&z_, 0);
   options.inner_iteration_ordering->AddElementToGroup(&y_, 0);
@@ -341,7 +341,7 @@
 TEST_F(LinearSolverAndEvaluatorCreationTest, ValidInnerIterationsOrdering) {
   Solver::Options options;
   options.use_inner_iterations = true;
-  options.inner_iteration_ordering.reset(new ParameterBlockOrdering);
+  options.inner_iteration_ordering = std::make_shared<ParameterBlockOrdering>();
   options.inner_iteration_ordering->AddElementToGroup(&x_, 0);
   options.inner_iteration_ordering->AddElementToGroup(&z_, 0);
   options.inner_iteration_ordering->AddElementToGroup(&y_, 1);
diff --git a/internal/ceres/trust_region_strategy.cc b/internal/ceres/trust_region_strategy.cc
index 235bf98..c6961a1 100644
--- a/internal/ceres/trust_region_strategy.cc
+++ b/internal/ceres/trust_region_strategy.cc
@@ -40,12 +40,13 @@
 
 TrustRegionStrategy::~TrustRegionStrategy() = default;
 
-TrustRegionStrategy* TrustRegionStrategy::Create(const Options& options) {
+std::unique_ptr<TrustRegionStrategy> TrustRegionStrategy::Create(
+    const Options& options) {
   switch (options.trust_region_strategy_type) {
     case LEVENBERG_MARQUARDT:
-      return new LevenbergMarquardtStrategy(options);
+      return std::make_unique<LevenbergMarquardtStrategy>(options);
     case DOGLEG:
-      return new DoglegStrategy(options);
+      return std::make_unique<DoglegStrategy>(options);
     default:
       LOG(FATAL) << "Unknown trust region strategy: "
                  << options.trust_region_strategy_type;
@@ -53,7 +54,7 @@
 
   LOG(FATAL) << "Unknown trust region strategy: "
              << options.trust_region_strategy_type;
-  return NULL;
+  return nullptr;
 }
 
 }  // namespace internal
diff --git a/internal/ceres/trust_region_strategy.h b/internal/ceres/trust_region_strategy.h
index 176f73a..d520917 100644
--- a/internal/ceres/trust_region_strategy.h
+++ b/internal/ceres/trust_region_strategy.h
@@ -75,7 +75,7 @@
   };
 
   // Factory.
-  static TrustRegionStrategy* Create(const Options& options);
+  static std::unique_ptr<TrustRegionStrategy> Create(const Options& options);
 
   virtual ~TrustRegionStrategy();
 
diff --git a/internal/ceres/visibility.cc b/internal/ceres/visibility.cc
index 82bf6f1..06f31ec 100644
--- a/internal/ceres/visibility.cc
+++ b/internal/ceres/visibility.cc
@@ -81,7 +81,7 @@
 
 WeightedGraph<int>* CreateSchurComplementGraph(
     const vector<set<int>>& visibility) {
-  const time_t start_time = time(NULL);
+  const time_t start_time = time(nullptr);
   // Compute the number of e_blocks/point blocks. Since the visibility
   // set for each e_block/camera contains the set of e_blocks/points
   // visible to it, we find the maximum across all visibility sets.
@@ -146,7 +146,7 @@
     graph->AddEdge(camera1, camera2, weight);
   }
 
-  VLOG(2) << "Schur complement graph time: " << (time(NULL) - start_time);
+  VLOG(2) << "Schur complement graph time: " << (time(nullptr) - start_time);
   return graph;
 }
 
diff --git a/internal/ceres/visibility_based_preconditioner.cc b/internal/ceres/visibility_based_preconditioner.cc
index 566dcfa..3e3604f 100644
--- a/internal/ceres/visibility_based_preconditioner.cc
+++ b/internal/ceres/visibility_based_preconditioner.cc
@@ -80,7 +80,7 @@
   num_blocks_ = bs.cols.size() - options_.elimination_groups[0];
   CHECK_GT(num_blocks_, 0) << "Jacobian should have at least 1 f_block for "
                            << "visibility based preconditioning.";
-  CHECK(options_.context != NULL);
+  CHECK(options_.context != nullptr);
 
   // Vector of camera block sizes
   block_size_.resize(num_blocks_);
@@ -88,7 +88,7 @@
     block_size_[i] = bs.cols[i + options_.elimination_groups[0]].size;
   }
 
-  const time_t start_time = time(NULL);
+  const time_t start_time = time(nullptr);
   switch (options_.type) {
     case CLUSTER_JACOBI:
       ComputeClusterJacobiSparsity(bs);
@@ -99,11 +99,11 @@
     default:
       LOG(FATAL) << "Unknown preconditioner type";
   }
-  const time_t structure_time = time(NULL);
+  const time_t structure_time = time(nullptr);
   InitStorage(bs);
-  const time_t storage_time = time(NULL);
+  const time_t storage_time = time(nullptr);
   InitEliminator(bs);
-  const time_t eliminator_time = time(NULL);
+  const time_t eliminator_time = time(nullptr);
 
   LinearSolver::Options sparse_cholesky_options;
   sparse_cholesky_options.sparse_linear_algebra_library_type =
@@ -118,7 +118,7 @@
   sparse_cholesky_options.use_postordering = true;
   sparse_cholesky_ = SparseCholesky::Create(sparse_cholesky_options);
 
-  const time_t init_time = time(NULL);
+  const time_t init_time = time(nullptr);
   VLOG(2) << "init time: " << init_time - start_time
           << " structure time: " << structure_time - start_time
           << " storage time:" << storage_time - structure_time
@@ -175,7 +175,8 @@
 void VisibilityBasedPreconditioner::InitStorage(
     const CompressedRowBlockStructure& bs) {
   ComputeBlockPairsInPreconditioner(bs);
-  m_.reset(new BlockRandomAccessSparseMatrix(block_size_, block_pairs_));
+  m_ = std::make_unique<BlockRandomAccessSparseMatrix>(block_size_,
+                                                       block_pairs_);
 }
 
 // Call the canonical views algorithm and cluster the cameras based on
@@ -328,7 +329,7 @@
   eliminator_options.f_block_size = options_.f_block_size;
   eliminator_options.row_block_size = options_.row_block_size;
   eliminator_options.context = options_.context;
-  eliminator_.reset(SchurEliminatorBase::Create(eliminator_options));
+  eliminator_ = SchurEliminatorBase::Create(eliminator_options);
   const bool kFullRankETE = true;
   eliminator_->Init(
       eliminator_options.elimination_groups[0], kFullRankETE, &bs);
@@ -337,7 +338,7 @@
 // Update the values of the preconditioner matrix and factorize it.
 bool VisibilityBasedPreconditioner::UpdateImpl(const BlockSparseMatrix& A,
                                                const double* D) {
-  const time_t start_time = time(NULL);
+  const time_t start_time = time(nullptr);
   const int num_rows = m_->num_rows();
   CHECK_GT(num_rows, 0);
 
@@ -375,7 +376,7 @@
     status = Factorize();
   }
 
-  VLOG(2) << "Compute time: " << time(NULL) - start_time;
+  VLOG(2) << "Compute time: " << time(nullptr) - start_time;
   return (status == LINEAR_SOLVER_SUCCESS);
 }
 
@@ -395,7 +396,7 @@
     int r, c, row_stride, col_stride;
     CellInfo* cell_info =
         m_->GetCell(block1, block2, &r, &c, &row_stride, &col_stride);
-    CHECK(cell_info != NULL)
+    CHECK(cell_info != nullptr)
         << "Cell missing for block pair (" << block1 << "," << block2 << ")"
         << " cluster pair (" << cluster_membership_[block1] << " "
         << cluster_membership_[block2] << ")";
@@ -420,11 +421,10 @@
   const CompressedRowSparseMatrix::StorageType storage_type =
       sparse_cholesky_->StorageType();
   if (storage_type == CompressedRowSparseMatrix::UPPER_TRIANGULAR) {
-    lhs.reset(CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm));
+    lhs = CompressedRowSparseMatrix::FromTripletSparseMatrix(*tsm);
     lhs->set_storage_type(CompressedRowSparseMatrix::UPPER_TRIANGULAR);
   } else {
-    lhs.reset(
-        CompressedRowSparseMatrix::FromTripletSparseMatrixTransposed(*tsm));
+    lhs = CompressedRowSparseMatrix::FromTripletSparseMatrixTransposed(*tsm);
     lhs->set_storage_type(CompressedRowSparseMatrix::LOWER_TRIANGULAR);
   }
 
diff --git a/internal/ceres/visibility_based_preconditioner.h b/internal/ceres/visibility_based_preconditioner.h
index 7146e3f..0da42a2 100644
--- a/internal/ceres/visibility_based_preconditioner.h
+++ b/internal/ceres/visibility_based_preconditioner.h
@@ -122,7 +122,7 @@
 //   options.elimination_groups.push_back(num_cameras);
 //   VisibilityBasedPreconditioner preconditioner(
 //      *A.block_structure(), options);
-//   preconditioner.Update(A, NULL);
+//   preconditioner.Update(A, nullptr);
 //   preconditioner.RightMultiply(x, y);
 class VisibilityBasedPreconditioner : public BlockSparseMatrixPreconditioner {
  public:
diff --git a/internal/ceres/visibility_based_preconditioner_test.cc b/internal/ceres/visibility_based_preconditioner_test.cc
index 10aa619..8fcae50 100644
--- a/internal/ceres/visibility_based_preconditioner_test.cc
+++ b/internal/ceres/visibility_based_preconditioner_test.cc
@@ -67,8 +67,8 @@
 //   void SetUp() {
 //     string input_file = TestFileAbsolutePath("problem-6-1384-000.lsqp");
 
-//     std::unique_ptr<LinearLeastSquaresProblem> problem(
-//         CHECK_NOTNULL(CreateLinearLeastSquaresProblemFromFile(input_file)));
+//     std::unique_ptr<LinearLeastSquaresProblem> problem =
+//     CreateLinearLeastSquaresProblemFromFile(input_file));
 //     A_.reset(down_cast<BlockSparseMatrix*>(problem->A.release()));
 //     b_.reset(problem->b.release());
 //     D_.reset(problem->D.release());
@@ -96,7 +96,8 @@
 //     // conditioned.
 //     VectorRef(D_.get(), num_cols_).setConstant(10.0);
 
-//     schur_complement_.reset(new BlockRandomAccessDenseMatrix(blocks));
+//     schur_complement_ =
+//     std::make_unique<BlockRandomAccessDenseMatrix>(blocks);
 //     Vector rhs(schur_complement_->num_rows());
 
 //     std::unique_ptr<SchurEliminatorBase> eliminator;
@@ -104,7 +105,7 @@
 //     eliminator_options.elimination_groups = options_.elimination_groups;
 //     eliminator_options.num_threads = options_.num_threads;
 
-//     eliminator.reset(SchurEliminatorBase::Create(eliminator_options));
+//     eliminator = SchurEliminatorBase::Create(eliminator_options);
 //     eliminator->Init(num_eliminate_blocks_, bs);
 //     eliminator->Eliminate(A_.get(), b_.get(), D_.get(),
 //                           schur_complement_.get(), rhs.data());
@@ -242,8 +243,9 @@
 
 // TEST_F(VisibilityBasedPreconditionerTest, OneClusterClusterJacobi) {
 //   options_.type = CLUSTER_JACOBI;
-//   preconditioner_.reset(
-//       new VisibilityBasedPreconditioner(*A_->block_structure(), options_));
+//   preconditioner_ =
+//       std::make_unique<VisibilityBasedPreconditioner>(
+//          *A_->block_structure(), options_);
 
 //   // Override the clustering to be a single clustering containing all
 //   // the cameras.
@@ -287,8 +289,9 @@
 
 // TEST_F(VisibilityBasedPreconditionerTest, ClusterJacobi) {
 //   options_.type = CLUSTER_JACOBI;
-//   preconditioner_.reset(
-//       new VisibilityBasedPreconditioner(*A_->block_structure(), options_));
+//   preconditioner_ =
+//   std::make_unique<VisibilityBasedPreconditioner>(*A_->block_structure(),
+//   options_);
 
 //   // Override the clustering to be equal number of cameras.
 //   vector<int>& cluster_membership = *get_mutable_cluster_membership();
@@ -312,8 +315,9 @@
 
 // TEST_F(VisibilityBasedPreconditionerTest, ClusterTridiagonal) {
 //   options_.type = CLUSTER_TRIDIAGONAL;
-//   preconditioner_.reset(
-//       new VisibilityBasedPreconditioner(*A_->block_structure(), options_));
+//   preconditioner_ =
+//     std::make_unique<VisibilityBasedPreconditioner>(*A_->block_structure(),
+//     options_);
 //   static const int kNumClusters = 3;
 
 //   // Override the clustering to be 3 clusters.
diff --git a/internal/ceres/wall_time.cc b/internal/ceres/wall_time.cc
index 7163927..bd920ac 100644
--- a/internal/ceres/wall_time.cc
+++ b/internal/ceres/wall_time.cc
@@ -58,7 +58,7 @@
          static_cast<double>(frequency.QuadPart);
 #else
   timeval time_val;
-  gettimeofday(&time_val, NULL);
+  gettimeofday(&time_val, nullptr);
   return (time_val.tv_sec + time_val.tv_usec * 1e-6);
 #endif
 #endif
