class
#include <eckit/linalg/SparseMatrix.h>
SparseMatrix Sparse matrix in CRS (compressed row storage) format.
Public types
- class Allocator
- struct const_iterator
- struct iterator
- struct Layout
- struct Shape
-
using UIndex = std::
make_unsigned_t<Index>
Public static functions
Constructors, destructors, conversion operators
- SparseMatrix(Allocator* = nullptr) explicit
- Default constructor, empty matrix.
- SparseMatrix(Size rows, Size cols, Allocator* = nullptr)
- Constructs an identity matrix with provided dimensions.
-
SparseMatrix(Size rows,
Size cols,
const std::
vector<Triplet>&) - Constructor from triplets.
- SparseMatrix(Stream&) explicit
- Constructor from Stream.
- SparseMatrix(const MemoryBuffer&) explicit
- Constructor from MemoryBuffer.
- SparseMatrix(SparseMatrix&&)
- Move constructor.
- SparseMatrix(const SparseMatrix&)
- Copy constructor.
- ~SparseMatrix()
- Destructor.
Public functions
- auto operator=(const SparseMatrix&) -> SparseMatrix&
- Assignment operator (allocates and copies data)
- auto operator=(SparseMatrix&&) -> SparseMatrix&
- Assignment operator (moves data)
- auto prune(Scalar = 0) -> SparseMatrix&
- Prune entries with exactly the given value.
- auto setIdentity(Size rows, Size cols) -> SparseMatrix&
- Set matrix to the identity.
- auto transpose() -> SparseMatrix&
- Transpose matrix in-place.
-
auto rowReduction(const std::
vector<size_t>& p) const -> SparseMatrix -
void save(const eckit::
PathName&) const -
void load(const eckit::
PathName&) -
void dump(eckit::
MemoryBuffer&) const - void dump(void* buffer, size_t size) const
- void swap(SparseMatrix&)
- auto rows() const -> Size
- auto cols() const -> Size
- auto nonZeros() const -> Size
- auto empty() const -> bool
- auto outerIndex() const -> const UIndex*
- auto data() const -> const Scalar*
- auto outer() const -> const Index*
- auto inner() const -> const Index*
- void cols(Size cols)
- Set a new number of columns (may invalidate data)
- void reserve(Size rows, Size cols, Size nnz)
- Reserve memory for given number of non-zeros (invalidates all data arrays)
- auto footprint() const -> size_t
- auto inSharedMemory() const -> bool
-
void dump(std::
ostream&) const -
void print(std::
ostream&) const - auto owner() const -> const Allocator&
-
auto begin(Size row) const -> const_
iterator - const iterators to begin/end of row
-
auto end(Size row) const -> const_
iterator -
auto begin() const -> const_
iterator - const iterators to begin/end of matrix
-
auto end() const -> const_
iterator - auto begin(Size row) -> iterator
- iterators to begin/end of row
- auto end(Size row) -> iterator
- auto begin() -> iterator
- const iterators to begin/end of matrix
- auto end() -> iterator
Friends
-
auto operator<<(std::
ostream& os, const SparseMatrix& m) -> std:: ostream& - auto operator<<(Stream&, const SparseMatrix&) -> Stream&
Function documentation
SparseMatrix eckit:: linalg:: SparseMatrix:: rowReduction(const std:: vector<size_t>& p) const
Returns | a sparse matrix that is a row reduction and reorder accoring to indexes passed in vector |
---|
Size eckit:: linalg:: SparseMatrix:: rows() const
Returns | number of rows |
---|
Size eckit:: linalg:: SparseMatrix:: cols() const
Returns | number of columns |
---|
Size eckit:: linalg:: SparseMatrix:: nonZeros() const
Returns | number of non-zeros |
---|
bool eckit:: linalg:: SparseMatrix:: empty() const
Returns | true if this matrix does not contain non-zero entries |
---|
const UIndex* eckit:: linalg:: SparseMatrix:: outerIndex() const
Returns | read-only view of the outer index vector |
---|
const Scalar* eckit:: linalg:: SparseMatrix:: data() const
Returns | read-only view of the data vector |
---|
const Index* eckit:: linalg:: SparseMatrix:: outer() const
Returns | read-only view of the outer index vector (signed) |
---|
const Index* eckit:: linalg:: SparseMatrix:: inner() const
Returns | read-only view of the inner index vector |
---|
size_t eckit:: linalg:: SparseMatrix:: footprint() const
Returns | footprint of the matrix in memory |
---|
bool eckit:: linalg:: SparseMatrix:: inSharedMemory() const
Returns | if allocation is in shared memory |
---|