-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.cpp
103 lines (89 loc) · 1.47 KB
/
start.cpp
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include<iostream>
#include<vector>
#include<Eigen/Dense>
using namespace std;
using namespace Eigen;
bool vector_equals(VectorXd v,VectorXd w){
for(int i=0;i<3;i++)
if(v(i)!=w(i))
return false;
return true;
}
class TreeNonde{
public:
TreeNonde(){
val.setZero();
son.clear();
}
TreeNonde(VectorXd v){
val=v;
son.clear();
}
void Add_son(VectorXd x){
TreeNonde *tn=new TreeNonde(x);
son.push_back(tn);
}
VectorXd get(){
return val;
}
void Destory_son(VectorXd x){
vector<TreeNonde*>::const_iterator i=son.begin();
for(;i!=son.end();i++){
if(vector_equals((*i)->get(),x)){
delete(*i);
son.erase(i);
break;
}
}
}
/* void mysize(){
vector<TreeNonde*>::const_iterator i=son.begin();
for(;i!=son.end();i++){
cout<<(*i)->get();
cout<<"\r\n";
}
}*/
private:
VectorXd val;
vector<TreeNonde*> son;
};
class Data{
public:
Data(vector<VectorXd> a,vector<VectorXd> b,vector<VectorXd> c,vector<VectorXd> d){
L1=a;
L2=b;
L3=c;
L4=d;
}
private:
vector<VectorXd> L1;
vector<VectorXd> L2;
vector<VectorXd> L3;
vector<VectorXd> L4;
};
/*int main(){
Vector3d x,y,z;
x<<1,1,1;
y<<2,2,2;
z<<3,3,3;
TreeNonde *p=new TreeNonde(x);
p->Add_son(y);
p->Add_son(z);
cout<<"........."<<endl;
p->Destory_son(z);
//p->mysize();
VectorXd v(3);
v<<1,2,3;
//cout<<v;
Matrix<double,3,1> m,n;
m<<1,
2,
3;
cout<<m;
n<<4,
5,
6;
n.adjoint();
cout<<n;
return 0;
}*/