11 typedef typename std::vector<double>::iterator iterator;
12 typedef typename std::vector<double>::const_iterator const_iterator;
23 Pattern (
const Pattern& other)
25 m_input.assign (std::begin (other.m_input), std::end (other.m_input));
26 m_output.assign (std::begin (other.m_output), std::end (other.m_output));
27 m_weight = other.m_weight;
30 Pattern (Pattern&& other)
32 m_input = std::move (other.m_input);
33 m_output = std::move (other.m_output);
34 m_weight = other.m_weight;
37 Pattern& operator= (
const Pattern& other)
39 m_input.assign (std::begin (other.input ()), std::end (other.input ()));
40 m_output.assign (std::begin (other.output ()), std::end (other.output ()));
41 m_weight = other.m_weight;
45 template <
typename ItValue>
46 Pattern (ItValue inputBegin, ItValue inputEnd, ItValue outputBegin, ItValue outputEnd,
double _weight = 1.0)
47 : m_input (inputBegin, inputEnd)
48 , m_output (outputBegin, outputEnd)
53 template <
typename ItValue>
54 Pattern (ItValue inputBegin, ItValue inputEnd,
double outputValue,
double _weight = 1.0)
55 : m_input (inputBegin, inputEnd)
58 m_output.push_back (outputValue);
61 template <
typename InputContainer,
typename OutputContainer>
62 Pattern (InputContainer& _input, OutputContainer& _output,
double _weight = 1.0)
63 : m_input (std::begin (_input), std::end (_input))
64 , m_output (std::begin (_output), std::end (_output))
69 const_iterator beginInput ()
const {
return m_input.begin (); }
70 const_iterator endInput ()
const {
return m_input.end (); }
71 const_iterator beginOutput ()
const {
return m_output.begin (); }
72 const_iterator endOutput ()
const {
return m_output.end (); }
74 double weight ()
const {
return m_weight; }
75 void weight (
double w) { m_weight = w; }
77 size_t inputSize ()
const {
return m_input.size (); }
78 size_t outputSize ()
const {
return m_output.size (); }
80 void addInput (
double value) { m_input.push_back (value); }
81 void addOutput (
double value) { m_output.push_back (value); }
83 std::vector<double>& input () {
return m_input; }
84 std::vector<double>& output () {
return m_output; }
85 const std::vector<double>& input ()
const {
return m_input; }
86 const std::vector<double>& output ()
const {
return m_output; }
89 std::vector<double> m_input;
90 std::vector<double> m_output;