AddResidualBlock and DynamicCostFunction::Evaluate

33 views
Skip to first unread message

Zhian Guo

unread,
Mar 11, 2025, 4:55:51 AMMar 11
to Ceres Solver
I have a question on the behavior of these two functions.   I have DynamicCostFunction implementation that operates on one block but it's identical to all blocks.   So use AddResidualBlock() to add one cost function object to for each block using the pointer to the specific parameter block I operate on.   But what I see in the Evaluate function is that I am presented with a double pointer that includes all blocks.       How do I get around this problem?    It's rather tedious to have a block index passed to each cost function object which is not a very elegant solution.
Thanks in advance.

Sameer Agarwal

unread,
Mar 11, 2025, 8:26:14 AMMar 11
to ceres-...@googlegroups.com
If your construction operates on just one block why are you using a dynamicconstruction?

Sameer 


On Tue, Mar 11, 2025, 1:55 AM Zhian Guo <zhia...@gmail.com> wrote:
I have a question on the behavior of these two functions.   I have DynamicCostFunction implementation that operates on one block but it's identical to all blocks.   So use AddResidualBlock() to add one cost function object to for each block using the pointer to the specific parameter block I operate on.   But what I see in the Evaluate function is that I am presented with a double pointer that includes all blocks.       How do I get around this problem?    It's rather tedious to have a block index passed to each cost function object which is not a very elegant solution.
Thanks in advance.

--
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 visit https://groups.google.com/d/msgid/ceres-solver/82771062-5b8a-4148-949c-cf1915fadb39n%40googlegroups.com.

Zhian Guo

unread,
Mar 11, 2025, 10:31:46 AMMar 11
to ceres-...@googlegroups.com
The parameter block size is not determined at compile time and I have to do analytical jacobian.  
What's the appropriate class I should choose in this case?
Thanks

Sameer Agarwal

unread,
Mar 11, 2025, 11:32:31 AMMar 11
to ceres-...@googlegroups.com

Zhian Guo

unread,
Mar 11, 2025, 9:59:36 PMMar 11
to ceres-...@googlegroups.com
Ok thanks.
In the Evaluate interface of CostFunction class is it garanteed that parameter[0] is the pointer I used to call Problem::AddResidualBlock)?

Sameer Agarwal

unread,
Mar 11, 2025, 11:44:35 PMMar 11
to ceres-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages