-
Notifications
You must be signed in to change notification settings - Fork 2
/
CreateMatrix.h
64 lines (47 loc) · 1.48 KB
/
CreateMatrix.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef _CREATEMATRIX_H_
#define _CREATEMATRIX_H_
/*******************************************************************/
/*** FILE : CreateMatrix.h ***/
/*** AUTHOR: Sekhar Muddana ***/
/*** DATE WRITTEN: May 1990 ***/
/*******************************************************************/
#include <vector>
#include <stdint.h>
#include "Build_defs.h"
struct Node {
Node(int e_ = 0, int c_ = 0) : e(e_), c(c_) {};
uint32_t e: 8;
uint32_t c: 24;
Scalar getElement() const {
return e;
}
void setElement(Scalar v) {
e = v;
}
int getColumn() const {
return c;
}
void setColumn(int v) {
c = v;
}
};
inline bool operator==(const Node &n1, const Node &n2) {
return n1.e == n2.e && n1.c == n2.c;
}
typedef std::vector<Node> SparseRow;
typedef std::vector<SparseRow> SparseMatrix;
typedef struct {
Scalar coef;
Basis left_basis;
Basis right_basis;
} Basis_pair;
typedef struct {
Basis left_basis;
Basis right_basis;
} Unique_basis_pair;
typedef std::vector<std::vector<Basis_pair> > Equation;
typedef std::vector<Equation> Equations;
int SparseCreateTheMatrix(const Equations &equations, SparseMatrix &SM, int *Cols,
std::vector<Unique_basis_pair> &BPCptr, Name n);
int GetCol(const std::vector<Unique_basis_pair> &ColtoBP, Basis Left_basis, Basis Right_basis);
#endif