Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

if you look at the MinProblemSolver::Function interface, you'll see, that there are actually two pure virtual functions to implement (yea, doc fail ..), so, you'll need an implementation for MinProblemSolver::Function::getDims() maybe like this:

class DistanceToLines :public MinProblemSolver::Function
{
public:
    double calc(const double* x)const
    {
        return x[0] * x[0] + x[1] * x[1];
    }
    int getDims() const
    {
         return 2;
    }
};

if you look at the MinProblemSolver::Function interface, you'll see, that there are actually two pure virtual functions to implement (yea, doc fail ..), ., also it wasn't in the 3.0 version, your example is refering to),

so, you'll need an implementation for MinProblemSolver::Function::getDims() maybe like this:

class DistanceToLines :public MinProblemSolver::Function
{
public:
    double calc(const double* x)const
    {
        return x[0] * x[0] + x[1] * x[1];
    }
    int getDims() const
    {
         return 2;
    }
};