I have a user-defined function for which I have an analytical gradient I’d like to use. Furthermore, most of the effort in calculating that gradient is already done in calculating the value of the function. Is there a way to pass JuMP a function that does both, in a way that is efficient? I recognize I could have a “wrapper” function that extracts only the part that JuMP wants (value or gradient), but surely that will be implemented in a very slow fashion. NLsolve, for instance, has a capability like this.