votca 2024-dev
Loading...
Searching...
No Matches
akimaspline.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_AKIMASPLINE_H
19#define VOTCA_TOOLS_AKIMASPLINE_H
20
21// Standard includes
22#include <iostream>
23
24// Local VOTCA includes
25#include "eigen.h"
27#include "spline.h"
28
29namespace votca {
30namespace tools {
31
44class AkimaSpline : public Spline {
45 public:
46 // default constructor
47 AkimaSpline() = default;
48
49 // destructor
50 ~AkimaSpline() override = default;
51
67 double getSlope(double m1, double m2, double m3, double m4);
68
69 // construct an interpolation spline
70 // x, y are the the points to construct interpolation, both vectors must be of
71 // same size
72 void Interpolate(const Eigen::VectorXd &x, const Eigen::VectorXd &y) override;
73
74 // fit spline through noisy data
75 // x,y are arrays with noisy data, both vectors must be of same size
76 void Fit(const Eigen::VectorXd &x, const Eigen::VectorXd &y) override;
77
78 // Calculate the function value
79 double Calculate(double r) override;
80
81 // Calculate the function derivative
82 double CalculateDerivative(double r) override;
85
86 protected:
87 // p1,p2,p3,p4 and t1,t2 (same identifiers as in Akima paper, page 591)
88 Eigen::VectorXd p0;
89 Eigen::VectorXd p1;
90 Eigen::VectorXd p2;
91 Eigen::VectorXd p3;
92 Eigen::VectorXd t;
93};
94
95} // namespace tools
96} // namespace votca
97
98#endif // VOTCA_TOOLS_AKIMASPLINE_H
An Akima Spline Class.
Definition akimaspline.h:44
double getSlope(double m1, double m2, double m3, double m4)
Calculate the slope according to the original Akima paper ("A New Method of Interpolation and Smooth ...
double CalculateDerivative(double r) override
Calculate y value for a given x value on the derivative of the spline created by function Interpolate...
~AkimaSpline() override=default
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...
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...
double Calculate(double r) override
Calculate spline function value for a given x value on the spline created by Interpolate() or Fit()
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