8 #ifndef OPENFPM_NUMERICS_SRC_MATRIX_SPARSEMATRIX_HPP_
9 #define OPENFPM_NUMERICS_SRC_MATRIX_SPARSEMATRIX_HPP_
11 #include "config/config.h"
12 #include "util/linalgebra_lib.hpp"
15 #include <Eigen/Sparse>
16 #define DEFAULT_MATRIX = EIGEN_BASE
18 #define DEFAULT_MATRIX = 0
25 template<
typename T>
struct cval
35 template<
typename T,
int impl>
struct triplet
41 triplet(
long int i,
long int j, T val)
75 template<
typename T,
typename id_t ,
unsigned int Mi DEFAULT_MATRIX>
93 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;}
94 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;}
95 SparseMatrix() {std::cerr << __FILE__ <<
":" << __LINE__ <<
" Error in order to use this class you must compile OpenFPM with linear algebra support" << std::endl;}
96 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;}
97 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;}
98 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;}
99 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;}
100 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;}
101 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;}
102 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;}
103 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;}
107 #include "SparseMatrix_Eigen.hpp"
111 #include "SparseMatrix_petsc.hpp"
It store the non zero elements of the matrix.
It store the non zero elements of the matrix.
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.