@@ -20,7 +20,7 @@ using OrdinaryDiffEqSDIRK
20
20
tspan = (0. , 0.5 )
21
21
22
22
idprob = ImplicitDiscreteProblem (f!, u0, tspan, []; dt = 0.01 )
23
- idsol = solve (idprob, SimpleIDSolve ())
23
+ idsol = solve (idprob, IDSolve ())
24
24
25
25
oprob = ODEProblem (lotkavolterra, u0, tspan)
26
26
osol = solve (oprob, ImplicitEuler ())
@@ -43,7 +43,7 @@ using OrdinaryDiffEqSDIRK
43
43
tspan = (0 , 0.2 )
44
44
45
45
idprob = ImplicitDiscreteProblem (g!, u0, tspan, []; dt = 0.01 )
46
- idsol = solve (idprob, SimpleIDSolve ())
46
+ idsol = solve (idprob, IDSolve ())
47
47
48
48
oprob = ODEProblem (ff, u0, tspan)
49
49
osol = solve (oprob, ImplicitEuler ())
60
60
tsteps = 15
61
61
u0 = [1. , 3. ]
62
62
idprob = ImplicitDiscreteProblem (periodic!, u0, (0 , tsteps), [])
63
- integ = init (idprob, SimpleIDSolve ())
63
+ integ = init (idprob, IDSolve ())
64
64
@test integ. u[1 ]^ 2 + integ. u[2 ]^ 2 ≈ 16
65
65
66
66
for ts in 1 : tsteps
77
77
tsteps = 5
78
78
u0 = nothing
79
79
idprob = ImplicitDiscreteProblem (empty, u0, (0 , tsteps), [])
80
- @test_nowarn integ = init (idprob, SimpleIDSolve ())
80
+ @test_nowarn integ = init (idprob, IDSolve ())
81
+ end
82
+
83
+ @testset " Create NonlinearLeastSquaresProblem" begin
84
+ function over (u_next, u, p, t)
85
+ [u_next[1 ] - 1 , u_next[2 ] - 1 , u_next[1 ] - u_next[2 ]]
86
+ end
87
+
88
+ tsteps = 5
89
+ u0 = [1. , 1. ]
90
+ idprob = ImplicitDiscreteProblem (ImplicitDiscreteFunction (over, resid_prototype = zeros (3 )), u0, (0 , tsteps), [])
91
+ integ = init (idprob, IDSolve ())
92
+ @test integ. cache. prob isa NonlinearLeastSquaresProblem
93
+
94
+ function under (u_next, u, p, t)
95
+ [u_next[1 ] - u_next[2 ] - 1 ]
96
+ end
97
+ idprob = ImplicitDiscreteProblem (ImplicitDiscreteFunction (under; resid_prototype = zeros (1 )), u0, (0 , tsteps), [])
98
+ integ = init (idprob, IDSolve ())
99
+ @test integ. cache. prob isa NonlinearLeastSquaresProblem
100
+
101
+ function full (u_next, u, p, t)
102
+ [u_next[1 ]^ 2 - 3 , u_next[2 ] - u[1 ]]
103
+ end
104
+ idprob = ImplicitDiscreteProblem (ImplicitDiscreteFunction (full; resid_prototype = zeros (2 )), u0, (0 , tsteps), [])
105
+ integ = init (idprob, IDSolve ())
106
+ @test integ. cache. prob isa NonlinearProblem
81
107
end
0 commit comments