Parameter Block Size incorrect ?!

876 views
Skip to first unread message

Carsten Klein

unread,
Apr 29, 2015, 10:27:20 AM4/29/15
to ceres-...@googlegroups.com
Hello everybody!

I am using ceres solver for simple geometric constraint calculations!

I need to define an AutoDiffCostFunction which computes a 1-dimensional residual based on one 2-dimensional input and another one computing a 2-dimensional residual based on a 2-dimensional input.

Following the tutorial and instruction this should be achieved by:

ceres::CostFunction* cf = new ceres::AutoDiffCostFunction<PointOnPoint, 1, 2>( new PointOnPoint() );
ceres::CostFunction* cf = new ceres::AutoDiffCostFunction<PointDistance, 2, 2>( new PointDistance() );

Setting up the problem by
 
ceres::Problem problem;
problem.AddResidualBlock( cf, NULL, vec);

and solving will lead to the following error:
Check failed: parameter_blocks.size() == cost_function->parameter_block_sizes().size()

vec is a std::vector<double*> containing two pointers to double values which is checked before passing it to the Problem.

Thanks for your help!!


Sameer Agarwal

unread,
Apr 29, 2015, 10:30:38 AM4/29/15
to ceres-...@googlegroups.com
Carsten,

I need to define an AutoDiffCostFunction which computes a 1-dimensional residual based on one 2-dimensional input and another one computing a 2-dimensional residual based on a 2-dimensional input.

Following the tutorial and instruction this should be achieved by:

ceres::CostFunction* cf = new ceres::AutoDiffCostFunction<PointOnPoint, 1, 2>( new PointOnPoint() );
ceres::CostFunction* cf = new ceres::AutoDiffCostFunction<PointDistance, 2, 2>( new PointDistance() );

Both of these imply that the autodiffcost function expects a single parameter block of two dimensions.
 
Setting up the problem by
 
ceres::Problem problem;
problem.AddResidualBlock( cf, NULL, vec);

what you are providing to the user are two parameter blocks of one dimension each. The solution would be to group the two entries in vec as a single parameter block.

HTH,
Sameer

 


and solving will lead to the following error:
Check failed: parameter_blocks.size() == cost_function->parameter_block_sizes().size()

vec is a std::vector<double*> containing two pointers to double values which is checked before passing it to the Problem.

Thanks for your help!!


--
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/89b6a932-c13f-4c96-bbe4-bedce129e7d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages