Skip to content

Commit 8e1bb23

Browse files
Merge pull request #22 from Datseris/step
Add `step!` to CommonSolve.jl
2 parents af4d9f1 + 017f43c commit 8e1bb23

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CommonSolve"
22
uuid = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "0.2.3"
4+
version = "0.2.4"
55

66
[compat]
77
julia = "1.6"

docs/src/index.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# CommonSolve.jl: The Common Solve Definition and Interface
22

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

88
## General recommendation
@@ -21,9 +21,16 @@ solve!(::SolverType) :: SolutionType
2121
```
2222

2323
where `ProblemType`, `SolverType`, and `SolutionType` are the types defined in
24-
your package.
24+
your package.
2525

26-
To avoid method ambiguity, the first argument of `solve`, `solve!`, and `init`
26+
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:
27+
28+
29+
```julia
30+
step!(::SolverType, args...; kwargs...)
31+
```
32+
33+
To avoid method ambiguity, the first argument of `solve`, `solve!`, `step!`, and `init`
2734
_must_ be dispatched on the type defined in your package. For example, do
2835
_not_ define a method such as
2936

@@ -37,6 +44,7 @@ init(::AbstractVector, ::AlgorithmType)
3744
CommonSolve.init
3845
CommonSolve.solve
3946
CommonSolve.solve!
47+
CommonSolve.step!
4048
```
4149

4250
## Contributing
@@ -83,7 +91,7 @@ Pkg.status(;mode = PKGMODE_MANIFEST) # hide
8391
</details>
8492
```
8593
```@raw html
86-
You can also download the
94+
You can also download the
8795
<a href="
8896
```
8997
```@eval
@@ -104,4 +112,4 @@ link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/P
104112
```
105113
```@raw html
106114
">project</a> file.
107-
```
115+
```

src/CommonSolve.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,15 @@ The `iter` type will be different for the different problem types.
5858
"""
5959
function init end
6060

61+
"""
62+
```julia
63+
CommonSolve.step!(iter, args...; kwargs...)
64+
```
65+
66+
Progress the iterator object (the one returned by `CommonSolve.init`).
67+
The additional arguments typically describe how much to progress
68+
the iterator for, and are implementation-specific.
69+
"""
70+
function step! end
71+
6172
end # module

0 commit comments

Comments
 (0)