diff --git a/REQUIRE b/REQUIRE index b8a5d67..a9ddc7e 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,2 +1,2 @@ julia 0.4 -Compat 0.4.0 +Compat 0.9.1 diff --git a/src/check_derivative.jl b/src/check_derivative.jl index a3a47ed..e837655 100644 --- a/src/check_derivative.jl +++ b/src/check_derivative.jl @@ -1,19 +1,19 @@ -function check_derivative(f::Function, g::Function, x::Number) - auto_g = derivative(f) - return maximum(abs(g(x) - auto_g(x))) -end - -function check_gradient{T <: Number}(f::Function, g::Function, x::Vector{T}) - auto_g = gradient(f) - return maximum(abs(g(x) - auto_g(x))) -end - -function check_second_derivative(f::Function, h::Function, x::Number) - auto_h = second_derivative(f) - return maximum(abs(h(x) - auto_h(x))) -end - -function check_hessian{T <: Number}(f::Function, h::Function, x::Vector{T}) - auto_h = hessian(f) - return maximum(abs(h(x) - auto_h(x))) -end +Compat.@compat function check_derivative(f::Function, g::Function, x::Number) + auto_g = derivative(f) + return maximum(abs.(g(x) - auto_g(x))) +end + +Compat.@compat function check_gradient{T <: Number}(f::Function, g::Function, x::Vector{T}) + auto_g = gradient(f) + return maximum(abs.(g(x) - auto_g(x))) +end + +Compat.@compat function check_second_derivative(f::Function, h::Function, x::Number) + auto_h = second_derivative(f) + return maximum(abs.(h(x) - auto_h(x))) +end + +Compat.@compat function check_hessian{T <: Number}(f::Function, h::Function, x::Vector{T}) + auto_h = hessian(f) + return maximum(abs.(h(x) - auto_h(x))) +end