32 return a(interval) * r +
b(interval);
41 const Eigen::VectorXd &y) {
42 if (x.size() != y.size()) {
43 throw std::invalid_argument(
44 "error in LinSpline::Interpolate : sizes of vectors x and y do not "
49 throw std::invalid_argument(
50 "error in LinSpline::Interpolate : vectors x and y have to contain at "
54 const Index N = x.size();
66 a = Eigen::VectorXd::Zero(N);
67 b = Eigen::VectorXd::Zero(N);
74 for (
Index i = 0; i < N - 1; i++) {
75 a(i) = (y(i + 1) - y(i)) / (x(i + 1) - x(i));
76 b(i) = y(i) -
a(i) * x(i);
81 if (x.size() != y.size()) {
82 throw std::invalid_argument(
83 "error in LinSpline::Fit : sizes of vectors x and y do not match");
86 const Index N = x.size();
97 Eigen::MatrixXd A = Eigen::MatrixXd::Zero(N, ngrid);
100 for (
Index i = 0; i < N; i++) {
103 1 - (x(i) -
r_(interval)) / (
r_(interval + 1) -
r_(interval));
105 (x(i) -
r_(interval)) / (
r_(interval + 1) -
r_(interval));
109 Eigen::HouseholderQR<Eigen::MatrixXd> QR(A);
110 Eigen::VectorXd sol = QR.solve(y);
115 a = Eigen::VectorXd::Zero(ngrid - 1);
116 b = Eigen::VectorXd::Zero(ngrid - 1);
117 for (
Index i = 0; i < ngrid - 1; i++) {
118 a(i) = (sol(i + 1) - sol(i)) / (
r_(i + 1) -
r_(i));
119 b(i) = -
a(i) *
r_(i) + sol(i);
base class for all analysis tools