Home

Awesome

CommonSolve

Join the chat at https://julialang.zulipchat.com #sciml-bridged Global Docs

codecov Build Status

ColPrac: Contributor's Guide on Collaborative Practices for Community Packages SciML Code Style

This holds the common solve, init, step!, and solve! commands. By using the same definition, solver libraries from other completely different ecosystems can extend the functions and thus not clash with SciML if both ecosystems export the solve command. The rules are that you must dispatch on one of your own types. That's it. No pirates.

General recommendation

solve function has the default definition

solve(args...; kwargs...) = solve!(init(args...; kwargs...))

So, we recommend defining

init(::ProblemType, args...; kwargs...)::SolverType
solve!(::SolverType)::SolutionType

where ProblemType, SolverType, and SolutionType are the types defined in your package.

In many cases, the SolverType is an object that is iteratively progressed to achieve the solution. In such cases, the step! function can be used:

step!(::SolverType, args...; kwargs...)

To avoid method ambiguity, the first argument of solve, solve!, step!, and init must be dispatched on the type defined in your package. For example, do not define a method such as

init(::AbstractVector, ::AlgorithmType)