Skip to content

Commit e4573e4

Browse files
authored
Solve bug in solution.jl
Proposed solution for bug in solution.jl (Fixes SciML#514). The solution handles the case where the basis of the problem is empty which would throw the DimensionMismatch error.
1 parent 08d630d commit e4573e4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/solution.jl

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ function DataDrivenSolution(b::AbstractBasis, p::AbstractDataDrivenProblem,
3434
ps = get_parameter_values(b)
3535
prob = remake_problem(p, p = ps)
3636

37-
rss = sum(abs2, get_implicit_data(prob) .- b(prob))
37+
if size(b(prob)) == size(get_implicit_data(prob))
38+
rss = sum(abs2, get_implicit_data(prob) .- b(prob))
39+
else
40+
rss = sum(abs2, get_implicit_data(prob))
41+
end
3842

3943
return DataDrivenSolution{eltype(p)}(b,
4044
retcode,

0 commit comments

Comments
 (0)