File: sparse_matrix.h

package info (click to toggle)
meshlab 2020.09%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 45,124 kB
  • sloc: cpp: 400,238; ansic: 31,952; javascript: 1,578; sh: 387; yacc: 238; lex: 139; python: 86; makefile: 29
file content (48 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <vector>
#include <map>
#include <algorithm>


///this class define the interface to use sparse matrix
///you must extend this class and implement the code of each function in order
///to the system solver you're using.
///For details on implementation see system_interface_LDL.h as example
template <class ScalarType>
class SparseMatrix{

public:

	std::vector<int> _Ap;
	std::vector<int> _Ai;
	std::vector<double> _Ax;
	
	typedef typename std::pair<int,int> IndexType;
	
	int _dimension;	

public:

///initilaization of the system
virtual void Initalize(int dimension)
{_dimension=dimension;}

///create a sparse matrix given a set of entries as vector 
///of pair of int
virtual void CreateSparse(std::vector<IndexType> Entries)
{}

///return the value of the matrix 
virtual ScalarType &A(int row,int col)
{return (_Ax[0]);}

///return true if the rapresention of sparse matriz is symmetric
virtual bool IsSymmetric()
{return false;}

virtual void Zero()
{}

///return the dimension of the matrix
virtual int Size(){return _dimension;}

};