From 4e391c36c1d1d9c5fb59f3fbc8b7481ac82416a2 Mon Sep 17 00:00:00 2001 From: Mike Vitus Date: Wed, 28 Feb 2018 14:13:25 -0800 Subject: [PATCH] Corrects the documentation of Problem::AddResidualBlock. This change is provided on behalf of Steve Hsu. Tested by compiling and inspecting the documentation. Change-Id: Ib892bcc3ad76cba1bad133a1fd1d26468d0e6437 --- docs/source/nnls_modeling.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/source/nnls_modeling.rst b/docs/source/nnls_modeling.rst index 7fb8fbb1d..1aee32d3c 100644 --- a/docs/source/nnls_modeling.rst +++ b/docs/source/nnls_modeling.rst @@ -1537,6 +1537,7 @@ Instances once, regardless of how many residual blocks refer to them. .. function:: ResidualBlockId Problem::AddResidualBlock(CostFunction* cost_function, LossFunction* loss_function, const vector parameter_blocks) +.. function:: ResidualBlockId Problem::AddResidualBlock(CostFunction* cost_function, LossFunction* loss_function, double *x0, double *x1, ...) Add a residual block to the overall cost function. The cost function carries with it information about the sizes of the @@ -1546,6 +1547,9 @@ Instances NULL, in which case the cost of the term is just the squared norm of the residuals. + The parameter blocks may be passed together as a + ``vector``, or as up to ten separate ``double*`` pointers. + The user has the option of explicitly adding the parameter blocks using AddParameterBlock. This causes additional correctness checking; however, AddResidualBlock implicitly adds the parameter @@ -1571,12 +1575,18 @@ Instances double x1[] = {1.0, 2.0, 3.0}; double x2[] = {1.0, 2.0, 5.0, 6.0}; double x3[] = {3.0, 6.0, 2.0, 5.0, 1.0}; + vector v1; + v1.push_back(x1); + vector v2; + v2.push_back(x2); + v2.push_back(x1); Problem problem; problem.AddResidualBlock(new MyUnaryCostFunction(...), NULL, x1); problem.AddResidualBlock(new MyBinaryCostFunction(...), NULL, x2, x1); - + problem.AddResidualBlock(new MyUnaryCostFunction(...), NULL, v1); + problem.AddResidualBlock(new MyBinaryCostFunction(...), NULL, v2); .. function:: void Problem::AddParameterBlock(double* values, int size, LocalParameterization* local_parameterization)