77
88function HessianCache (xpp,xpm,xmp,xmm,
99 fdtype= Val (:hcentral ),
10- inplace = x isa StaticArray ? Val{ false } : Val{ true } )
10+ inplace = x isa StaticArray ? Val ( false ) : Val ( true ) )
1111 fdtype isa Type && (fdtype = fdtype ())
12+ inplace isa Type && (inplace = inplace ())
1213 HessianCache {typeof(xpp),fdtype,inplace} (xpp,xpm,xmp,xmm)
1314end
1415
1516function HessianCache (x, fdtype= Val (:hcentral ),
16- inplace = x isa StaticArray ? Val{ false } : Val{ true } )
17+ inplace = x isa StaticArray ? Val ( false ) : Val ( true ) )
1718 cx = copy (x)
1819 fdtype isa Type && (fdtype = fdtype ())
20+ inplace isa Type && (inplace = inplace ())
1921 HessianCache {typeof(cx),fdtype,inplace} (cx, copy (x), copy (x), copy (x))
2022end
2123
2224function finite_difference_hessian (f, x,
2325 fdtype = Val (:hcentral ),
24- inplace = x isa StaticArray ? Val{ false } : Val{ true } ;
26+ inplace = x isa StaticArray ? Val ( false ) : Val ( true ) ;
2527 relstep = default_relstep (fdtype, eltype (x)),
2628 absstep = relstep)
2729
4345function finite_difference_hessian! (H,f,
4446 x,
4547 fdtype = Val (:hcentral ),
46- inplace = x isa StaticArray ? Val{ false } : Val{ true } ;
48+ inplace = x isa StaticArray ? Val ( false ) : Val ( true ) ;
4749 relstep= default_relstep (fdtype, eltype (x)),
4850 absstep= relstep)
4951
@@ -61,15 +63,15 @@ function finite_difference_hessian!(H,f,x,
6163 xpp, xpm, xmp, xmm = cache. xpp, cache. xpm, cache. xmp, cache. xmm
6264 fx = f (x)
6365
64- if inplace === Val{ true }
66+ if inplace === Val ( true )
6567 _xpp, _xpm, _xmp, _xmm = xpp, xpm, xmp, xmm
6668 end
6769
6870 for i = 1 : n
6971 xi = ArrayInterface. allowed_getindex (x,i)
7072 epsilon = compute_epsilon (Val (:hcentral ), xi, relstep, absstep)
7173
72- if inplace === Val{ true }
74+ if inplace === Val ( true )
7375 ArrayInterface. allowed_setindex! (xpp,xi + epsilon,i)
7476 ArrayInterface. allowed_setindex! (xmm,xi - epsilon,i)
7577 else
@@ -82,7 +84,7 @@ function finite_difference_hessian!(H,f,x,
8284 xp = xi + epsiloni
8385 xm = xi - epsiloni
8486
85- if inplace === Val{ true }
87+ if inplace === Val ( true )
8688 ArrayInterface. allowed_setindex! (xpp,xp,i)
8789 ArrayInterface. allowed_setindex! (xpm,xp,i)
8890 ArrayInterface. allowed_setindex! (xmp,xm,i)
@@ -100,7 +102,7 @@ function finite_difference_hessian!(H,f,x,
100102 xp = xj + epsilonj
101103 xm = xj - epsilonj
102104
103- if inplace === Val{ true }
105+ if inplace === Val ( true )
104106 ArrayInterface. allowed_setindex! (xpp,xp,j)
105107 ArrayInterface. allowed_setindex! (xpm,xm,j)
106108 ArrayInterface. allowed_setindex! (xmp,xp,j)
@@ -114,7 +116,7 @@ function finite_difference_hessian!(H,f,x,
114116
115117 ArrayInterface. allowed_setindex! (H,(f (_xpp) - f (_xpm) - f (_xmp) + f (_xmm))/ (4 * epsiloni* epsilonj),i,j)
116118
117- if inplace === Val{ true }
119+ if inplace === Val ( true )
118120 ArrayInterface. allowed_setindex! (xpp,xj,j)
119121 ArrayInterface. allowed_setindex! (xpm,xj,j)
120122 ArrayInterface. allowed_setindex! (xmp,xj,j)
@@ -127,7 +129,7 @@ function finite_difference_hessian!(H,f,x,
127129 end
128130 end
129131
130- if inplace === Val{ true }
132+ if inplace === Val ( true )
131133 ArrayInterface. allowed_setindex! (xpp,xi,i)
132134 ArrayInterface. allowed_setindex! (xpm,xi,i)
133135 ArrayInterface. allowed_setindex! (xmp,xi,i)
0 commit comments