8#ifndef OPENFPM_NUMERICS_SRC_MATRIX_SPARSEMATRIX_HPP_
9#define OPENFPM_NUMERICS_SRC_MATRIX_SPARSEMATRIX_HPP_
12#include "util/linalgebra_lib.hpp"
13#include "Vector/map_vector.hpp"
14#include "VCluster/VCluster.hpp"
17#include <Eigen/Sparse>
18#define DEFAULT_MATRIX = EIGEN_BASE
20#define DEFAULT_MATRIX = 0
27template<
typename T>
struct cval
37template<
typename T,
int impl>
struct triplet
43 triplet(
long int i,
long int j, T val)
77template<
typename T,
typename id_t ,
unsigned int Mi DEFAULT_MATRIX>
95 SparseMatrix(
size_t N1,
size_t N2) {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
96 SparseMatrix(
size_t N1,
size_t N2,
size_t loc) {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
97 SparseMatrix() {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
98 openfpm::vector<triplet_type> & getMatrixTriplets() {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;
return stub_vt;}
99 const int & getMat()
const {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;
return stub_i;}
100 int & getMat() {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;
return stub_i;}
101 void resize(
size_t row,
size_t col,
size_t row_n,
size_t col_n) {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
102 T operator()(id_t i, id_t j) {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;
return stub_t;}
103 bool save(
const std::string & file)
const {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;
return true;}
104 bool load(
const std::string & file) {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;
return false;}
105 T getValue(
size_t r,
size_t c) {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;
return stub_i;}
109#include "SparseMatrix_Eigen.hpp"
113#include "SparseMatrix_petsc.hpp"
Sparse Matrix implementation.
triplet< T,-1 > triplet_type
Triplet type.
boost::mpl::int_<-1 > triplet_impl
Triplet implementation id.
Implementation of 1-D std::vector like structure.
It store the non zero elements of the matrix.
It store the non zero elements of the matrix.