CommonSolve.jl: The Common Solve Definition and Interface
This holds the common solve
, init
, 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.
To avoid method ambiguity, the first argument of solve
, solve!
, and init
must be dispatched on the type defined in your package. For example, do not define a method such as
init(::AbstractVector, ::AlgorithmType)
API
CommonSolve.init
— Functioniter = CommonSolve.init(args...; kwargs...)
Solves an equation or other mathematical problem using the algorithm specified in the arguments. Generally, the interface is:
iter = CommonSolve.init(prob::ProblemType,alg::SolverType; kwargs...)::IterType
CommonSolve.solve!(iter)::SolutionType
where the keyword arguments are uniform across all choices of algorithms. The iter
type will be different for the different problem types.
Missing docstring for solve
. Check Documenter's build log for details.
CommonSolve.solve!
— FunctionCommonSolve.solve!(iter)
Solves an equation or other mathematical problem using the algorithm specified in the arguments. Generally, the interface is:
iter = CommonSolve.init(prob::ProblemType,alg::SolverType; kwargs...)::IterType
CommonSolve.solve!(iter)::SolutionType
where the keyword arguments are uniform across all choices of algorithms. The iter
type will be different for the different problem types.
Contributing
- Please refer to the SciML ColPrac: Contributor's Guide on Collaborative Practices for Community Packages for guidance on PRs, issues, and other matters relating to contributing to SciML.
- There are a few community forums:
- The #diffeq-bridged and #sciml-bridged channels in the Julia Slack
- JuliaDiffEq on Gitter
- On the Julia Discourse forums (look for the modelingtoolkit tag
- See also SciML Community page