-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
132 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ jobs: | |
group: | ||
- Core | ||
- Downstream | ||
- Misc | ||
- Wrappers | ||
version: | ||
- "1" | ||
os: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,48 @@ | ||
using ModelingToolkit, NonlinearSolve | ||
using ModelingToolkit: t_nounits as t | ||
|
||
@parameters p d | ||
@variables X(t) | ||
eqs = [0 ~ sin(X + p) - d * sqrt(X + 1)] | ||
@mtkbuild nlsys = NonlinearSystem(eqs, [X], [p, d]) | ||
|
||
# Creates an integrator. | ||
nlprob = NonlinearProblem(nlsys, [X => 1.0], [p => 2.0, d => 3.0]) | ||
|
||
@testset "GeneralizedFirstOrderAlgorithmCache" begin | ||
nint = init(nlprob, NewtonRaphson()) | ||
@test nint isa NonlinearSolve.GeneralizedFirstOrderAlgorithmCache | ||
|
||
@test nint[X] == 1.0 | ||
@test nint[nlsys.X] == 1.0 | ||
@test nint[:X] == 1.0 | ||
@test nint.ps[p] == 2.0 | ||
@test nint.ps[nlsys.p] == 2.0 | ||
@test nint.ps[:p] == 2.0 | ||
end | ||
|
||
@testset "NonlinearSolvePolyAlgorithmCache" begin | ||
nint = init(nlprob, FastShortcutNonlinearPolyalg()) | ||
@test nint isa NonlinearSolve.NonlinearSolvePolyAlgorithmCache | ||
|
||
@test nint[X] == 1.0 | ||
@test nint[nlsys.X] == 1.0 | ||
@test nint[:X] == 1.0 | ||
@test nint.ps[p] == 2.0 | ||
@test nint.ps[nlsys.p] == 2.0 | ||
@test nint.ps[:p] == 2.0 | ||
end | ||
|
||
@testset "NonlinearSolveNoInitCache" begin | ||
nint = init(nlprob, SimpleNewtonRaphson()) | ||
@test nint isa NonlinearSolve.NonlinearSolveNoInitCache | ||
|
||
@test nint[X] == 1.0 | ||
@test nint[nlsys.X] == 1.0 | ||
@test nint[:X] == 1.0 | ||
@test nint.ps[p] == 2.0 | ||
@test nint.ps[nlsys.p] == 2.0 | ||
@test nint.ps[:p] == 2.0 | ||
@testitem "Modeling Toolkit Cache Indexing" tags=[:downstream] begin | ||
using ModelingToolkit | ||
using ModelingToolkit: t_nounits as t | ||
|
||
@parameters p d | ||
@variables X(t) | ||
eqs = [0 ~ sin(X + p) - d * sqrt(X + 1)] | ||
@mtkbuild nlsys = NonlinearSystem(eqs, [X], [p, d]) | ||
|
||
# Creates an integrator. | ||
nlprob = NonlinearProblem(nlsys, [X => 1.0], [p => 2.0, d => 3.0]) | ||
|
||
@testset "GeneralizedFirstOrderAlgorithmCache" begin | ||
nint = init(nlprob, NewtonRaphson()) | ||
@test nint isa NonlinearSolve.GeneralizedFirstOrderAlgorithmCache | ||
|
||
@test nint[X] == 1.0 | ||
@test nint[nlsys.X] == 1.0 | ||
@test nint[:X] == 1.0 | ||
@test nint.ps[p] == 2.0 | ||
@test nint.ps[nlsys.p] == 2.0 | ||
@test nint.ps[:p] == 2.0 | ||
end | ||
|
||
@testset "NonlinearSolvePolyAlgorithmCache" begin | ||
nint = init(nlprob, FastShortcutNonlinearPolyalg()) | ||
@test nint isa NonlinearSolve.NonlinearSolvePolyAlgorithmCache | ||
|
||
@test nint[X] == 1.0 | ||
@test nint[nlsys.X] == 1.0 | ||
@test nint[:X] == 1.0 | ||
@test nint.ps[p] == 2.0 | ||
@test nint.ps[nlsys.p] == 2.0 | ||
@test nint.ps[:p] == 2.0 | ||
end | ||
|
||
@testset "NonlinearSolveNoInitCache" begin | ||
nint = init(nlprob, SimpleNewtonRaphson()) | ||
@test nint isa NonlinearSolve.NonlinearSolveNoInitCache | ||
|
||
@test nint[X] == 1.0 | ||
@test nint[nlsys.X] == 1.0 | ||
@test nint[:X] == 1.0 | ||
@test nint.ps[p] == 2.0 | ||
@test nint.ps[nlsys.p] == 2.0 | ||
@test nint.ps[:p] == 2.0 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.