42 std::set<Sample>::iterator it =
samples_.begin();
43 float x0 = it->input_;
44 float y0 = it->output_;
50 auto second_it = std::next(it);
51 float x1 = second_it->input_;
52 float y1 = second_it->output_;
53 float const gradient = (y1 - y0) / (x1 - x0);
67 if (input > it->input_) {
78 float x1 = it->input_;
79 float y1 = it->output_;
80 output_ = (y0 * (x1 - input) + y1 * (input - x0)) / (x1 - x0);
85 auto second_last = std::next(last);
86 float x1 = last->input_;
87 float y1 = last->output_;
88 float x2 = second_last->input_;
89 float y2 = second_last->output_;
90 float const gradient = (y1 - y2) / (x1 - x2);
93 output_ = y1 + gradient * (input - x1);