33 { coeffs(pos) = val; }
36 {
return coeffs.get( pos ); }
39 T getValue3D(
float x0,
float x1,
float x2 )
const;
59 template <
class T>
inline 64 const int ndim =
coeffs.info().getNDim();
71 for (
int idx=0; idx<ndim; idx++ )
74 res += posproduct *
coeffs.getND( coeffiter.getPos() );
75 }
while ( coeffiter.next() );
80 template <
class T>
inline 87 pos[0] = p0; pos[1] = p1; pos[2] = p2;
92 float p0_2 = p0 * p0;
float p0_3 = p0_2 * p0;
93 float p1_2 = p1 * p1;
float p1_3 = p1_2 * p1;
94 float p2_2 = p2 * p2;
float p2_3 = p2_2 * p2;
96 const float p0p1 = p0 * p1;
97 const float p0p1_2 = p0p1 * p1;
98 const float p0p1_3 = p0p1_2 * p1;
99 const float p0_2p1 = p0_2 * p1;
100 const float p0_2p1_2 = p0_2p1 * p1;
101 const float p0_2p1_3 = p0_2p1_2 * p1;
102 const float p0_3p1 = p0_3 * p1;
103 const float p0_3p1_2 = p0_3p1 * p1;
104 const float p0_3p1_3 = p0_3p1_2 * p1;
106 const T* ptr =
coeffs.getData();
120 ptr[10] * p1_2 * p2_2 +
121 ptr[11] * p1_2 * p2_3 +
124 ptr[13] * p1_3 * p2 +
125 ptr[14] * p1_3 * p2_2 +
126 ptr[15] * p1_3 * p2_3 +
131 ptr[18] * p0 * p2_2 +
132 ptr[19] * p0 * p2_3 +
135 ptr[21] * p0p1 * p2 +
136 ptr[22] * p0p1 * p2_2 +
137 ptr[23] * p0p1 * p2_3 +
140 ptr[25] * p0p1_2 * p2 +
141 ptr[26] * p0p1_2 * p2_2 +
142 ptr[27] * p0p1_2 * p2_3 +
145 ptr[29] * p0p1_3 * p2 +
146 ptr[30] * p0p1_3 * p2_2 +
147 ptr[31] * p0p1_3 * p2_3 +
151 ptr[33] * p0_2 * p2 +
152 ptr[34] * p0_2 * p2_2 +
153 ptr[35] * p0_2 * p2_3 +
156 ptr[37] * p0_2p1 * p2 +
157 ptr[38] * p0_2p1 * p2_2 +
158 ptr[39] * p0_2p1 * p2_3 +
161 ptr[41] * p0_2p1_2 * p2 +
162 ptr[42] * p0_2p1_2 * p2_2 +
163 ptr[43] * p0_2p1_2 * p2_3 +
166 ptr[45] * p0_2p1_3 * p2 +
167 ptr[46] * p0_2p1_3 * p2_2 +
168 ptr[47] * p0_2p1_3 * p2_3 +
173 ptr[49] * p0_3 * p2 +
174 ptr[50] * p0_3 * p2_2 +
175 ptr[51] * p0_3 * p2_3 +
178 ptr[53] * p0_3p1 * p2 +
179 ptr[54] * p0_3p1 * p2_2 +
180 ptr[55] * p0_3p1 * p2_3 +
183 ptr[57] * p0_3p1_2 * p2 +
184 ptr[58] * p0_3p1_2 * p2_2 +
185 ptr[59] * p0_3p1_2 * p2_3 +
188 ptr[61] * p0_3p1_3 * p2 +
189 ptr[62] * p0_3p1_3 * p2_2 +
190 ptr[63] * p0_3p1_3 * p2_3;
218 for (
int idx=0; idx<ndim; idx++ )
221 poscoeffs.
set( row, col, (T)coeff );
223 }
while ( powiter.next() );
226 }
while ( positer.next() );
virtual uint64_t getTotalSz() const
virtual int getNDim() const =0
LinSolver< T > * solver
Definition: polynd.h:43
T getValue3D(float x0, float x1, float x2) const
Definition: polynd.h:81
#define mCast(tp, v)
Definition: commondefs.h:120
Implementation of Array2D.
Definition: arrayndimpl.h:101
Contains the information about the size of ArrayND, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:21
ArrayNDImpl< T > coeffs
Definition: polynd.h:42
const T * getData() const
Definition: arraynd.h:51
LinSolver - Solves linear systems of equations on the form A*x=B. A is a matrix of the size N*N...
Definition: gridder2d.h:22
PolynomialND(const ArrayNDInfo &)
Definition: polynd.h:48
Implementation of ArrayND.
Definition: arrayndimpl.h:199
T getValue(const TypeSet< float > &) const
Definition: polynd.h:60
An ArrayND is an array with a given number of dimensions and a size.
Definition: arraynd.h:29
Iterates through all samples in an ArrayND.
Definition: arraynd.h:175
void setCoeff(const int *pos, T val)
Definition: polynd.h:32
void set(int, int, T)
Definition: arrayndimpl.h:447
bool fit(const ArrayND< T > &)
Definition: polynd.h:197
T getCoeff(const int *pos) const
Definition: polynd.h:35
~PolynomialND()
Definition: polynd.h:55
virtual const ArrayNDInfo & info() const =0
#define mClass(module)
Definition: commondefs.h:161
iT IntPowerOf(iT i, iPOW p)
Definition: math2.h:126
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:24