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

Fixdeps 0.7 #40

Merged
merged 7 commits into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
BinDeps
julia 0.4
Compat 0.8
julia 0.7-
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be julia 0.7 (no hyphen), in order to only accept released versions.

48 changes: 24 additions & 24 deletions src/Cubature.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION >= v"0.4.0-dev+6521" && __precompile__()
__precompile__()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this line since precompile is the default in 0.7.


"""
Julia wrappers around adaptive multidimensional integration routines
Expand All @@ -11,10 +11,10 @@ simple interfaces to the more basic functionality (1d and >1d
integrals of scalar functions).
"""
module Cubature
using Compat


export hcubature, pcubature, hcubature_v, pcubature_v,
hquadrature, pquadrature, hquadrature_v, pquadrature_v
hquadrature, pquadrature, hquadrature_v, pquadrature_v

const libcubature = joinpath(dirname(@__FILE__), "..", "deps", "libcubature")

Expand All @@ -29,14 +29,14 @@ const SUCCESS = convert(Int32, 0)
const FAILURE = convert(Int32, 1)

# type to distinguish cubature error codes from thrown exceptions
type NoError <: Exception end # used for integrand_error when nothing thrown
struct NoError <: Exception end # used for integrand_error when nothing thrown

@compat type IntegrandData{F}
struct IntegrandData{F}
integrand_func::F
integrand_error::Any
(::Type{IntegrandData{F}}){F}(f) = new{F}(f, NoError())
(::Type{IntegrandData{F}})(f) where F = new{F}(f, NoError())
end
IntegrandData{F}(f::F) = IntegrandData{F}(f)
IntegrandData(f::F) where F = IntegrandData{F}(f)

# C cubature code is not interrupt-safe (would leak memory), so
# use sigatomic_begin/end to defer ctrl-c handling until Julia code
Expand Down Expand Up @@ -109,13 +109,13 @@ for fscalar in (false, true) # whether the integrand is a scalar
end
end

@inline function cf{D}(f, d::D, v)
@inline function cf(f, d::D, v) where D
if v
cfunction(f, Int32,
(UInt32, UInt, Ptr{Float64}, Ref{D}, UInt32, Ptr{Float64}))
@cfunction($f, Int32,
(UInt32, UInt, Ptr{Float64}, Ref{D}, UInt32, Ptr{Float64}))
else
cfunction(f, Int32,
(UInt32, Ptr{Float64}, Ref{D}, UInt32, Ptr{Float64}))
@cfunction($f, Int32,
(UInt32, Ptr{Float64}, Ref{D}, UInt32, Ptr{Float64}))
end
end
function integrands(d, xscalar, fscalar, vectorized)
Expand All @@ -139,12 +139,12 @@ function integrands(d, xscalar, fscalar, vectorized)
end

# low-level routine, not to be called directly by user
function cubature{F}(xscalar::Bool, fscalar::Bool,
vectorized::Bool, padaptive::Bool,
fdim::Integer, f::F, # Force specialization on F
xmin_, xmax_,
reqRelError::Real, reqAbsError::Real, maxEval::Integer,
error_norm::Integer)
function cubature(xscalar::Bool, fscalar::Bool,
vectorized::Bool, padaptive::Bool,
fdim::Integer, f::F, # Force specialization on F
xmin_, xmax_,
reqRelError::Real, reqAbsError::Real, maxEval::Integer,
error_norm::Integer) where F
dim = length(xmin_)
if xscalar && dim != 1
throw(ArgumentError("quadrature routines are for 1d only"))
Expand All @@ -160,8 +160,8 @@ function cubature{F}(xscalar::Bool, fscalar::Bool,
end
xmin = Float64[xmin_...]
xmax = Float64[xmax_...]
val = Vector{Float64}(fdim)
err = Vector{Float64}(fdim)
val = Vector{Float64}(undef, fdim)
err = Vector{Float64}(undef, fdim)
d = IntegrandData(f)
fwrap = integrands(d, xscalar, fscalar, vectorized)
# ccall's first arg needs to be a constant expression, so
Expand All @@ -171,7 +171,7 @@ function cubature{F}(xscalar::Bool, fscalar::Bool,
if padaptive
if vectorized
ret = ccall((:pcubature_v,libcubature), Int32,
(UInt32, Ptr{Void}, Any,
(UInt32, Ptr{Nothing}, Any,
UInt32, Ptr{Float64}, Ptr{Float64},
UInt, Float64, Float64, Int32,
Ptr{Float64}, Ptr{Float64}),
Expand All @@ -180,7 +180,7 @@ function cubature{F}(xscalar::Bool, fscalar::Bool,
val, err)
else
ret = ccall((:pcubature,libcubature), Int32,
(UInt32, Ptr{Void}, Any,
(UInt32, Ptr{Nothing}, Any,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be Ptr{Cvoid}.

UInt32, Ptr{Float64}, Ptr{Float64},
UInt, Float64, Float64, Int32,
Ptr{Float64}, Ptr{Float64}),
Expand All @@ -191,7 +191,7 @@ function cubature{F}(xscalar::Bool, fscalar::Bool,
else
if vectorized
ret = ccall((:hcubature_v,libcubature), Int32,
(UInt32, Ptr{Void}, Any,
(UInt32, Ptr{Nothing}, Any,
UInt32, Ptr{Float64}, Ptr{Float64},
UInt, Float64, Float64, Int32,
Ptr{Float64}, Ptr{Float64}),
Expand All @@ -200,7 +200,7 @@ function cubature{F}(xscalar::Bool, fscalar::Bool,
val, err)
else
ret = ccall((:hcubature,libcubature), Int32,
(UInt32, Ptr{Void}, Any,
(UInt32, Ptr{Nothing}, Any,
UInt32, Ptr{Float64}, Ptr{Float64},
UInt, Float64, Float64, Int32,
Ptr{Float64}, Ptr{Float64}),
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Base.Test
using Test
using Cubature
using Compat

Expand Down