Template Struct MatrixBlockSparseCols
Defined in File MatrixBlockSparseCols.h
Nested Relationships
Nested Types
Struct Documentation
-
template<typename Scalar, int NROWS, int NCOLS, typename INFO, bool HAS_REMAP, typename INDEX_REMAP_MAP_IMPL = mrpt::containers::map_as_vector<size_t, size_t>>
struct MatrixBlockSparseCols A templated column-indexed efficient storage of block-sparse Jacobian or Hessian matrices, together with other arbitrary information. Columns are stored in a non-associative container, but the contents of each column are kept within an std::map<> indexed by row. All submatrix blocks have the same size, which allows dense storage of them in fixed-size matrices, avoiding costly memory allocations.
- Template Parameters:
NROWS – Rows in each elementary matrix.
NCOLS – Cols in each elementary matrix.
INFO – Type of the extra data fields within each block
HAS_REMAP – Is true, an inverse mapping between column indices and “user IDs” is kept.
INDEX_REMAP_MAP_IMPL – Ignore if HAS_REMAP=false. Defaults to “mrpt::containers::map_as_vector<size_t,size_t>” for amortized O(1). Can be set to “std::map<size_t,size_t>” in very sparse systems to save memory at the cost of a O(log N) access time when using the remap indices.
Public Types
Public Functions
-
inline MatrixBlockSparseCols()
-
inline const mrpt::containers::map_as_vector<size_t, size_t> &getColInverseRemappedIndices() const
-
inline const std::vector<size_t> &getColRemappedIndices() const
-
inline col_t &appendCol(size_t remapIndex)
Append one column, returning a ref to the new col_t data
-
inline void setColCount(size_t nCols)
Change the number of columns (keep old contents)
-
inline size_t cols() const
Get current number of cols.
See also
-
inline void clearColEntries()
Clear all the entries in each column (do not change the number of columns, though!)
See also
getColCount
-
inline void clearAll()
Clear all the entries in each column (do not change the number of columns, though!)
See also
getColCount
-
inline void saveToTextFileAsDense(const std::string &filename, const bool force_symmetry = false, const bool is_col_compressed = true) const
Builds a dense representation of the matrix and saves to a text file.
-
inline void getAsDense(mrpt::math::CMatrixDouble &D, const bool force_symmetry = false, const bool is_col_compressed = true) const
Builds a dense representation of the matrix and saves to a text file.
- Parameters:
is_col_compressed – true: interpret this object as compressed by cols; false: compressed by rows
-
inline size_t findCurrentNumberOfRows() const
Goes over all the columns and keep the largest column length.
See also
-
struct TEntry