techoe / ceres-solver

Automatically exported from code.google.com/p/ceres-solver
Other
0 stars 0 forks source link

Program::NumEffectiveParameters() does not consider constant blocks #79

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a problem with 2 or more parameter blocks
2. Call Problem::SetParameterBlockConstant for one of those blocks
3. Set Solver::Options::return_initial_jacobian and/or 
Solver::Options::return_final_jacobian to true
4. Solve the problem and inspect the number of columns of 
Solver::Summary::initial_jacobian and/or Solver::Summary::final_jacobian

What is the expected output? What do you see instead?
I'd expect the number of columns of the Jacobians to be reduced by the number 
of parameters managed by the parameter block that has been set constant. 
However, the number of columns remains unaffected.

What version of the product are you using? On what operating system?
Commit Hash:    8af9ebf38c48429ad02ff03d87f6a1e85e9b00a5
Windows 7 64bit

Please provide any additional information below.
Program::NumEffectiveParameters does consider the local sizes of the program's 
parameter blocks, but it does not consider if they are constant.
Notably, this bug does not affect the correctness of results, but it does 
increase the amount of used memory (e.g. if gradients are to be returned in the 
summary). Solver::Summary::num_parameter_blocks and 
Solver::Summary::num_parameters are not affected, which is why, I guess, this 
bug has not been found before.

Original issue reported on code.google.com by willi.karel on 30 Nov 2012 at 1:40

GoogleCodeExporter commented 9 years ago
Willi,

This is not a bug, but a design choice we made. Its a matter of how you 
interpret the constancy of a parameter block. Notice that we do not have 
NumReducedParameterBlocks as a method in Problem. It is because actually 
figuring out the number of reduced parameter blocks is not just a matter of 
constancy, it also requires keeping track of what parameter blocks are part of 
a residual block and what are not. So we made the design choice of exposing the 
"full" Jacobian. That way the user does not have to worry about what parameter 
blocks are being skipped over and not etc.

The idea of a reduced jacobian is internal to Ceres and is not something which 
is exposed to the user, and thus the semantics of Program are designed for 
efficient usage internally and not to be exposed externally.

Hope this helps,  I am going to close this issue as working as intended. 

Sameer

Original comment by sameerag...@google.com on 30 Nov 2012 at 11:55