36 #ifndef IE_CORE_LEVENBERGMARQUARDT_H
37 #define IE_CORE_LEVENBERGMARQUARDT_H
39 #include "boost/static_assert.hpp"
41 #include "IECore/TypeTraits.h"
42 #include "IECore/VectorTypedData.h"
48 struct DefaultLevenbergMarquardtTraits;
87 template<
typename T,
typename ErrorFn,
template<
typename>
class Traits = DefaultLevenbergMarquardtTraits >
90 BOOST_STATIC_ASSERT( boost::is_floating_point<T>::value );
95 typedef ErrorFn ErrorFunctionType;
96 typedef Traits<T> TraitsType;
111 T ftol = Traits<T>::tolerance(),
112 T xtol = Traits<T>::tolerance(),
113 T gtol = Traits<T>::tolerance(),
114 T epsilon = Traits<T>::machinePrecision(),
126 void setMaxCalls(
unsigned maxCalls );
127 unsigned getMaxCalls()
const;
130 Status
solve(
typename TypedData< std::vector<T> >::Ptr parameters, ErrorFn &fn );
140 unsigned int m_maxCalls;
141 unsigned int m_numCalls;
148 inline T sqr(
const T &x )
const
154 T computeLMParameter( std::vector<T> &x, std::vector<T> &sdiag, T delta );
156 void qrSolve( std::vector<T> &r, std::vector<T> &diag,
157 std::vector<T> &qtb, std::vector<T> &x, std::vector<T> &sdiag );
160 T euclideanNorm(
typename std::vector<T>::const_iterator begin,
typename std::vector<T>::const_iterator end )
const;
163 std::vector<T> m_diag;
164 std::vector<T> m_qtf;
165 std::vector<T> m_fjac;
166 std::vector<T> m_wa1;
168 std::vector<T> m_wa3;
170 std::vector<int> m_ipvt;
175 #include "IECore/LevenbergMarquardt.inl"
177 #endif // IE_CORE_LEVENBERGMARQUARDT_H
Status solve(typename TypedData< std::vector< T > >::Ptr parameters, ErrorFn &fn)
Updates parameters in place. Returns true on success.
Definition: TypedData.h:64
Definition: LevenbergMarquardt.h:88
This namespace contains all components of the core library.
Definition: AddSmoothSkinningInfluencesOp.h:43