votca 2024.2-dev
Loading...
Searching...
No Matches
linspline.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18#ifndef VOTCA_TOOLS_LINSPLINE_H
19#define VOTCA_TOOLS_LINSPLINE_H
20
21// Local VOTCA includes
22#include "eigen.h"
23#include "spline.h"
24
25namespace votca {
26namespace tools {
27
34class LinSpline : public Spline {
35 public:
36 // default constructor
37 LinSpline() = default;
38 // LinSpline() :
39 // boundaries_(splineNormal) {}
40
41 // destructor
42 ~LinSpline() override = default;
43
44 // construct an interpolation spline
45 // x, y are the the points to construct interpolation, both vectors must be of
46 // same size
47 void Interpolate(const Eigen::VectorXd &x, const Eigen::VectorXd &y) override;
48
49 // fit spline through noisy data
50 // x,y are arrays with noisy data, both vectors must be of same size
51 void Fit(const Eigen::VectorXd &x, const Eigen::VectorXd &y) override;
52
53 // Calculate the function value
54 double Calculate(double r) override;
55
56 // Calculate the function derivative
57 double CalculateDerivative(double r) override;
60
61 protected:
62 // a,b for piecewise splines: ax+b
63 Eigen::VectorXd a;
64 Eigen::VectorXd b;
65};
66
67} // namespace tools
68} // namespace votca
69
70#endif // VOTCA_TOOLS_LINSPLINE_H
A Linear Spline Class.
Definition linspline.h:34
Eigen::VectorXd b
Definition linspline.h:64
double CalculateDerivative(double r) override
Calculate y value for a given x value on the derivative of the spline created by function Interpolate...
Definition linspline.cc:35
Eigen::VectorXd a
Definition linspline.h:63
double Calculate(double r) override
Calculate spline function value for a given x value on the spline created by Interpolate() or Fit()
Definition linspline.cc:30
void Interpolate(const Eigen::VectorXd &x, const Eigen::VectorXd &y) override
Calculate interpolating spline for given (x,y) values. Points on resulting spline can be obtained via...
Definition linspline.cc:40
void Fit(const Eigen::VectorXd &x, const Eigen::VectorXd &y) override
Fit spline through noisy (x,y) values. Points on resulting fitted spline can be obtained via Calculat...
Definition linspline.cc:80
~LinSpline() override=default
Spline Class.
Definition spline.h:36
virtual double CalculateDerivative(double x)=0
Calculate y value for a given x value on the derivative of the spline created by function Interpolate...
virtual double Calculate(double x)=0
Calculate spline function value for a given x value on the spline created by Interpolate() or Fit()
base class for all analysis tools
Definition basebead.h:33