Fix broken constant parameter blocks

This fixes the bug introduced in a previous commit,
and adds a test to check that constant parameter
blocks work as expected.

This also refactors the Solver/SolverImpl split so
that SolverImpl is no longer a friend of Problem;
instead, Solver is. This makes it possible to
verify the invariant on parameter block states in
the unit test, and is a more symmetric design
anyway.

Bug: 51
Change-Id: Id503f5b526cfb8bc24aae3aaad2e414b14063d78
diff --git a/internal/ceres/program.h b/internal/ceres/program.h
index 27b58e1..1386d3c 100644
--- a/internal/ceres/program.h
+++ b/internal/ceres/program.h
@@ -71,9 +71,13 @@
   bool StateVectorToParameterBlocks(const double *state);
   void ParameterBlocksToStateVector(double *state) const;
 
-  // Copy internal state to and from the user's parameters.
+  // Copy internal state to the user's parameters.
   void CopyParameterBlockStateToUserState();
-  bool CopyUserStateToParameterBlocks();
+
+  // Set the parameter block pointers to the user pointers. Since this
+  // runs parameter block set state internally, which may call local
+  // parameterizations, this can fail. False is returned on failure.
+  bool SetParameterBlockStatePtrsToUserStatePtrs();
 
   // Update a state vector for the program given a delta.
   bool Plus(const double* state,