error: no match for ‘operator/’ (operand types are ‘const ceres::Jet<double, 5>’ and ‘int’)

1,106 views
Skip to first unread message

Thanh Pham Chi

unread,
Jan 9, 2022, 9:54:56 PM1/9/22
to Ceres Solver
Hi everyone,
I'm new to ceres-solver and trying to solve my 7 non-linear equations with 5 unknown variables and then this error appeared (see attached image below). Can anyone help me please.Screenshot from 2022-01-10 09-51-35.png

Thanh Pham Chi

unread,
Jan 9, 2022, 9:58:34 PM1/9/22
to Ceres Solver
Again here is a better image
Screenshot from 2022-01-10 09-51-35.png

Sameer Agarwal

unread,
Jan 9, 2022, 10:08:38 PM1/9/22
to ceres-...@googlegroups.com
Are you using =/ in your code?

--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/c1420173-8a2e-42c6-b39d-35a6d32d8825n%40googlegroups.com.

Thanh Pham Chi

unread,
Jan 10, 2022, 3:11:06 AM1/10/22
to Ceres Solver
Thank you for your time. No, I don't use it in my code. Also here are some notes from the ceres solver, hope it helps you better understand the situation.
Screenshot from 2022-01-10 14-52-21.png

Rick Liu

unread,
Jan 10, 2022, 5:06:41 AM1/10/22
to ceres-...@googlegroups.com
Try to wrap number by T in AutoDiffCostFunction. See the example below:
struct CostFunctor {
template <typename T>
bool operator()(const T* const x, T* residual) const {
- residual[0] = x[0] / 10.0;
+ residual[0] = x[0] / T(10.0);
return true;
}
};

Sameer Agarwal

unread,
Jan 10, 2022, 10:59:14 AM1/10/22
to ceres-...@googlegroups.com
From the errors it seems you are trying to work with integers. you need to cast to T, but also you need to becareful that your function is actually differentiable.

Thanh Pham Chi

unread,
Jan 11, 2022, 3:42:06 AM1/11/22
to Ceres Solver
Indeed, cast integers to T() fixed my problem. Thank you so much @Ricky and @Sameer.
Reply all
Reply to author
Forward
0 new messages