Skip to content

Commit

Permalink
Fix non-vector input Jacobian creation (#128)
Browse files Browse the repository at this point in the history
* Fix non-vector input Jacobian creation

* Update abstract.jl

Co-authored-by: Patrick Kofod Mogensen <[email protected]>
  • Loading branch information
ChrisRackauckas and pkofod authored Aug 11, 2020
1 parent 254716e commit c74f45c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/objective_types/abstract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ function make_fdf(x, F::Number, f, g!)
end

# Initialize an n-by-n Jacobian
function alloc_DF(x, F)
a = (Base.OneTo(length(F)), Base.OneTo(length(x)))
df = similar(F, a)
fill!(df, NaN)
return df
end
alloc_DF(x, F) = eltype(x)(NaN) .* vec(F) .* vec(x)'

# Initialize a gradient shaped like x
alloc_DF(x, F::T) where T<:Number = x_of_nans(x, promote_type(eltype(x), T))
# Initialize an n-by-n Hessian
Expand Down

0 comments on commit c74f45c

Please sign in to comment.