-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLinear.h
55 lines (32 loc) · 823 Bytes
/
Linear.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
#ifndef LINEAR_H
#define LINEAR_H
#include <map>
#include <vector>
#include "Vars.h"
using namespace std;
class Linear {
public:
mpz_class real;
mpz_class constant;
Vars vars;
bool eliminated = false;
void add_var(char type, int idx, int val);
bool has_var(char type, int idx);
int num_vars();
mpz_class get_var(char type, int idx);
void add(Linear& other);
void sub(Linear& other);
void mul(mpz_class v);
void div(mpz_class v);
void index_temp_vars(map<int, vector<int>>& index, int idx);
void assign_temp_vars(Linear& other, map<int, vector<int>>& index, int idx);
void to_str();
int equation_cost();
bool is_const();
bool is_zero();
bool has_temp_var();
bool has_several_temps();
map<int, mpz_class>::iterator vars_begin();
map<int, mpz_class>::iterator vars_end();
};
#endif