Skip to content

Commit

Permalink
Fix deprecations (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
femtocleaner[bot] authored and stevengj committed Apr 4, 2019
1 parent dacf789 commit e35eef1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Cubature.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct NoError <: Exception end # used for integrand_error when nothing thrown
struct IntegrandData{F}
integrand_func::F
integrand_error::Any
(::Type{IntegrandData{F}})(f) where F = new{F}(f, NoError())
IntegrandData{F}(f) where F = new{F}(f, NoError())
end
IntegrandData(f::F) where F = IntegrandData{F}(f)

Expand Down
16 changes: 8 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ using Compat
@test isapprox(hquadrature(cos, 0,1, abstol=1e-8)[1], sin(1), atol=1e-8)
@test isapprox(pquadrature(cos, 0,1, abstol=1e-8)[1], sin(1), atol=1e-8)

quad_tst1(x) = @compat prod(cos.(x))
quad_tst1(x) = prod(cos.(x))
for dim = 0:3
xmin = zeros(dim)
xmax = 1:dim
ans = @compat prod(sin.(xmax))
ans = prod(sin.(xmax))
@test isapprox(hcubature(quad_tst1, xmin,xmax, abstol=1e-8)[1], ans, atol=1e-8)
@test isapprox(pcubature(quad_tst1, xmin,xmax, abstol=1e-8)[1], ans, atol=1e-8)
end

quad_tst2(x, v) = for j = 1:length(v)
v[j] = @compat prod(cos.(x)) * j
v[j] = prod(cos.(x)) * j
end
for fdim = 1:3
for dim = 0:3
xmin = zeros(dim)
xmax = 1:dim
ans = @compat prod(sin.(xmax)) * (1:fdim)
ans = prod(sin.(xmax)) * (1:fdim)
if dim == 1
@test isapprox(hquadrature(fdim, quad_tst2, xmin,xmax, abstol=1e-8)[1], ans, atol=1e-8)
@test isapprox(pquadrature(fdim, quad_tst2, xmin,xmax, abstol=1e-8)[1], ans, atol=1e-8)
Expand All @@ -41,19 +41,19 @@ end
@test isapprox(pquadrature_v(quad_tst0v, 0,1, abstol=1e-8)[1], sin(1), atol=1e-8)

quad_tst1v(x,v) = for i = 1:length(v)
v[i] = @compat prod(cos.(x[:,i]))
v[i] = prod(cos.(x[:,i]))
end
for dim = 0:3
xmin = zeros(dim)
xmax = 1:dim
ans = @compat prod(sin.(xmax))
ans = prod(sin.(xmax))
@test isapprox(hcubature_v(quad_tst1v, xmin,xmax, abstol=1e-8)[1], ans, atol=1e-8)
@test isapprox(pcubature_v(quad_tst1v, xmin,xmax, abstol=1e-8)[1], ans, atol=1e-8)
end

quad_tst2v(x::Array{Float64,2}, v) = for i = 1:size(v,2)
for j = 1:size(v,1)
v[j,i] = @compat prod(cos.(x[:,i])) * j
v[j,i] = prod(cos.(x[:,i])) * j
end
end
quad_tst2v(x::Array{Float64,1}, v) = for i = 1:size(v,2)
Expand All @@ -65,7 +65,7 @@ for fdim = 1:3
for dim = 0:3
xmin = zeros(dim)
xmax = 1:dim
ans = @compat prod(sin.(xmax)) * (1:fdim)
ans = prod(sin.(xmax)) * (1:fdim)
if dim == 1
@test isapprox(hquadrature_v(fdim, quad_tst2v, xmin,xmax, abstol=1e-8)[1], ans, atol=1e-8)
@test isapprox(pquadrature_v(fdim, quad_tst2v, xmin,xmax, abstol=1e-8)[1], ans, atol=1e-8)
Expand Down

0 comments on commit e35eef1

Please sign in to comment.