18#ifndef VOTCA_TOOLS_CUBICSPLINE_H
19#define VOTCA_TOOLS_CUBICSPLINE_H
65 void Interpolate(
const Eigen::VectorXd &x,
const Eigen::VectorXd &y)
override;
69 void Fit(
const Eigen::VectorXd &x,
const Eigen::VectorXd &y)
override;
81 void setSplineData(
const Eigen::VectorXd &f,
const Eigen::VectorXd &f2) {
96 template <
typename matrix_type>
98 Index offset2 = 0,
double scale = 1);
111 template <
typename matrix_type>
113 double scale1,
double scale2);
123 template <
typename matrix_type,
typename vector_type>
133 template <
typename matrix_type>
143 template <
typename matrix_type>
175template <
typename matrix_type>
177 Index offset2,
double scale) {
179 M(offset1, offset2 + spi) +=
A(x) * scale;
180 M(offset1, offset2 + spi + 1) +=
B(x) * scale;
181 M(offset1, offset2 + spi +
r_.size()) +=
C(x) * scale;
182 M(offset1, offset2 + spi +
r_.size() + 1) +=
D(x) * scale;
186template <
typename matrix_type>
188 Index offset2,
double scale1,
191 M(offset1, offset2 + spi) +=
Aprime(x) * scale1;
192 M(offset1, offset2 + spi + 1) +=
Bprime(x) * scale1;
193 M(offset1, offset2 + spi +
r_.size()) +=
Cprime(x) * scale1;
194 M(offset1, offset2 + spi +
r_.size() + 1) +=
Dprime(x) * scale1;
199template <
typename matrix_type,
typename vector_type>
202 for (
Index i = 0; i < x.size(); ++i) {
204 M(offset1 + i, offset2 + spi) =
A(x(i));
205 M(offset1 + i, offset2 + spi + 1) =
B(x(i));
206 M(offset1 + i, offset2 + spi +
r_.size()) =
C(x(i));
207 M(offset1 + i, offset2 + spi +
r_.size() + 1) =
D(x(i));
211template <
typename matrix_type>
214 for (
Index i = 0; i <
r_.size(); ++i) {
215 M(offset1, offset2 + i) = 1;
216 M(offset1, offset2 +
r_.size() + i) = 0;
220template <
typename matrix_type>
223 for (
Index i = 0; i <
r_.size() - 2; ++i) {
224 M(offset1 + i + 1, offset2 + i) =
A_prime_l(i);
226 M(offset1 + i + 1, offset2 + i + 2) = -
B_prime_r(i);
228 M(offset1 + i + 1, offset2 +
r_.size() + i) =
C_prime_l(i);
229 M(offset1 + i + 1, offset2 +
r_.size() + i + 1) =
231 M(offset1 + i + 1, offset2 +
r_.size() + i + 2) = -
D_prime_r(i);
235 M(offset1, offset2 +
r_.size()) = 1;
236 M(offset1 +
r_.size() - 1, offset2 + 2 *
r_.size() - 1) = 1;
240 M(offset1 + 0, offset2 + 0) = -1 *
A_prime_l(0);
241 M(offset1 + 0, offset2 + 1) = -1 *
B_prime_l(0);
243 M(offset1 +
r_.size() - 1, offset2 +
r_.size() - 2) =
245 M(offset1 +
r_.size() - 1, offset2 +
r_.size() - 1) =
249 M(offset1 + 0, offset2 +
r_.size() + 0) =
D_prime_l(0);
250 M(offset1 + 0, offset2 +
r_.size() + 1) =
C_prime_l(0);
252 M(offset1 +
r_.size() - 1, offset2 + 2 *
r_.size() - 2) =
254 M(offset1 +
r_.size() - 1, offset2 + 2 *
r_.size() - 1) =
258 M(offset1, offset2) = 1;
259 M(offset1, offset2 +
r_.size() - 1) = -1;
260 M(offset1 +
r_.size() - 1, offset2 +
r_.size()) = 1;
261 M(offset1 +
r_.size() - 1, offset2 + 2 *
r_.size() - 1) = -1;
base class for all analysis tools