Closed benedict1986 closed 9 years ago
Hi,
Since USERPARAM is a template parameter, nothing prevents you from defining a struct with all the data you need, for example:
struct MyInputData
{
std::vector
};
then the eval function could be like:
typedef void (*TFunctorEval)( const Eigen::VectorXd &x, const MyInputData &y, Eigen::VectorXd &out);
Hi, thank you for answering my question. I tried to code it according to your suggestion but still get an error.
My function is defined as
void Function(const CVectorDouble &x, tuple<CVectorDouble, CVectorDouble> *a, CVectorDouble &out_f)
and it is used as
CLevenbergMarquardt::execute(xHat, X, &Function, increments_x, Y, info, false, 100);
I got the error as
1 IntelliSense: argument of type "void (*)(const mrpt::math::CVectorDouble &x, std::tuple<mrpt::math::CVectorDouble, mrpt::math::CVectorDouble> &a, mrpt::math::CVectorDouble &out_f)" is incompatible with parameter of type "void (*)(const mrpt::math::CVectorDouble &x, const mrpt::math::CVectorDouble &y, mrpt::math::CVectorDouble &out)"
Do I have to change the code in
template < typename VECTORTYPE = Eigen::VectorXd, class USERPARAM = VECTORTYPE >
or
typedef void (*TFunctorEval)( const VECTORTYPE &x, const USERPARAM &y, VECTORTYPE &out);
in file CLevenbergMarquardt.h?
Thank you.
Hi, I am writing to ask a question about writing the cost function for LM method. In the function template,
typedef void (*TFunctorEval)( const VECTORTYPE &x, const USERPARAM &y, VECTORTYPE &out);
we can use x, y and out as parameters. As I understand, x is the initial value for optimisating variables, y is observation data and output is the optimisation result. My questions is what if y = [y1, y2, ..., yT] and yt = [u, v, w]'? How can I pass the total length (T) of the time-series? If y is a 3D parameter, does out also is a 3D vector with the error in each dimension?
Thank you