cast from T(Jet) to double

1,769 views
Skip to first unread message

坂井敦

unread,
Oct 14, 2016, 2:03:10 AM10/14/16
to Ceres Solver
Hi.

I use ceres solver for robotics and I love it!

I have a question.
I want to use the pow function of math.h in the bool operator[] function like this.

template <typename T>
   bool operator()(const T* const x, T* residual) const {
     residual[0] = pow(x,1.5) ;
     return true;
   }

However, x's type is T(Jet), so I cannot compile it.
What is the easiest way to cast from T(Jet) to double?

Thanks in advance.

Atsushi



Sameer Agarwal

unread,
Oct 14, 2016, 2:04:25 AM10/14/16
to Ceres Solver
you should not and cannot cast from jet to double. that will lead to you destroying the differentiation logic.
ceres comes with pow function that you should be able to use. there is an overload defined in jet.h.

--
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/ad7bc159-a034-4b65-806c-cfae56cf93e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

坂井敦

unread,
Oct 14, 2016, 2:53:00 PM10/14/16
to Ceres Solver

Hi Sameer.

Thank you for your reply.

OK. I understand it.

But, I have a another question about it.
Can I get a double value from the jet?
I want to use an external library sometimes for  residual calculation.
But the library cannot use the jet value as input.
Do you have any ideas to cope with the situation?

Thank you.

Atsushi
 


2016年10月13日木曜日 23時04分25秒 UTC-7 Sameer Agarwal:

Sameer Agarwal

unread,
Oct 14, 2016, 2:57:09 PM10/14/16
to Ceres Solver
have a look at CostFunctionToFunctor and its associated docs for precisely this case




Reply all
Reply to author
Forward
0 new messages