11template <
class DataPo
int,
class _WFunctor,
typename T>
19template <
class DataPo
int,
class _WFunctor,
typename T>
23 const DataPoint &attributes)
25 if( Base::addLocalNeighbor(w, localQ, attributes) ) {
26 m_cov += w * localQ * localQ.transpose();
33template <
class DataPo
int,
class _WFunctor,
typename T>
38 if(Base::finalize() !=
STABLE)
39 return Base::m_eCurrentState;
41 if(Base::getNumNeighbors() < DataPoint::Dim)
45 auto centroid = Base::barycenterLocal();
46 m_cov = m_cov/Base::getWeightSum() - centroid * centroid.transpose();
49 m_solver.computeDirect(m_cov);
51 m_solver.compute(m_cov);
53 Base::m_eCurrentState = ( m_solver.info() == Eigen::Success ?
STABLE :
UNDEFINED );
55 return Base::m_eCurrentState;
58template <
class DataPo
int,
class _WFunctor,
typename T>
62 return m_solver.eigenvalues()(0) / m_solver.eigenvalues().mean();
66template <
class DataPo
int,
class _WFunctor,
int DiffType,
typename T>
72 for(
int k=0; k<Base::NbDerivatives; ++k)
78template <
class DataPo
int,
class _WFunctor,
int DiffType,
typename T>
82 const DataPoint &attributes,
85 if( Base::addLocalNeighbor(w, localQ, attributes, dw) ) {
86 for(
int k=0; k<Base::NbDerivatives; ++k)
87 m_dCov[k] += dw[k] * localQ * localQ.transpose();
96template <
class DataPo
int,
class _WFunctor,
int DiffType,
typename T>
100 PONCA_MULTIARCH_STD_MATH(sqrt);
109 for(
int k=0; k<Base::NbDerivatives; ++k)
112 m_dCov[k] = m_dCov[k]
113 - cog * Base::m_dSumP.col(k).transpose()
114 - Base::m_dSumP.col(k) * cog.transpose()
115 + Base::m_dSumW[k] * cogSq;
119 return Base::m_eCurrentState;
Procedure that compute and decompose the covariance matrix of the neighbors positions in .
typename DataPoint::Scalar Scalar
Alias to scalar type.
typename Base::VectorType VectorType
Alias to vector type.
Internal generic class computing the derivatives of covariance matrix computed by CovarianceFitBase.
typename DataPoint::MatrixType MatrixType
Alias to matrix type.
typename Base::VectorType VectorType
Alias to vector type.
typename Base::ScalarArray ScalarArray
Alias to scalar derivatives array.
typename DataPoint::Scalar Scalar
Alias to scalar type.
FIT_RESULT
Enum corresponding to the state of a fitting method (and what the finalize function returns)
@ UNDEFINED
The fitting is undefined, you can't use it for valid results.
@ STABLE
The fitting is stable and ready to use.