@@ -7,13 +7,13 @@ function derivative(f, ftype::Symbol, dtype::Symbol)
77 error (" ftype must :scalar or :vector" )
88 end
99end
10- Compat . @compat derivative {T <: Number} (f, x:: Union{T, Vector{T}} , dtype:: Symbol = :central ) = finite_difference (f, float (x), dtype)
10+ derivative (f, x:: Union{T, Vector{T}} , dtype:: Symbol = :central ) where {T <: Number } = finite_difference (f, float (x), dtype)
1111derivative (f, dtype:: Symbol = :central ) = derivative (f, :scalar , dtype)
1212
13- Compat . @compat gradient {T <: Number} (f, x:: Union{T, Vector{T}} , dtype:: Symbol = :central ) = finite_difference (f, float (x), dtype)
13+ gradient (f, x:: Union{T, Vector{T}} , dtype:: Symbol = :central ) where {T <: Number } = finite_difference (f, float (x), dtype)
1414gradient (f, dtype:: Symbol = :central ) = derivative (f, :vector , dtype)
1515
16- Compat . @compat function Base. gradient {T <: Number} (f, x:: Union{T, Vector{T}} , dtype:: Symbol = :central )
16+ function Base. gradient (f, x:: Union{T, Vector{T}} , dtype:: Symbol = :central ) where T <: Number
1717 Base. warn_once (" The finite difference methods from Calculus.jl no longer extend Base.gradient and should be called as Calculus.gradient instead. This usage is deprecated." )
1818 Calculus. gradient (f,x,dtype)
1919end
2929 Base. ctranspose (f:: Function ) = derivative (f)
3030end
3131
32- function jacobian {T <: Number} (f, x:: Vector{T} , dtype:: Symbol )
32+ function jacobian (f, x:: Vector{T} , dtype:: Symbol ) where T <: Number
3333 finite_difference_jacobian (f, x, dtype)
3434end
3535function jacobian (f, dtype:: Symbol )
@@ -47,16 +47,16 @@ function second_derivative(f, g, ftype::Symbol, dtype::Symbol)
4747 error (" ftype must :scalar or :vector" )
4848 end
4949end
50- Compat . @compat function second_derivative {T <: Number} (f, g, x:: Union{T, Vector{T}} , dtype:: Symbol )
50+ function second_derivative (f, g, x:: Union{T, Vector{T}} , dtype:: Symbol ) where T <: Number
5151 finite_difference_hessian (f, g, x, dtype)
5252end
53- Compat . @compat function hessian {T <: Number} (f, g, x:: Union{T, Vector{T}} , dtype:: Symbol )
53+ function hessian (f, g, x:: Union{T, Vector{T}} , dtype:: Symbol ) where T <: Number
5454 finite_difference_hessian (f, g, x, dtype)
5555end
56- Compat . @compat function second_derivative {T <: Number} (f, g, x:: Union{T, Vector{T}} )
56+ function second_derivative (f, g, x:: Union{T, Vector{T}} ) where T <: Number
5757 finite_difference_hessian (f, g, x, :central )
5858end
59- Compat . @compat function hessian {T <: Number} (f, g, x:: Union{T, Vector{T}} )
59+ function hessian (f, g, x:: Union{T, Vector{T}} ) where T <: Number
6060 finite_difference_hessian (f, g, x, :central )
6161end
6262function second_derivative (f, x:: Number , dtype:: Symbol )
6565function hessian (f, x:: Number , dtype:: Symbol )
6666 finite_difference_hessian (f, derivative (f), x, dtype)
6767end
68- function second_derivative {T <: Number} (f, x:: Vector{T} , dtype:: Symbol )
68+ function second_derivative (f, x:: Vector{T} , dtype:: Symbol ) where T <: Number
6969 finite_difference_hessian (f, gradient (f), x, dtype)
7070end
71- function hessian {T <: Number} (f, x:: Vector{T} , dtype:: Symbol )
71+ function hessian (f, x:: Vector{T} , dtype:: Symbol ) where T <: Number
7272 finite_difference_hessian (f, gradient (f), x, dtype)
7373end
7474function second_derivative (f, x:: Number )
7777function hessian (f, x:: Number )
7878 finite_difference_hessian (f, derivative (f), x, :central )
7979end
80- function second_derivative {T <: Number} (f, x:: Vector{T} )
80+ function second_derivative (f, x:: Vector{T} ) where T <: Number
8181 finite_difference_hessian (f, gradient (f), x, :central )
8282end
83- function hessian {T <: Number} (f, x:: Vector{T} )
83+ function hessian (f, x:: Vector{T} ) where T <: Number
8484 finite_difference_hessian (f, gradient (f), x, :central )
8585end
8686second_derivative (f, g, dtype:: Symbol ) = second_derivative (f, g, :scalar , dtype)
0 commit comments