-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.h
59 lines (48 loc) · 1.4 KB
/
types.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
#ifndef TYPES_H
#define TYPES_H
#include <Eigen/Dense>
#include <vector>
#include <list>
// Typedef
using namespace Eigen;
using namespace std;
typedef long long int integer;
typedef double realnumber;
typedef vector<double> STLVector;
typedef Matrix<double, Dynamic, 1> EigenVector;
typedef Matrix<double, Dynamic, Dynamic> EigenMatrix;
inline STLVector EigenToSTLVector(EigenVector const & vector)
{
STLVector newVector(vector.size());
for(integer i = 0; i < vector.size(); ++i)
newVector[i] = vector[i];
return newVector;
}
inline EigenVector STLToEigenVector(STLVector const & vector)
{
EigenVector newVector(vector.size());
for(integer i = 0; i < (integer)vector.size() ; ++i)
newVector[i] = vector[i];
return newVector;
}
struct example
{
public:
example(STLVector inputVector = STLVector(), STLVector desiredOutputVector = STLVector());
STLVector input;
STLVector output;
};
struct setOfExamples: vector<example>
{
void add(STLVector inputVector = STLVector(), STLVector desiredOutputVector = STLVector());
};
EigenMatrix setOfExamplesToEigenInputMatrix(setOfExamples const & set);
EigenMatrix setOfExamplesToEigenOutputMatrix(setOfExamples const & set);
template <typename T>
string toStr(T pNumber)
{
ostringstream oOStrStream;
oOStrStream << pNumber;
return oOStrStream.str();
};
#endif // TYPES_H