Feellgood
Classes | Namespaces | Typedefs
sparseMat.h File Reference

Sparse matrices. More...

#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <cassert>
#include <algorithm>
#include <execution>
#include <mutex>
#include "config.h"
#include "algebraCore.h"

Go to the source code of this file.

Classes

class  algebra::SparseMatrix
 Square sparse matrix. More...
 
struct  algebra::SparseMatrix::SparseVector
 

Namespaces

 algebra
 

Typedefs

using algebra::MatrixShape = std::vector< std::set< int > >
 

Detailed Description

Sparse matrices.

The main class provided here is SparseMatrix, a square sparse matrix. It is meant to efficiently compute matrix-vector products, where the vectors are full (not sparse), represented as std::vector<double>.

In order to build a SparseMatrix, one has to first store in a MatrixShape the set of valid index pairs, then use this shape to construct the 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.