-
-
Couldn't load subscription status.
- Fork 56
Explicit imports #646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicit imports #646
Changes from 14 commits
030f775
23f5a67
19713c4
1be70fb
9794b52
6e65c17
db33ec9
1e0c7d5
246f0b1
b7e8bbe
af7064f
c2b697a
c0cb859
6979276
529aea8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,25 @@ | ||||||
| # SciPy | ||||||
|
|
||||||
| This is an extension for importing solvers from | ||||||
| [SciPy](https://scipy.org/) into the SciML | ||||||
| interface. Note that these solvers do not come by default, and thus one needs to install | ||||||
| the package before using these solvers: | ||||||
|
|
||||||
| ```julia | ||||||
| import Pkg | ||||||
| Pkg.add("NonlinearSolveSciPy") | ||||||
| import NonlinearSolveSciPy as NLSP | ||||||
| ``` | ||||||
|
|
||||||
| Note that using this package requires Python and SciPy to be available via PythonCall.jl. | ||||||
|
|
||||||
| ## Solver API | ||||||
|
|
||||||
| ```@docs | ||||||
| NonlinearSolveSciPy.SciPyLeastSquares | ||||||
| NonlinearSolveSciPy.SciPyLeastSquaresTRF | ||||||
| NonlinearSolveSciPy.SciPyLeastSquaresDogbox | ||||||
| NonlinearSolveSciPy.SciPyLeastSquaresLM | ||||||
| NonlinearSolveSciPy.SciPyRoot | ||||||
| NonlinearSolveSciPy.SciPyRootScalar | ||||||
| ``` | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,7 +27,7 @@ Note that you will have to restart Julia to disable the timer outputs once enabl | |||||||
| ## Example Usage | ||||||||
|
|
||||||||
| ```@example diagnostics_example | ||||||||
| using NonlinearSolve | ||||||||
| import NonlinearSolve as NLS | ||||||||
|
|
||||||||
| function nlfunc(resid, u0, p) | ||||||||
| resid[1] = u0[1] * u0[1] - p | ||||||||
|
|
@@ -36,23 +36,23 @@ function nlfunc(resid, u0, p) | |||||||
| nothing | ||||||||
| end | ||||||||
|
|
||||||||
| prob = NonlinearProblem(nlfunc, [1.0, 3.0, 5.0], 2.0) | ||||||||
| prob = NLS.NonlinearProblem(nlfunc, [1.0, 3.0, 5.0], 2.0) | ||||||||
|
|
||||||||
| solve(prob) | ||||||||
| NLS.solve(prob) | ||||||||
| ``` | ||||||||
|
|
||||||||
| This produced the output, but it is hard to diagnose what is going on. We can turn on | ||||||||
| the trace to see what is happening: | ||||||||
|
|
||||||||
| ```@example diagnostics_example | ||||||||
| solve(prob; show_trace = Val(true), trace_level = TraceAll(10)) | ||||||||
| NLS.solve(prob; show_trace = Val(true), trace_level = NLS.TraceAll(10)) | ||||||||
| nothing; # hide | ||||||||
| ``` | ||||||||
|
|
||||||||
| You can also store the trace in the solution object: | ||||||||
|
|
||||||||
| ```@example diagnostics_example | ||||||||
| sol = solve(prob; trace_level = TraceAll(), store_trace = Val(true)); | ||||||||
| sol = NLS.solve(prob; trace_level = NLS.TraceAll(), store_trace = Val(true)); | ||||||||
|
|
||||||||
| sol.trace | ||||||||
| ``` | ||||||||
|
|
@@ -62,16 +62,16 @@ to use the `init` and `solve!` API for this. The `TimerOutput` will be present i | |||||||
| `cache.timer`. However, note that for poly-algorithms this is currently not implemented. | ||||||||
|
|
||||||||
| ```@example diagnostics_example | ||||||||
| cache = init(prob, NewtonRaphson(); show_trace = Val(true)); | ||||||||
| solve!(cache) | ||||||||
| cache = NLS.init(prob, NLS.NewtonRaphson(); show_trace = Val(true)); | ||||||||
| NLS.solve!(cache) | ||||||||
| cache.timer | ||||||||
| ``` | ||||||||
|
|
||||||||
| Let's try for some other solver: | ||||||||
|
|
||||||||
| ```@example diagnostics_example | ||||||||
| cache = init(prob, DFSane(); show_trace = Val(true), trace_level = TraceMinimal(50)); | ||||||||
| solve!(cache) | ||||||||
| cache = NLS.init(prob, NLS.DFSane(); show_trace = Val(true), trace_level = NLS.TraceMinimal(50)); | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
| NLS.solve!(cache) | ||||||||
| cache.timer | ||||||||
| ``` | ||||||||
|
|
||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.