Skip to content

Commit 9a623d1

Browse files
Redundant functions removed from OptimizationODE.jl
Code changes based on review.
1 parent ad2f53f commit 9a623d1

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

lib/OptimizationODE/src/OptimizationODE.jl

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -93,45 +93,6 @@ function setup_progress_callback(cache, solve_kwargs)
9393
return solve_kwargs
9494
end
9595

96-
function finite_difference_jacobian(f, x; ϵ = 1e-8)
97-
n = length(x)
98-
fx = f(x)
99-
if fx === nothing
100-
return zeros(eltype(x), 0, n)
101-
elseif isa(fx, Number)
102-
J = zeros(eltype(fx), 1, n)
103-
for j in 1:n
104-
xj = copy(x)
105-
xj[j] += ϵ
106-
diff = f(xj)
107-
if diff === nothing
108-
diffval = zero(eltype(fx))
109-
else
110-
diffval = diff - fx
111-
end
112-
J[1, j] = diffval / ϵ
113-
end
114-
return J
115-
else
116-
m = length(fx)
117-
J = zeros(eltype(fx), m, n)
118-
for j in 1:n
119-
xj = copy(x)
120-
xj[j] += ϵ
121-
fxj = f(xj)
122-
if fxj === nothing
123-
@inbounds for i in 1:m
124-
J[i, j] = -fx[i] / ϵ
125-
end
126-
else
127-
@inbounds for i in 1:m
128-
J[i, j] = (fxj[i] - fx[i]) / ϵ
129-
end
130-
end
131-
end
132-
return J
133-
end
134-
end
13596

13697
function SciMLBase.__solve(
13798
cache::OptimizationCache{F,RC,LB,UB,LC,UC,S,O,D,P,C}
@@ -331,4 +292,4 @@ function solve_dae_indexing(cache, dt, maxit, u0, p, differential_vars)
331292
end
332293

333294

334-
end
295+
end

0 commit comments

Comments
 (0)