What is In-Place and what is Out-Of-Place
In SimpleSolvers we almost always use in-place functions internally for performance, but let the user deal with out-of-place functions for ease of use.
Example
using SimpleSolvers
f(x) = sum(x.^2 .* exp.(-abs.(x)) + 2 * cos.(x) .* exp.(-x.^2))
If we now allocate a OptimizerProblem based on this, we get a series of in-place functions based on this. For example value![1]:
x = [0.]
obj = OptimizerProblem(f, x)
y = [0.]
value!(obj, x)
value(obj) == f(x)trueTo compute the derivative we can use gradient!:
x = [[x] for x in -7.:.1:7.]
y = Vector{Float64}[]
for x_sing in x
gradient!(obj, GradientAutodiff{Float64}(obj.F, length(x_sing)), x_sing)
push!(y, copy(gradient(obj)))
endNote that here we used GradientAutodiff to compute the gradient. We can also use GradientFunction and GradientFiniteDifferences.

The idea is however that the user almost never used the in-place versions of these routines directly, but instead functions like solve! and value, gradient etc. as a possible diagnostic.
- 1See the section on optimizer problems for an explanation of how to use
value!andvalue.