Krita Source Code Documentation
Loading...
Searching...
No Matches
KisTridiagonalSystem< T > Class Template Reference

#include <kis_cubic_curve_spline.h>

Static Public Member Functions

static QVector< T > calculate (QList< T > &a, QList< T > &b, QList< T > &c, QList< T > &f)
 

Detailed Description

template<typename T>
class KisTridiagonalSystem< T >

Definition at line 21 of file kis_cubic_curve_spline.h.

Member Function Documentation

◆ calculate()

template<typename T >
static QVector< T > KisTridiagonalSystem< T >::calculate ( QList< T > & a,
QList< T > & b,
QList< T > & c,
QList< T > & f )
inlinestatic
Returns
- vector that is storing x[]

Check for special case when order of the matrix is equal to 1

Common case

Definition at line 38 of file kis_cubic_curve_spline.h.

41 {
43 QVector<T> alpha;
44 QVector<T> beta;
45
46 int i;
47 int size = b.size();
48
49 Q_ASSERT(a.size() == size - 1 &&
50 c.size() == size - 1 &&
51 f.size() == size);
52
53 x.resize(size);
54
59 if (size == 1) {
60 x[0] = f[0] / b[0];
61 return x;
62 }
63
68 alpha.resize(size);
69 beta.resize(size);
70
71
72 alpha[1] = -c[0] / b[0];
73 beta[1] = f[0] / b[0];
74
75 for (i = 1; i < size - 1; i++) {
76 alpha[i+1] = -c[i] /
77 (a[i-1] * alpha[i] + b[i]);
78
79 beta[i+1] = (f[i] - a[i-1] * beta[i])
80 /
81 (a[i-1] * alpha[i] + b[i]);
82 }
83
84 x.last() = (f.last() - a.last() * beta.last())
85 /
86 (b.last() + a.last() * alpha.last());
87
88 for (i = size - 2; i >= 0; i--)
89 x[i] = alpha[i+1] * x[i+1] + beta[i+1];
90
91 return x;
92 }
int size(const Forest< T > &forest)
Definition KisForest.h:1232

The documentation for this class was generated from the following file: