extended MinProblemSolver::Function to 1) report the space dimensionality, 2) compute gradient if needed