Initialization

Before we can use SimpleSolvers.update! we have to initialize with SimpleSolvers.initialize![1].

Similar to SimpleSolvers.update!, SimpleSolvers.initialize! returns the first input argument as output. Examples include:

We demonstrate these examples in code. First for an instance of SimpleSolvers.Hessian:

using LinearAlgebra: norm

x = rand(3)
obj = MultivariateObjective(x -> norm(x - vcat(0., 0., 1.)) ^ 2, x)

hes = Hessian(obj, x; mode = :autodiff)
initialize!(hes, x)
hes.H
3×3 Matrix{Float64}:
 NaN  NaN  NaN
 NaN  NaN  NaN
 NaN  NaN  NaN

For an instance of SimpleSolvers.NewtonOptimizerCache[2]:

cache = SimpleSolvers.NewtonOptimizerCache(x)
initialize!(cache, x)
cache.g
3-element Vector{Float64}:
 NaN
 NaN
 NaN

Clear Routines

For SimpleSolvers.OptimizerResult and SimpleSolvers.OptimizerStatus the SimpleSolvers.clear! routines are used instead of the SimpleSolvers.initialize! routines.

Reasoning behind Initialization with NaNs

We initialize with NaNs instead of with zeros (or other values) as this clearly divides the initialization from the numerical operations (which are done with SimpleSolvers.update!).

Alloc Functions