43 template <
typename Real>
46 public ApprQuery<Real, ApprPolynomial3<Real>, std::array<Real, 3>>
57 bool Fit(std::vector<std::array<Real, 3>>
const& observations,
58 std::vector<int>
const&
indices);
63 Real
Error(std::array<Real, 3>
const& observation)
const;
86 template <
typename Real>
97 mXDomain[0] = std::numeric_limits<Real>::max();
99 mYDomain[0] = std::numeric_limits<Real>::max();
105 template <
typename Real>
111 template <
typename Real>
113 std::vector<std::array<Real, 3>>
const& observations,
114 std::vector<int>
const&
indices)
116 if (indices.size() > 0)
118 int s, i0, j0, k0, i1, j1, k1;
121 int numSamples =
static_cast<int>(indices.size());
126 for (s = 0; s < numSamples; ++
s)
128 Real
x = observations[indices[
s]][0];
129 Real
y = observations[indices[
s]][1];
135 xPower[
s][0] = (Real)1;
136 for (i0 = 1; i0 <= twoXDegree; ++i0)
138 xPower[
s][i0] = x * xPower[
s][i0 - 1];
141 yPower[
s][0] = (Real)1;
142 for (j0 = 1; j0 <= twoYDegree; ++j0)
144 yPower[
s][j0] = y * yPower[
s][j0 - 1];
158 for (s = 0; s < numSamples; ++
s)
160 Real
w = observations[indices[
s]][2];
161 sum += w * xPower[
s][i0] * yPower[
s][j0];
172 for (s = 0; s < numSamples; ++
s)
174 sum += xPower[
s][i0 + i1] * yPower[
s][j0 + j1];
185 bool hasNonzero =
false;
186 for (
int i = 0; i <
mSize; ++i)
189 if (coefficients[i] != (Real)0)
201 template <
typename Real>
205 Real
w =
Evaluate(observation[0], observation[1]);
206 Real error =
std::abs(w - observation[2]);
210 template <
typename Real>
216 template <
typename Real>
222 template <
typename Real>
228 template <
typename Real>
std::vector< Real > mYCoefficient
std::vector< Real > mParameters
bool Fit(std::vector< std::array< Real, 3 >> const &observations, std::vector< int > const &indices)
gte::BSNumber< UIntegerType > abs(gte::BSNumber< UIntegerType > const &number)
std::array< Real, 2 > mYDomain
GLubyte GLubyte GLubyte GLubyte w
ApprPolynomial3(int xDegree, int yDegree)
GLsizei GLenum const void * indices
std::array< Real, 2 > mXDomain
std::array< Real, 2 > const & GetXDomain() const
Real Evaluate(Real x, Real y) const
std::array< Real, 2 > const & GetYDomain() const
Real Error(std::array< Real, 3 > const &observation) const
Quaternion< Real > Inverse(Quaternion< Real > const &d)
int GetMinimumRequired() const
std::vector< Real > const & GetParameters() const