SparseStorageFormats
#include <popsparse/SparseStorageFormats.hpp>
Storage formats for a block sparse matrix.
-
namespace popsparse
Support for sparse matrices.
-
struct Block
Subclassed by popsparse::COOMatrix< T >, popsparse::CSCMatrix< T >, popsparse::CSRMatrix< T >
Public Functions
-
template<typename T>
struct COOMatrix : public popsparse::Block - #include <SparseStorageFormats.hpp>
Block Sparse matrix stored as coordinate (COO) or triplets format.
The case of element sparsity is treated as a special case with block size equal to {number of rows in block, number of columns in block} = {1, 1}.
Public Functions
-
inline COOMatrix(const std::vector<T> &nzValues, const std::vector<std::size_t> &columnIndices, const std::vector<std::size_t> &rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
inline COOMatrix(std::size_t numRows, std::size_t numColumns, const std::vector<T> &nzValues, const std::vector<std::size_t> &columnIndices, const std::vector<std::size_t> &rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
inline COOMatrix(std::vector<T> &&nzValues, std::vector<std::size_t> &&columnIndices, std::vector<std::size_t> &&rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
inline COOMatrix(std::size_t numRows, std::size_t numColumns, std::vector<T> &&nzValues, std::vector<std::size_t> &&columnIndices, std::vector<std::size_t> &&rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
Public Members
-
inline COOMatrix(const std::vector<T> &nzValues, const std::vector<std::size_t> &columnIndices, const std::vector<std::size_t> &rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
template<typename T>
struct CSCMatrix : public popsparse::Block - #include <SparseStorageFormats.hpp>
Sparse matrix stored in compressed sparse columns (CSC) format for a matrix of size [M x N].
There is no explicit encoding of M in the storage. The number of column indices is equal to (N/number of columns in block) + 1. The case of element sparsity is treated as a special case with block size equal to {number of rows in block, number of columns in block} = {1, 1}.
Public Functions
-
inline CSCMatrix(const std::vector<T> &nzValues, const std::vector<std::size_t> &columnIndices, const std::vector<std::size_t> &rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
inline CSCMatrix(std::size_t numRows, std::size_t numColumns, const std::vector<T> &nzValues, const std::vector<std::size_t> &columnIndices, const std::vector<std::size_t> &rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
inline CSCMatrix(std::vector<T> &&nzValues, std::vector<std::size_t> &&columnIndices, std::vector<std::size_t> &&rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
inline CSCMatrix(std::size_t numRows, std::size_t numColumns, std::vector<T> &&nzValues, std::vector<std::size_t> &&columnIndices, std::vector<std::size_t> &&rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
Public Members
-
std::vector<T> nzValues
The non-zero values of the sparse matrix.
The number of values is always an integer multiple of the block size.
-
inline CSCMatrix(const std::vector<T> &nzValues, const std::vector<std::size_t> &columnIndices, const std::vector<std::size_t> &rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
template<typename T>
struct CSRMatrix : public popsparse::Block - #include <SparseStorageFormats.hpp>
Sparse matrix stored in compressed sparse rows (CSR) format for a matrix of size [M x N].
There is no explicit encoding of N in the storage. The number of row indices is equal to (M / number of rows in block) + 1. The case of element sparsity is treated as a special case with block size equal to {number of rows in block, number of columns in block} = {1, 1}.
Public Functions
-
inline CSRMatrix(const std::vector<T> &nzValues, const std::vector<std::size_t> &columnIndices, const std::vector<std::size_t> &rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
inline CSRMatrix(std::size_t numRows, std::size_t numColumns, const std::vector<T> &nzValues, const std::vector<std::size_t> &columnIndices, const std::vector<std::size_t> &rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
inline CSRMatrix(std::vector<T> &&nzValues, std::vector<std::size_t> &&columnIndices, std::vector<std::size_t> &&rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
inline CSRMatrix(std::size_t numRows, std::size_t numColumns, std::vector<T> &&nzValues, std::vector<std::size_t> &&columnIndices, std::vector<std::size_t> &&rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
inline CSRMatrix(const std::vector<T> &nzValues, const std::vector<std::size_t> &columnIndices, const std::vector<std::size_t> &rowIndices, const std::array<std::size_t, 2> &blockDimensions = {1, 1})
-
struct Block