14const std::vector<double>
BaselineSpline(
const std::vector<double> & y,
const std::vector<unsigned int> & indices)
16 if(y.size() == 0 || indices.size() == 0) {
17 throw std::invalid_argument(
"BaselineSpline(): the length of y or indices is zero.");
20 if(y.size() < indices.size()) {
21 throw std::invalid_argument(
"BaselineSpline(): the length of indices is larger than y.");
24 double max_index = y.size() - 1;
25 Eigen::VectorXd xx(indices.size()), yy(indices.size());
27 for(
unsigned int i = 0; i < indices.size(); i++) {
28 xx(i) = indices[i] / max_index;
29 yy(i) = y[indices[i]];
33 std::vector<double> result = y;
35 for(
unsigned int i = indices[0]; i < indices.back(); i++) {