Skip to content

Commit

Permalink
Initialize gradient in HessianResult to avoid undef errors when
Browse files Browse the repository at this point in the history
using BigFloats in Hessian computations

Fixes #8
  • Loading branch information
andreasnoack committed Mar 25, 2019
1 parent 8d12336 commit e4ed5ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DiffResults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Note that `HessianResult` allocates its own storage; `x` is only used for type a
shape information. If you want to allocate storage yourself, use the `DiffResult`
constructor instead.
"""
HessianResult(x::AbstractArray) = DiffResult(first(x), similar(x), similar(x, length(x), length(x)))
HessianResult(x::AbstractArray) = DiffResult(first(x), zeros(length(x)), similar(x, length(x), length(x)))
HessianResult(x::StaticArray) = DiffResult(first(x), x, zeros(StaticArrays.similar_type(typeof(x), Size(length(x),length(x)))))

#############
Expand Down

0 comments on commit e4ed5ab

Please sign in to comment.