| 1 |
#include <vector> |
| 2 |
#include <map> |
| 3 |
#include <algorithm> |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
template <class ScalarType> |
| 11 |
class SparseMatrix{ |
| 12 |
|
| 13 |
public: |
| 14 |
|
| 15 |
std::vector<int> _Ap; |
| 16 |
std::vector<int> _Ai; |
| 17 |
std::vector<double> _Ax; |
| 18 |
|
| 19 |
typedef typename std::pair<int,int> IndexType; |
| 20 |
|
| 21 |
int _dimension; |
| 22 |
|
| 23 |
public: |
| 24 |
|
| 25 |
|
| 26 |
virtual void Initalize(int dimension) |
| 27 |
{_dimension=dimension;} |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
virtual void CreateSparse(std::vector<IndexType> Entries) |
| 32 |
{} |
| 33 |
|
| 34 |
|
| 35 |
virtual ScalarType &A(int row,int col) |
| 36 |
{return (_Ax[0]);} |
| 37 |
|
| 38 |
|
| 39 |
virtual bool IsSymmetric() |
| 40 |
{return false;} |
| 41 |
|
| 42 |
virtual void Zero() |
| 43 |
{} |
| 44 |
|
| 45 |
|
| 46 |
virtual int Size(){return _dimension;} |
| 47 |
|
| 48 |
}; |