Improved support for functions over arbitrary-order arrays

This pull request extends the set of optimization methods that support arbitrary-order arrays to include gradient descent and simulated annealing.

As a side change, it also makes it possible to use integer inputs for univariate optimization.