The Selection Gradient of an Infinite-Dimensional Trait