Feellgood
|
Sparse matrices. More...
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <cassert>
#include <algorithm>
#include <execution>
#include <mutex>
#include "algebraCore.h"
Go to the source code of this file.
Classes | |
class | algebra::w_sparseMat |
Write-mode sparse matrix. More... | |
class | algebra::r_sparseMat |
Read-mode square sparse matrix. More... | |
struct | algebra::r_sparseMat::SparseVector |
Namespaces | |
algebra | |
Typedefs | |
using | algebra::MatrixShape = std::vector< std::set< int > > |
Sparse matrices.
The main class provided here is r_sparseMat
, a "read-mode" square sparse matrix. It is meant to efficiently compute matrix-vector products, where the vectors are full (not sparse), represented as std::vector<double>. Such a matrix can be constructed in two ways:
w_sparseMat
(write-mode sparse matrix), populate it with its insert()
method, then use it to construct the read-mode sparse matrix.MatrixShape
, then use this shape to construct the read-mode sparse matrix with all values initialized to zero.Once constructed, the set of valid index pairs is immutable. However, the associated values can be modified with clear()
and add()
. Rewriting the values this way is way more efficient than reconstructing the matrix from scratch.