Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.4
Compat 0.4.0
Compat 0.9.1
38 changes: 19 additions & 19 deletions src/check_derivative.jl
Original file line number Diff line number Diff line change
@@ -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