-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.cpp
28 lines (24 loc) · 881 Bytes
/
types.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
#include"types.h"
example::example(STLVector inputVector, STLVector desiredOutputVector):
input(inputVector),
output(desiredOutputVector)
{
}
void setOfExamples::add(STLVector inputVector, STLVector desiredOutputVector)
{
push_back(example(inputVector, desiredOutputVector));
}
EigenMatrix setOfExamplesToEigenInputMatrix(setOfExamples const & set)
{
EigenMatrix newInputSet(set[0].input.size(), set.size());
for (integer i = 0; i < (integer)set.size(); ++i)
newInputSet.col(i) = STLToEigenVector(set[i].input);
return newInputSet;
}
EigenMatrix setOfExamplesToEigenOutputMatrix(setOfExamples const & set)
{
EigenMatrix newOutputSet(set[0].output.size(), set.size());
for (integer i = 0; i < (integer)set.size(); ++i)
newOutputSet.col(i) = STLToEigenVector(set[i].output);
return newOutputSet;
}