Skip to content

Commit

Permalink
Merge pull request #127 from tanmaykm/tan/fixjulia10
Browse files Browse the repository at this point in the history
fixes for Julia 1.0
  • Loading branch information
Keno committed Aug 7, 2018
2 parents 1124541 + 40d2e33 commit 4da2f9b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -5,6 +5,7 @@ os:
- osx
julia:
- 0.6
- 0.7
- nightly
notifications:
email: false
Expand Down
2 changes: 2 additions & 0 deletions src/derivative.jl
Expand Up @@ -13,6 +13,7 @@ derivative(f, dtype::Symbol = :central) = derivative(f, :scalar, dtype)
gradient(f, x::Union{T, Vector{T}}, dtype::Symbol = :central) where {T <: Number} = finite_difference(f, float(x), dtype)
gradient(f, dtype::Symbol = :central) = derivative(f, :vector, dtype)

@static if isdefined(Compat.LinearAlgebra, :gradient)
function Compat.LinearAlgebra.gradient(f, x::Union{T, Vector{T}}, dtype::Symbol = :central) where T <: Number
Base.depwarn("The finite difference methods from Calculus.jl no longer extend " *
"Base.gradient and should be called as Calculus.gradient instead. " *
Expand All @@ -26,6 +27,7 @@ function Compat.LinearAlgebra.gradient(f, dtype::Symbol = :central)
"This usage is deprecated.", :gradient)
Calculus.gradient(f,dtype)
end
end

if isdefined(Base, :adjoint)
Base.adjoint(f::Function) = derivative(f)
Expand Down
2 changes: 1 addition & 1 deletion src/symbolic.jl
Expand Up @@ -93,7 +93,7 @@ function simplify(ex::Expr)
return ex
end
if all(isnumber, ex.args[2:end]) && length(ex.args) > 1
return eval(@__MODULE__, ex)
return (@static (VERSION < v"0.7.0-DEV.5149") ? eval : Core.eval)(@__MODULE__, ex)
end
new_ex = simplify(SymbolParameter(ex.args[1]), ex.args[2:end])
while !(isequal(new_ex, ex))
Expand Down

0 comments on commit 4da2f9b

Please sign in to comment.