solve function has the default definition
solve(args...; kwargs...) = solve!(init(args...; kwargs...))
The interface for the three functions is as follows:
init(::ProblemType, args...; kwargs...) :: IteratorType solve!(::SolverType) :: SolutionType
SolutionType are the types defined in your package.
To avoid method ambiguity, the first argument of
init must be dispatched on the type defined in your package. For example, do not define a method such as
init's return gives an
IteratorType which is designed to allow the user to have more direct handling over the internal solving process. Because of this internal nature, the
IteratorType has a less unified interface across problem types than other portions like
SolutionType. For example, for differential equations this is the Integrator Interface designed for mutating solutions in a manner for callback implementation, which is distinctly different from the LinearSolve init interface which is designed for caching efficiency with reusing factorizations.
solve are the common entry point for users, solver packages will mostly define dispatches on
SciMLBase.__solve. The reason is because this allows for
SciMLBase.solve to have common implementations across all solvers for doing things such as checking for common errors and throwing high level messages. Solvers can opt-out of the high level error handling by directly defining
SciMLBase.solve instead, though this is not recommended in order to allow for uniformity of the error messages.