-
Notifications
You must be signed in to change notification settings - Fork 0
/
scmath.h
44 lines (37 loc) · 1.2 KB
/
scmath.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
#pragma once
#include "ast.h"
#include "nodetype.h"
#include<sstream>
#include <memory>
typedef matrixNode DataSet;
typedef vector<string> VarSet;
typedef map<string, double> ValWeight;
class MathFunc
{
private:
BasicNode *funPro = nullptr;
Scope* funScope = nullptr;
bool ownerScope = true;
public:
MathFunc(){}
MathFunc(const string &, Scope* = nullptr);
MathFunc(BasicNode *, Scope* = nullptr);
MathFunc(const MathFunc &, Scope* = nullptr);
~MathFunc();
void setVal(const string &, const double&);
void setVal(const string &, BasicNode*);
void changeScope(Scope * = nullptr);
const MathFunc eval();
double getNum();
const MathFunc diff(const string &);
const ValWeight regress(const DataSet &, const VarSet, int = 500);
Scope* getScope(){return funScope;}
MathFunc& operator=(const string &);
MathFunc& operator=(BasicNode *);
MathFunc& operator=(const MathFunc &);
friend ostream& operator<<(ostream &, const MathFunc &);
};
void __Simplificate(BasicNode *&);
BasicNode* __Derivation(BasicNode* , const string &);
BasicNode* Derivation(BasicNode*, const string &);
const ValWeight regression(BasicNode*, const DataSet &, const VarSet, int);