-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_f_data.cpp
More file actions
125 lines (103 loc) · 2.79 KB
/
load_f_data.cpp
File metadata and controls
125 lines (103 loc) · 2.79 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
* load_f_data.cpp
*
* Created on: 11-Nov-2014
* Author: niladriisl
*/
// A2DD.cpp
/// Brief description.
/** Detailed description. */
#include "load_f_data.h"
#include <fstream>
#include <iostream>
#include </usr/include/eigen3/Eigen/Core>
using namespace std;
using namespace Eigen;
load_function_data::load_function_data() :
priors_tmp(Eigen::VectorXf()), mean_tmp(Eigen::MatrixXf()), sigma_tmp(
Eigen::MatrixXf()), xistar_tmp(Eigen::VectorXf()), sys_config(
Eigen::VectorXi()) {
read_sysconfig();
read_priors();
read_means();
read_sigma();
read_xistar();
}
void load_function_data::read_sysconfig()
{
/*
* Read a file and save the variables in Priors
*/
ifstream file0;
file0.open( "/home/niladriisl/eclipse_workspace/Dynamic_Imitation/sysconfig.txt");
sys_config.resize(2);
for(int i = 0; i < 2; i++)
{
file0 >> sys_config(i);
}
file0.close();
}
void load_function_data::read_priors() {
/*
* Read a file and save the variables in Priors
*/
ifstream file1;
file1.open(
"/home/niladriisl/eclipse_workspace/Dynamic_Imitation/priors.txt");
int tmp_tmp_prior_size = sys_config(1);
priors_tmp.resize(tmp_tmp_prior_size);
for (int i = 0; i < tmp_tmp_prior_size; i++) {
file1 >> priors_tmp(i);
}
file1.close();
}
void load_function_data::read_means() {
/*
* Read a file and save the variables in means
*/
ifstream file2;
file2.open("/home/niladriisl/eclipse_workspace/Dynamic_Imitation/mean.txt");
int tmp_tmp_mean_row = sys_config(0); // number of input+output variables
int tmp_tmp_mean_col = sys_config(1); // Number of gaussian components
mean_tmp.resize(tmp_tmp_mean_row, tmp_tmp_mean_col);
for (int i = 0; i < tmp_tmp_mean_row; i++) {
for (int j = 0; j < tmp_tmp_mean_col; j++) {
file2 >> mean_tmp(i, j);
}
}
file2.close();
}
void load_function_data::read_sigma() {
/*
* Read a file and save the variables in sigma
*/
ifstream file3;
file3.open(
"/home/niladriisl/eclipse_workspace/Dynamic_Imitation/sigma.txt");
int tmp_tmp_sigma_row = sys_config(0)*sys_config(1);
int tmp_tmp_sigma_col = sys_config(0);
sigma_tmp.resize(tmp_tmp_sigma_row, tmp_tmp_sigma_col);
for (int i = 0; i < tmp_tmp_sigma_row; i++) {
for (int j = 0; j < tmp_tmp_sigma_col; j++) {
file3 >> sigma_tmp(i, j);
}
}
file3.close();
}
void load_function_data::read_xistar() {
/*
* Read a file and save the variables in xi_star
*/
ifstream file4;
file4.open(
"/home/niladriisl/eclipse_workspace/Dynamic_Imitation/xi_star.txt");
int tmp_tmp_mean_row = sys_config(0); // number of input+output variables
xistar_tmp.resize(tmp_tmp_mean_row/2);
// cout << "hi haha from inside " << tmp_tmp_mean_row/2 << endl;
for (int i = 0; i < tmp_tmp_mean_row/2; i++) {
file4 >> xistar_tmp(i);
}
file4.close();
}
load_function_data::~load_function_data() {
}