Add support for removing parameter and residual blocks.

This adds support for removing parameter and residual blocks.
There are two modes of operation: in the first, removals of
paremeter blocks are expensive, since each remove requires
scanning all residual blocks to find ones that depend on the
removed parameter. In the other, extra memory is sacrificed to
maintain a list of the residuals a parameter block depends on,
removing the need to scan. In both cases, removing residual blocks
is fast.

As a caveat, any removals destroys the ordering of the parameters,
so the residuals or jacobian returned from Solver::Solve() is
meaningless. There is some debate on the best way to handle this;
the details remain for a future change.

This also adds some overhead, even in the case that fast removals
are not requested:

- 1 int32 to each residual, to track its position in the program.
- 1 pointer to each parameter, to store the dependent residuals.

Change-Id: I71dcac8656679329a15ee7fc12c0df07030c12af
diff --git a/internal/ceres/parameter_block_test.cc b/internal/ceres/parameter_block_test.cc
index 35998dc..09156f8 100644
--- a/internal/ceres/parameter_block_test.cc
+++ b/internal/ceres/parameter_block_test.cc
@@ -38,7 +38,7 @@
 
 TEST(ParameterBlock, SetLocalParameterization) {
   double x[3] = { 1.0, 2.0, 3.0 };
-  ParameterBlock parameter_block(x, 3);
+  ParameterBlock parameter_block(x, 3, -1);
 
   // The indices to set constant within the parameter block (used later).
   vector<int> indices;
@@ -111,7 +111,7 @@
 TEST(ParameterBlock, SetStateUpdatesLocalParameterizationJacobian) {
   TestParameterization test_parameterization;
   double x[1] = { 1.0 };
-  ParameterBlock parameter_block(x, 1, &test_parameterization);
+  ParameterBlock parameter_block(x, 1, -1, &test_parameterization);
 
   EXPECT_EQ(2.0, *parameter_block.LocalParameterizationJacobian());
 
@@ -122,7 +122,7 @@
 
 TEST(ParameterBlock, PlusWithNoLocalParameterization) {
   double x[2] = { 1.0, 2.0 };
-  ParameterBlock parameter_block(x, 2);
+  ParameterBlock parameter_block(x, 2, -1);
 
   double delta[2] = { 0.2, 0.3 };
   double x_plus_delta[2];
@@ -164,7 +164,7 @@
 TEST(ParameterBlock, DetectBadLocalParameterization) {
   double x = 1;
   BadLocalParameterization bad_parameterization;
-  ParameterBlock parameter_block(&x, 1, &bad_parameterization);
+  ParameterBlock parameter_block(&x, 1, -1, &bad_parameterization);
   double y = 2;
   EXPECT_FALSE(parameter_block.SetState(&y));
 }