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,4 +1,4 @@
julia 0.7-beta2
julia 0.7-rc3
StaticArrays 0.5.0
DiffResults 0.0.1
DiffRules 0.0.4
Expand Down
3 changes: 0 additions & 3 deletions src/ForwardDiff.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__precompile__()

module ForwardDiff

using DiffRules, DiffResults
Expand All @@ -20,7 +18,6 @@ include("derivative.jl")
include("gradient.jl")
include("jacobian.jl")
include("hessian.jl")
include("deprecated.jl")

export DiffResults

Expand Down
39 changes: 0 additions & 39 deletions src/deprecated.jl

This file was deleted.

8 changes: 4 additions & 4 deletions src/dual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ end
@inline Base.one(d::Dual) = one(typeof(d))
@inline Base.one(::Type{Dual{T,V,N}}) where {T,V,N} = Dual{T}(one(V), zero(Partials{N,V}))

@inline Base.rand(d::Dual) = rand(typeof(d))
@inline Base.rand(::Type{Dual{T,V,N}}) where {T,V,N} = Dual{T}(rand(V), zero(Partials{N,V}))
@inline Base.rand(rng::AbstractRNG, d::Dual) = rand(rng, typeof(d))
@inline Base.rand(rng::AbstractRNG, ::Type{Dual{T,V,N}}) where {T,V,N} = Dual{T}(rand(rng, V), zero(Partials{N,V}))
@inline Random.rand(d::Dual) = rand(typeof(d))
@inline Random.rand(::Type{Dual{T,V,N}}) where {T,V,N} = Dual{T}(rand(V), zero(Partials{N,V}))
@inline Random.rand(rng::AbstractRNG, d::Dual) = rand(rng, typeof(d))
@inline Random.rand(rng::AbstractRNG, ::Type{Dual{T,V,N}}) where {T,V,N} = Dual{T}(rand(rng, V), zero(Partials{N,V}))

# Predicates #
#------------#
Expand Down
5 changes: 2 additions & 3 deletions src/partials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ end

@inline Base.@propagate_inbounds Base.getindex(partials::Partials, i::Int) = partials.values[i]

Base.start(partials::Partials) = start(partials.values)
Base.next(partials::Partials, i) = next(partials.values, i)
Base.done(partials::Partials, i) = done(partials.values, i)
Base.iterate(partials::Partials) = iterate(partials.values)
Base.iterate(partials::Partials, i) = iterate(partials.values, i)

Base.IndexStyle(::Type{<:Partials}) = IndexLinear()

Expand Down
44 changes: 0 additions & 44 deletions test/DeprecatedTest.jl

This file was deleted.

2 changes: 1 addition & 1 deletion test/DerivativeTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using DiffTests

include(joinpath(dirname(@__FILE__), "utils.jl"))

srand(1)
Random.seed!(1)

########################
# test vs. Calculus.jl #
Expand Down
4 changes: 2 additions & 2 deletions test/DualTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,12 @@ for N in (0,3), M in (0,4), V in (Int, Float32)
if isnan(actualdx)
@test isnan(partials(dx, 1))
else
@test partials(dx, 1) == actualdx
@test partials(dx, 1) actualdx
end
if isnan(actualdy)
@test isnan(partials(dy, 1))
else
@test partials(dy, 1) == actualdy
@test partials(dy, 1) actualdy
end
end
end
Expand Down
1 change: 0 additions & 1 deletion test/GradientTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,4 @@ sresult3 = ForwardDiff.gradient!(sresult3, prod, sx, scfg)
@test DiffResults.gradient(sresult2) == DiffResults.gradient(result)
@test DiffResults.gradient(sresult3) == DiffResults.gradient(result)


end # module
18 changes: 11 additions & 7 deletions test/MiscTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ a = fill(1.0, N)
jac0 = reshape(vcat([[fill(0.0, N*(i-1)); a; fill(0.0, N^2-N*i)] for i = 1:N]...), N^2, N)

for op in (:.-, :.+, :./, :.*)
f = @eval x -> [$op(x[1], a); $op(x[2], a); $op(x[3], a); $op(x[4], a)]
jac = @eval ForwardDiff.jacobian(f, a)
@test isapprox(jac0, jac)
@eval begin
f = x -> [$op(x[1], a); $op(x[2], a); $op(x[3], a); $op(x[4], a)]
jac = ForwardDiff.jacobian(f, a)
@test isapprox(jac0, jac)
end
end

# NaNs #
Expand All @@ -133,8 +135,10 @@ h = ForwardDiff.hessian(y -> sum(hypot.(x, y)), y)
@test h[1, 1] ≈ (x[1]^2) / (x[1]^2 + y[1]^2)^(3/2)
@test h[2, 2] ≈ (x[2]^2) / (x[2]^2 + y[2]^2)^(3/2)
@test h[3, 3] ≈ (x[3]^2) / (x[3]^2 + y[3]^2)^(3/2)
for i in 1:3, j in 1:3
i != j && (@test h[i, j] ≈ 0.0)
let i, j
for i in 1:3, j in 1:3
i != j && @test h[i, j] ≈ 0.0
end
end

########
Expand All @@ -144,8 +148,8 @@ end
# issue 267
@noinline f267(z, x) = x[1]
z267 = ([(1, (2), [(3, (4, 5, [1, 2, (3, (4, 5), [5])]), (5))])])
let z = z267
g = x -> f267(z, x)
let z = z267,
g = x -> f267(z, x),
h = x -> g(x)
@test ForwardDiff.hessian(h, [1.]) == fill(0.0, 1, 1)
end
Expand Down
4 changes: 0 additions & 4 deletions test/PartialsTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ for N in (0, 3), T in (Int, Float32, Float64)
@test PARTIALS[i] == VALUES[i]
end

@test start(PARTIALS) == start(VALUES)
@test N == 0 || (next(PARTIALS, start(PARTIALS)) == next(VALUES, start(VALUES)))
@test done(PARTIALS, start(PARTIALS)) == done(VALUES, start(VALUES))

i = 1
for p in PARTIALS
@test p == VALUES[i]
Expand Down
6 changes: 1 addition & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ t = @elapsed include("PartialsTest.jl")
println("done (took $t seconds).")

println("Testing Dual...")
# t = @elapsed include("DualTest.jl")
t = @elapsed include("DualTest.jl")
println("done (took $t seconds).")

println("Testing derivative functionality...")
Expand Down Expand Up @@ -37,7 +37,3 @@ if Base.JLOptions().opt_level >= 3
t = @elapsed include("SIMDTest.jl")
println("done (took $t seconds).")
end

println("Testing deprecations...")
t = @elapsed include("DeprecatedTest.jl")
println("done (took $t seconds).")
2 changes: 1 addition & 1 deletion test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using Random

# seed RNG, thus making result inaccuracies deterministic
# so we don't have to retune EPS for arbitrary inputs
srand(1)
Random.seed!(1)

const XLEN = DEFAULT_CHUNK_THRESHOLD + 1
const YLEN = div(DEFAULT_CHUNK_THRESHOLD, 2) + 1
Expand Down