Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecations #36

Merged
merged 1 commit into from
Apr 4, 2019
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 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