16const std::vector<double>
BaselineSpline(
const std::vector<double> & y,
const std::vector<unsigned int> & indices)
18 if(y.size() == 0 || indices.size() == 0) {
19 throw std::invalid_argument(
"BaselineSpline(): the length of y or indices is zero.");
22 if(y.size() < indices.size()) {
23 throw std::invalid_argument(
"BaselineSpline(): the length of indices is larger than y.");
26 double max_index = y.size() - 1;
27 Eigen::VectorXd xx(indices.size()), yy(indices.size());
29 for(
unsigned int i = 0; i < indices.size(); i++) {
30 xx(i) = indices[i] / max_index;
31 yy(i) = y[indices[i]];
35 std::vector<double> result = y;
37 for(
unsigned int i = indices[0]; i < indices.back(); i++) {