Skip to content

Commit

Permalink
Some more type loosening
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jun 30, 2020
1 parent d89f9fe commit 7f27799
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/gauss-kronrod.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Gauss-Kronrod quadrature rule, via the QuadGK package, since Genz-Malik
# rule does not handle the 1d case. We will just use a fixed-order (7) G-K rule.

struct GaussKronrod{T<:AbstractFloat}
struct GaussKronrod{T<:Real}
x::Vector{T}
w::Vector{T}
wg::Vector{T}
Expand All @@ -11,7 +11,7 @@ end
# call QuadGK.kronrod every time.
const gkcache = Dict{Type, GaussKronrod}()

function GaussKronrod(::Type{T}) where {T<:AbstractFloat}
function GaussKronrod(::Type{T}) where {T<:Real}
haskey(gkcache, T) && return gkcache[T]::GaussKronrod{T}
gkcache[T] = g = GaussKronrod{T}(QuadGK.kronrod(T,7)...)
return g
Expand Down
4 changes: 2 additions & 2 deletions src/genz-malik.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ end
to an `n`-dimensional Genz-Malik cubature rule over coordinates
of type `T`.
"""
struct GenzMalik{n,T<:AbstractFloat}
struct GenzMalik{n,T<:Real}
p::NTuple{4,Vector{SVector{n,T}}} # points for the last 4 G-M weights
w::NTuple{5,T} # weights for the 5 terms in the G-M rule
w′::NTuple{4,T} # weights for the embedded lower-degree rule
Expand All @@ -72,7 +72,7 @@ const gmcache = Dict{Tuple{Int,Type}, GenzMalik}()
Construct an n-dimensional Genz-Malik rule for coordinates of type `T`.
"""
function GenzMalik(v::Val{n}, ::Type{T}=Float64) where {n, T<:AbstractFloat}
function GenzMalik(v::Val{n}, ::Type{T}=Float64) where {n, T<:Real}
haskey(gmcache, (n,T)) && return gmcache[n,T]::GenzMalik{n,T}

n < 2 && throw(ArgumentError("invalid dimension $n: GenzMalik rule requires dimension > 2"))
Expand Down

0 comments on commit 7f27799

Please sign in to comment.