35 { coeffs(pos) = val; }
38 {
return coeffs.get( pos ); }
41 T getValue3D(
float x0,
float x1,
float x2 )
const;
61 template <
class T>
inline 66 const int ndim =
coeffs.info().getNDim();
73 for (
int idx=0; idx<ndim; idx++ )
76 res += posproduct *
coeffs.getND( coeffiter.getPos() );
77 }
while ( coeffiter.next() );
82 template <
class T>
inline 89 pos[0] = p0; pos[1] = p1; pos[2] = p2;
94 float p0_2 = p0 * p0;
float p0_3 = p0_2 * p0;
95 float p1_2 = p1 * p1;
float p1_3 = p1_2 * p1;
96 float p2_2 = p2 * p2;
float p2_3 = p2_2 * p2;
98 const float p0p1 = p0 * p1;
99 const float p0p1_2 = p0p1 * p1;
100 const float p0p1_3 = p0p1_2 * p1;
101 const float p0_2p1 = p0_2 * p1;
102 const float p0_2p1_2 = p0_2p1 * p1;
103 const float p0_2p1_3 = p0_2p1_2 * p1;
104 const float p0_3p1 = p0_3 * p1;
105 const float p0_3p1_2 = p0_3p1 * p1;
106 const float p0_3p1_3 = p0_3p1_2 * p1;
108 const T* ptr =
coeffs.getData();
122 ptr[10] * p1_2 * p2_2 +
123 ptr[11] * p1_2 * p2_3 +
126 ptr[13] * p1_3 * p2 +
127 ptr[14] * p1_3 * p2_2 +
128 ptr[15] * p1_3 * p2_3 +
133 ptr[18] * p0 * p2_2 +
134 ptr[19] * p0 * p2_3 +
137 ptr[21] * p0p1 * p2 +
138 ptr[22] * p0p1 * p2_2 +
139 ptr[23] * p0p1 * p2_3 +
142 ptr[25] * p0p1_2 * p2 +
143 ptr[26] * p0p1_2 * p2_2 +
144 ptr[27] * p0p1_2 * p2_3 +
147 ptr[29] * p0p1_3 * p2 +
148 ptr[30] * p0p1_3 * p2_2 +
149 ptr[31] * p0p1_3 * p2_3 +
153 ptr[33] * p0_2 * p2 +
154 ptr[34] * p0_2 * p2_2 +
155 ptr[35] * p0_2 * p2_3 +
158 ptr[37] * p0_2p1 * p2 +
159 ptr[38] * p0_2p1 * p2_2 +
160 ptr[39] * p0_2p1 * p2_3 +
163 ptr[41] * p0_2p1_2 * p2 +
164 ptr[42] * p0_2p1_2 * p2_2 +
165 ptr[43] * p0_2p1_2 * p2_3 +
168 ptr[45] * p0_2p1_3 * p2 +
169 ptr[46] * p0_2p1_3 * p2_2 +
170 ptr[47] * p0_2p1_3 * p2_3 +
175 ptr[49] * p0_3 * p2 +
176 ptr[50] * p0_3 * p2_2 +
177 ptr[51] * p0_3 * p2_3 +
180 ptr[53] * p0_3p1 * p2 +
181 ptr[54] * p0_3p1 * p2_2 +
182 ptr[55] * p0_3p1 * p2_3 +
185 ptr[57] * p0_3p1_2 * p2 +
186 ptr[58] * p0_3p1_2 * p2_2 +
187 ptr[59] * p0_3p1_2 * p2_3 +
190 ptr[61] * p0_3p1_3 * p2 +
191 ptr[62] * p0_3p1_3 * p2_2 +
192 ptr[63] * p0_3p1_3 * p2_3;
220 for (
int idx=0; idx<ndim; idx++ )
223 poscoeffs.
set( row, col, (T)coeff );
225 }
while ( powiter.next() );
228 }
while ( positer.next() );
virtual uint64_t getTotalSz() const
virtual int getNDim() const =0
LinSolver< T > * solver
Definition: polynd.h:45
T getValue3D(float x0, float x1, float x2) const
Definition: polynd.h:83
#define mCast(tp, v)
Definition: commondefs.h:124
Implementation of Array2D.
Definition: arrayndimpl.h:102
Contains the information about the size of ArrayND, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:23
ArrayNDImpl< T > coeffs
Definition: polynd.h:44
const T * getData() const
Definition: arraynd.h:55
LinSolver - Solves linear systems of equations on the form A*x=B. A is a matrix of the size N*N...
Definition: gridder2d.h:24
PolynomialND(const ArrayNDInfo &)
Definition: polynd.h:50
Implementation of ArrayND.
Definition: arrayndimpl.h:200
T getValue(const TypeSet< float > &) const
Definition: polynd.h:62
An ArrayND is an array with a given number of dimensions and a size.
Definition: arraynd.h:33
Iterates through all samples in an ArrayND.
Definition: arraynd.h:179
void setCoeff(const int *pos, T val)
Definition: polynd.h:34
void set(int, int, T)
Definition: arrayndimpl.h:448
bool fit(const ArrayND< T > &)
Definition: polynd.h:199
T getCoeff(const int *pos) const
Definition: polynd.h:37
~PolynomialND()
Definition: polynd.h:57
virtual const ArrayNDInfo & info() const =0
#define mClass(module)
Definition: commondefs.h:164
iT IntPowerOf(iT i, iPOW p)
Definition: math2.h:122
PolynomialND is a N-dimensional polynomial with arbitary orders in each dimension. It can be fitted any ArrayND. To access the polynomial's data use getValue. getValue3D is optimized for third order, tree-dimensional cases.
Definition: polynd.h:26