11#include "../../Matrix.h"
12#include "../../matrix_utils.h"
13#include "../lin_alg/gaussSeidel.h"
46 double h = fabs(
XI(1, 0) -
XI(0, 0));
47 for(
size_t i = 0; i <
XI.
rows() - 1; ++i) {
48 auto dist = fabs(
XI(i + 1, 0) -
XI(i, 0));
64 double h = fabs(
XI(1, 0) -
XI(0, 0));
65 for(
size_t i = 0; i <
XI.
rows() - 1; ++i) {
66 auto dist = fabs(
XI(i + 1, 0) -
XI(i, 0));
75 auto h =
XI(j + 1, 0) -
XI(j, 0);
76 return ((mi(j, 0) *
pow((
XI(j + 1, 0) - x_act), 3.0) + mi(j + 1, 0) *
pow((x_act -
XI(j, 0)), 3.0)) / 6.0) / h
77 + (
YI(j, 0) * (
XI(j + 1, 0) - x_act) +
YI(j + 1, 0) * (x_act -
XI(j, 0))) / h
78 - ((mi(j, 0) * (
XI(j + 1, 0) - x_act) + mi(j + 1, 0) * (x_act -
XI(j, 0))) * h) / 6.0;
90 auto lhs =
tridiag(dim, dim, 1, 4, 1);
92 for(
size_t i = 0; i < res.rows(); ++i) { mi(i + 1, 0) = res(i, 0); }
135 auto mi =
curv(
XI(1, 0) -
XI(0, 0));
136 auto y =
zeros(innerXI.rows(), innerXI.columns());
139 for(
size_t j = 0; j <
XI.
rows() - 1; ++j) {
142 auto xr =
XI(j + 1, 0);
143 auto ind =
nonzero([xl, xr](
const double& x) {
return bool((xl <= x) && (x <= xr)); }, innerXI).Transpose();
145 for(
size_t i = 0; i < ind.rows(); ++i) { y(ind(i, 0), 0) +=
eval_spline_j(innerXI(ind(i, 0), 0), j, mi); }
double pow(double x, int exponent)
constexpr Matrix< T > Transpose() const
Definition: Matrix.h:256
size_t rows() const
Definition: Matrix.h:193
size_t columns() const
Definition: Matrix.h:198
Matrix GetSlice(size_t rowStart) const
Definition: Matrix.h:609
Matrix< double > calculateEquidistant(const Matrix< double > &xi)
Definition: Spline.h:133
double eval_spline_j(double x_act, size_t j, const Matrix< double > &mi)
Definition: Spline.h:74
Matrix< double > curv(double h)
Definition: Spline.h:86
Spline(const Matrix< double > &X, const Matrix< double > &Y, const Matrix< double > &Z)
Definition: Spline.h:59
Matrix< double > ZI
z-axis support values
Definition: Spline.h:28
Matrix< double > Tx
t-Values for x
Definition: Spline.h:30
Matrix< double > operator()(const Matrix< double > &xi)
Definition: Spline.h:111
void SetAbstractionValue(const Matrix< double > &tx, const Matrix< double > &ty)
Definition: Spline.h:101
Matrix< double > Ty
t-Values for y
Definition: Spline.h:32
Spline(const Matrix< double > &X, const Matrix< double > &Y)
Definition: Spline.h:42
bool isEquidistant
flag to signalize that support values do not lie equidistant to each other
Definition: Spline.h:34
Matrix< double > YI
y-axis support values
Definition: Spline.h:26
Matrix< double > XI
x-axis support values
Definition: Spline.h:24
Matrix< double > gaussSeidel(const Matrix< double > &A, const Matrix< double > &b)
Definition: gaussSeidel.h:29
T min(const Matrix< T > &mat)
Definition: matrix_utils.h:324
T max(const Matrix< T > &mat)
Definition: matrix_utils.h:292
#define EPS
accuracy of calculated results
Definition: utils.h:24
Matrix< size_t > nonzero(const std::function< bool(const double &)> &validation, const Matrix< double > &x)
Matrix< double > tridiag(size_t rows, size_t columns, double left, double center, double right)
Matrix< double > zeros(size_t rows, size_t columns, size_t elements=1)
Matrix< double > linspace(double start, double end, unsigned long num_elements)