@@ -62,9 +62,12 @@ function DiffEqBase.__solve(
6262
6363 eval_string (" options = odeset('RelTol',reltol,'AbsTol',abstol);" )
6464 algstr = string (typeof (alg). name. name)
65- # algstr = replace(string(typeof(alg)),"MATLABDiffEq.","")
66- eval_string (" [t,u] = $(algstr) (diffeqf,tspan,u0,options);" )
65+ eval_string (" mxsol = $(algstr) (diffeqf,tspan,u0,options);" )
66+ eval_string (" mxsolstats = struct(mxsol.stats);" )
67+ solstats = get_variable (:mxsolstats )
68+ eval_string (" t = mxsol.x;" )
6769 ts = jvector (get_mvariable (:t ))
70+ eval_string (" u = mxsol.y';" )
6871 timeseries_tmp = jarray (get_mvariable (:u ))
6972
7073 # Reshape the result if needed
@@ -77,8 +80,22 @@ function DiffEqBase.__solve(
7780 timeseries = timeseries_tmp
7881 end
7982
83+ destats = buildDEStats (solstats)
84+
8085 DiffEqBase. build_solution (prob,alg,ts,timeseries,
81- timeseries_errors = timeseries_errors)
86+ timeseries_errors = timeseries_errors,destats = destats)
87+ end
88+
89+ function buildDEStats (solverstats:: Dict )
90+
91+ destats = DiffEqBase. DEStats (0 )
92+ destats. nf = if (haskey (solverstats, " nfevals" )) solverstats[" nfevals" ] else 0 end
93+ destats. nreject = if (haskey (solverstats, " nfailed" )) solverstats[" nfailed" ] else 0 end
94+ destats. naccept = if (haskey (solverstats, " nsteps" )) solverstats[" nsteps" ] else 0 end
95+ destats. nsolve = if (haskey (solverstats, " nsolves" )) solverstats[" nsolves" ] else 0 end
96+ destats. njacs = if (haskey (solverstats, " npds" )) solverstats[" npds" ] else 0 end
97+ destats. nw = if (haskey (solverstats, " ndecomps" )) solverstats[" ndecomps" ] else 0 end
98+ destats
8299end
83100
84101end # module
0 commit comments