Mike,

I’m the original author of this code, and of the changes in version 1.17.  The interface was generalized to allow for a third type of parameters named “C” which can apply to all residuals.  In general, each residual depend one block of parameters in the “A” set, one block of parameters in the “B” set, and all parameters in “C”.  An example application is sparse bundle adjustment for camera calibration in which each A block could be camera extrinsic parameters, each B block could be a 3D point, and the C parameters are intrinsic parameters that are unknown, but share across all cameras.  This is applicable to video where you know the camera intrinsics are fixed over time, but might be unknown.

The additional weights option was added to allow for iteratively re-weighted optimization, e.g. for robust estimation.

You are correct that if you have no “C” parameters you can set num_params_c = 0.  You can also use the default “no_weights” if you are not specifying weights.  This should give you behavior that matches the old version.  However, note that in addition to changes in the constructor, the other member functions have also been updated to add the “C” parameters.  If you have a derived class, you will need to update the other member functions (e.g. fij(), jac_Aij(), etc.) to use the function signature that contains the c parameters, even if you don’t use them.

There are simple tests in core/vnl/tests/test_sparse_lst_sqr_function.cxx that you can look at for an example.  Also, in core/vpgl/algo there are several classes that apply vnl_sparse_lst_sqr_function to the problem of sparse bundle adjustment.  vpgl_bundle_adjust_lsqr provides a direct subclass to vnl_sparse_lst_sqr_function that adds convenience functions for the camera calibration problem.  vpgl_ba_fixed_k_lsqr is a subclass of vpgl_bundle_adjust_lsqr for the problem of sparse bundle adjustment with known intrinsics  (uses num_param_c = 0).  vpgl_ba_shared_k_lsqr is a subclass of vpgl_bundle_adjust_lsqr for the problem of sparse bundle adjustment with unknown, but shared, camera intrinsics (use num_param_c > 0).  These all have test cases, are in active use, and are known to work.

What is the problem you are using vnl_sparse_lst_sqr_function to solve?  Can you elaborate on “meaningless results”?  Let me know if you have any more questions.

—Matt


On May 21, 2014, at 5:31 AM, Mike Pelton <mike@digicave.com> wrote:

Hi all – could use a hand with an issue relating to vnl_sparse_lst_sqr_function.
 
In short, its signature changed between 1.14 and 1.17, and I need to understand how to call the 1.17 version to get the same results as I was getting with 1.14.
 
At 1.17 the call I was using grew two extra parameters “int num_params_c”, and “UseWeights w = no_weights”.
 
I tried setting num_params_c to zero and going with the default for w, but I’m getting meaningless results.
 
Can anyone tell me how to call into the 1.17 version to achieve the equivalent of the 1.14 call?
 
The signatures from the code are below incidentally.
 
Thanks
 
Mike Pelton
Digicave Ltd
 
Signature at 1.17:
 
  //: Construct vnl_sparse_lst_sqr_function.
  // Assumes A consists of \p num_a parameters each of size \p num_params_per_a
  // Assumes B consists of \p num_b parameters each of size \p num_params_per_b
  // Assumes C consists of \p num_params_c parameters
  // \p xmask is a mask for residual availability.  residual e_ij exists only if mask[i][j]==true
  // Assumes each available residual has size \p num_residuals_per_e
  // The optional argument should be no_gradient if the gradf function has not
  // been implemented.  Default is use_gradient.
  vnl_sparse_lst_sqr_function(unsigned int num_a,
                              unsigned int num_params_per_a,
                              unsigned int num_b,
                              unsigned int num_params_per_b,
                              unsigned int num_params_c,
                              const vcl_vector<vcl_vector<bool> >& xmask,
                              unsigned int num_residuals_per_e,
                              UseGradient g = use_gradient,
                              UseWeights w = no_weights);
 
==================================
 
Signature at 1.14
 
 
  //: Construct vnl_sparse_lst_sqr_function.
  // Assumes A consists of \p num_a parameters each of size \p num_params_per_a
  // Assumes B consists of \p num_b parameters each of size \p num_params_per_b
  // \p xmask is a mask for residual availability.  residual e_ij exists only if mask[i][j]==true
  // Assumes each available residual has size \p num_residuals_per_e
  // The optional argument should be no_gradient if the gradf function has not
  // been implemented.  Default is use_gradient.
  vnl_sparse_lst_sqr_function(unsigned int num_a,
                              unsigned int num_params_per_a,
                              unsigned int num_b,
                              unsigned int num_params_per_b,
                              const vcl_vector<vcl_vector<bool> >& xmask,
                              unsigned int num_residuals_per_e,
                              UseGradient g = use_gradient);
 
 
==========================
 
Mike Pelton
 
phone: +44 (0)1273 748 456
Digicave Ltd
3 Orange Row
Brighton
East Sussex
BN1 1UQ
 
- - - - - - - - - - - - - - - - - - - - - -
 
This email is confidential and intended exclusively for the use of the intended recipient(s). Any views or opinions presented are solely those of the author and do not necessarily represent those of Digicave Ltd. If you are not the intended recipient(s) please note that any form of distribution, copying or use of this email or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error, please notify the sender and then delete the message and any attachments from your system.
 
Digicave Ltd is registered in England under Company Number 6499179.
 
Registered Office is 73 Church Road, Hove, BN3 2BB VAT No. 100 0391 90
 
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs_______________________________________________
Vxl-users mailing list
Vxl-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vxl-users