diff options
Diffstat (limited to 'extern/ceres/internal/ceres/compressed_row_sparse_matrix.h')
-rw-r--r-- | extern/ceres/internal/ceres/compressed_row_sparse_matrix.h | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/extern/ceres/internal/ceres/compressed_row_sparse_matrix.h b/extern/ceres/internal/ceres/compressed_row_sparse_matrix.h index 0a1b945193d..3d7d385b185 100644 --- a/extern/ceres/internal/ceres/compressed_row_sparse_matrix.h +++ b/extern/ceres/internal/ceres/compressed_row_sparse_matrix.h @@ -31,9 +31,11 @@ #ifndef CERES_INTERNAL_COMPRESSED_ROW_SPARSE_MATRIX_H_ #define CERES_INTERNAL_COMPRESSED_ROW_SPARSE_MATRIX_H_ +#include <memory> #include <vector> -#include "ceres/internal/port.h" +#include "ceres/internal/disable_warnings.h" +#include "ceres/internal/export.h" #include "ceres/sparse_matrix.h" #include "ceres/types.h" #include "glog/logging.h" @@ -46,7 +48,7 @@ namespace internal { class TripletSparseMatrix; -class CERES_EXPORT_INTERNAL CompressedRowSparseMatrix : public SparseMatrix { +class CERES_NO_EXPORT CompressedRowSparseMatrix : public SparseMatrix { public: enum StorageType { UNSYMMETRIC, @@ -63,9 +65,7 @@ class CERES_EXPORT_INTERNAL CompressedRowSparseMatrix : public SparseMatrix { // 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 +73,8 @@ class CERES_EXPORT_INTERNAL CompressedRowSparseMatrix : public SparseMatrix { // 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 @@ -100,7 +98,7 @@ class CERES_EXPORT_INTERNAL CompressedRowSparseMatrix : public SparseMatrix { CompressedRowSparseMatrix(const double* diagonal, int num_rows); // SparseMatrix interface. - virtual ~CompressedRowSparseMatrix(); + ~CompressedRowSparseMatrix() override; void SetZero() final; void RightMultiply(const double* x, double* y) const final; void LeftMultiply(const double* x, double* y) const final; @@ -124,7 +122,7 @@ class CERES_EXPORT_INTERNAL CompressedRowSparseMatrix : public SparseMatrix { void ToCRSMatrix(CRSMatrix* matrix) const; - CompressedRowSparseMatrix* Transpose() const; + std::unique_ptr<CompressedRowSparseMatrix> Transpose() const; // Destructive array resizing method. void SetMaxNumNonZeros(int num_nonzeros); @@ -140,7 +138,7 @@ class CERES_EXPORT_INTERNAL CompressedRowSparseMatrix : public SparseMatrix { const int* rows() const { return &rows_[0]; } int* mutable_rows() { return &rows_[0]; } - const StorageType storage_type() const { return storage_type_; } + StorageType storage_type() const { return storage_type_; } void set_storage_type(const StorageType storage_type) { storage_type_ = storage_type; } @@ -154,9 +152,7 @@ class CERES_EXPORT_INTERNAL CompressedRowSparseMatrix : public SparseMatrix { // 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 +194,11 @@ class CERES_EXPORT_INTERNAL CompressedRowSparseMatrix : public SparseMatrix { // 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_; @@ -226,4 +220,6 @@ class CERES_EXPORT_INTERNAL CompressedRowSparseMatrix : public SparseMatrix { } // namespace internal } // namespace ceres +#include "ceres/internal/reenable_warnings.h" + #endif // CERES_INTERNAL_COMPRESSED_ROW_SPARSE_MATRIX_H_ |