1

as stated above I want to know if there is a way to access the double value Ceres uses as a parameter inside the cost function?

struct CostFunctor {

CostFunctor() {};

template <typename T>
bool operator()(const T* parameters, T* residual) const {
    // supposed parameters was an array 'double parameters[]' 
    std::cout << typeid(parametes[0]).name() << std::endl;
    //then parameters[0] is of type struct ceres::Jet<double,1>
   
    // now I want something like:
    double temp = parameters[0].a;
    // ... 
    return true;
}

I really need a way to get Ceres to work with Jacobian and use the double value in the cost function so I would be very grateful for every creative idea for a workaround if there is no simple way.

Thank you and have a nice day!

Quirlight
  • 41
  • 5

1 Answers1

1

Doing something like this is usually a very bad idea. Because you are breaking the logic for how derivatives are computed. If you say more about what you are trying to do, then a better answer can be suggested.

Sameer Agarwal
  • 592
  • 2
  • 4