Skip to content

Commit e4ed5ab

Browse files
committed
Initialize gradient in HessianResult to avoid undef errors when
using BigFloats in Hessian computations Fixes #8
1 parent 8d12336 commit e4ed5ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DiffResults.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Note that `HessianResult` allocates its own storage; `x` is only used for type a
104104
shape information. If you want to allocate storage yourself, use the `DiffResult`
105105
constructor instead.
106106
"""
107-
HessianResult(x::AbstractArray) = DiffResult(first(x), similar(x), similar(x, length(x), length(x)))
107+
HessianResult(x::AbstractArray) = DiffResult(first(x), zeros(length(x)), similar(x, length(x), length(x)))
108108
HessianResult(x::StaticArray) = DiffResult(first(x), x, zeros(StaticArrays.similar_type(typeof(x), Size(length(x),length(x)))))
109109

110110
#############

0 commit comments

Comments
 (0)