From 6c941bf02e5cb8cca9f8b9a244679abfd6951865 Mon Sep 17 00:00:00 2001 From: Datseris Date: Sun, 4 Jun 2023 13:25:15 +0100 Subject: [PATCH 1/5] add `step!` --- Project.toml | 2 +- src/CommonSolve.jl | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index b9a39f9..0414d66 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "CommonSolve" uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" authors = ["Chris Rackauckas "] -version = "0.2.3" +version = "0.2.4" [compat] julia = "1.6" diff --git a/src/CommonSolve.jl b/src/CommonSolve.jl index 67c956a..d2044bd 100644 --- a/src/CommonSolve.jl +++ b/src/CommonSolve.jl @@ -58,4 +58,15 @@ The `iter` type will be different for the different problem types. """ function init end +""" +```julia +step!(iter, ...) +``` + +Progress the iterator object (the one returned by `CommonSolve.init`). +The additional arguments typically describe how much to progress +the iterator for, and are implementation-specific. +""" +function step! end + end # module From 1178d10d2e80f22abd7e3207ef46cae98e63f013 Mon Sep 17 00:00:00 2001 From: Datseris Date: Mon, 5 Jun 2023 09:17:17 +0100 Subject: [PATCH 2/5] add `step!` to docs --- docs/src/index.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index 43b94b2..b520122 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,8 +1,8 @@ # CommonSolve.jl: The Common Solve Definition and Interface -This holds the common `solve`, `init`, and `solve!` commands. By using the same definition, +This holds the common `solve`, `init`, `solve!`, and `step!` 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 +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 @@ -21,9 +21,9 @@ solve!(::SolverType) :: SolutionType ``` where `ProblemType`, `SolverType`, and `SolutionType` are the types defined in -your package. +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. -To avoid method ambiguity, the first argument of `solve`, `solve!`, and `init` +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 @@ -37,6 +37,7 @@ init(::AbstractVector, ::AlgorithmType) CommonSolve.init CommonSolve.solve CommonSolve.solve! +CommonSolve.step! ``` ## Contributing @@ -83,7 +84,7 @@ Pkg.status(;mode = PKGMODE_MANIFEST) # hide ``` ```@raw html -You can also download the +You can also download the Date: Thu, 8 Jun 2023 00:52:34 +0200 Subject: [PATCH 4/5] Update docs/src/index.md --- docs/src/index.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index b520122..d4cbecd 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -21,7 +21,13 @@ 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. +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: + + +```julia +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 From 017f43c8404b3aaf3ff4b55a6e48b023e5a59b60 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 8 Jun 2023 00:53:01 +0200 Subject: [PATCH 5/5] Update index.md --- docs/src/index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index d4cbecd..bac0e81 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -28,6 +28,7 @@ In many cases, the `SolverType` is an object that is iteratively progressed to a ```julia 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 @@ -111,4 +112,4 @@ link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/P ``` ```@raw html ">project file. -``` \ No newline at end of file +```